/* Generated by Cython 0.20.1 on Tue Mar  4 17:26:25 2014 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#define CYTHON_ABI "0_20_1"
#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
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY
#define Py_OptimizeFlag 0
#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 CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_As_int(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#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)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#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_VERSION_HEX < 0x02060000
  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
#endif
#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
  #define Py_TPFLAGS_IS_ABSTRACT 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#define __Pyx_PyString_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_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
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
                                         PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#if PY_VERSION_HEX < 0x02060000
  #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
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#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
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif


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

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__lxml__etree
#define __PYX_HAVE_API__lxml__etree
#include "string.h"
#include "stdio.h"
#include "pythread.h"
#include "etree_defs.h"
#include "lxml_endian.h"
#include "lxml-version.h"
#include "libxml/xmlversion.h"
#include "libxml/xmlstring.h"
#include "libxml/encoding.h"
#include "libxml/chvalid.h"
#include "libxml/hash.h"
#include "libxml/tree.h"
#include "libxml/uri.h"
#include "libxml/HTMLtree.h"
#include "libxml/valid.h"
#include "libxml/xmlIO.h"
#include "libxml/xmlsave.h"
#include "libxml/globals.h"
#include "libxml/xmlmemory.h"
#include "libxml/xmlerror.h"
#include "libxml/xpath.h"
#include "libxml/xpathInternals.h"
#include "libxml/c14n.h"
#include "limits.h"
#include "stdlib.h"
#include "stdarg.h"
#include "libxml/parser.h"
#include "libxml/parserInternals.h"
#include "libxml/HTMLparser.h"
#include "libxml/xinclude.h"
#include "libxslt/xslt.h"
#include "libxslt/xsltconfig.h"
#include "libxslt/xsltInternals.h"
#include "libxslt/extensions.h"
#include "libxslt/documents.h"
#include "libxslt/transform.h"
#include "libxslt/xsltutils.h"
#include "libxslt/security.h"
#include "libxslt/variables.h"
#include "libxslt/extra.h"
#include "libexslt/exslt.h"
#include "libxml/relaxng.h"
#include "libxml/xmlschemas.h"
#include "libxml/schematron.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

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

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


#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_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "lxml.etree.pyx",
  "xmlerror.pxi",
  "xslt.pxi",
  "proxy.pxi",
  "apihelpers.pxi",
  "readonlytree.pxi",
  "parser.pxi",
  "serializer.pxi",
  "extensions.pxi",
  "classlookup.pxi",
  "nsclasses.pxi",
  "docloader.pxi",
  "saxparser.pxi",
  "parsertarget.pxi",
  "iterparse.pxi",
  "xmlid.pxi",
  "xinclude.pxi",
  "cleanup.pxi",
  "xpath.pxi",
  "xsltext.pxi",
  "dtd.pxi",
  "relaxng.pxi",
  "xmlschema.pxi",
  "schematron.pxi",
  "public-api.pxi",
  "debug.pxi",
};

/*--- Type declarations ---*/
struct __pyx_obj_4lxml_5etree__TempStore;
struct __pyx_obj_4lxml_5etree__ExceptionContext;
struct __pyx_obj_4lxml_5etree__LogEntry;
struct __pyx_obj_4lxml_5etree__BaseErrorLog;
struct __pyx_obj_4lxml_5etree__ListErrorLog;
struct __pyx_obj_4lxml_5etree__ErrorLogContext;
struct __pyx_obj_4lxml_5etree__ErrorLog;
struct __pyx_obj_4lxml_5etree__DomainErrorLog;
struct __pyx_obj_4lxml_5etree__RotatingErrorLog;
struct __pyx_obj_4lxml_5etree_PyErrorLog;
struct LxmlDocument;
struct __pyx_obj_4lxml_5etree_DocInfo;
struct LxmlElement;
struct __pyx_obj_4lxml_5etree___ContentOnlyElement;
struct __pyx_obj_4lxml_5etree__Comment;
struct __pyx_obj_4lxml_5etree__ProcessingInstruction;
struct __pyx_obj_4lxml_5etree__Entity;
struct __pyx_obj_4lxml_5etree_QName;
struct LxmlElementTree;
struct __pyx_obj_4lxml_5etree__Attrib;
struct __pyx_obj_4lxml_5etree__AttribIterator;
struct LxmlElementTagMatcher;
struct LxmlElementIterator;
struct __pyx_obj_4lxml_5etree__MultiTagMatcher;
struct __pyx_obj_4lxml_5etree__ElementMatchIterator;
struct __pyx_obj_4lxml_5etree_ElementChildIterator;
struct __pyx_obj_4lxml_5etree_SiblingsIterator;
struct __pyx_obj_4lxml_5etree_AncestorsIterator;
struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator;
struct __pyx_obj_4lxml_5etree_ElementTextIterator;
struct __pyx_obj_4lxml_5etree_CDATA;
struct __pyx_obj_4lxml_5etree__ReadOnlyProxy;
struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy;
struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy;
struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy;
struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper;
struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper;
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy;
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy;
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy;
struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy;
struct LxmlElementBase;
struct __pyx_obj_4lxml_5etree_CommentBase;
struct __pyx_obj_4lxml_5etree_PIBase;
struct __pyx_obj_4lxml_5etree_EntityBase;
struct LxmlElementClassLookup;
struct LxmlFallbackElementClassLookup;
struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup;
struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup;
struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup;
struct __pyx_obj_4lxml_5etree_CustomElementClassLookup;
struct __pyx_obj_4lxml_5etree_PythonElementClassLookup;
struct __pyx_obj_4lxml_5etree__NamespaceRegistry;
struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry;
struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup;
struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry;
struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry;
struct __pyx_obj_4lxml_5etree__InputDocument;
struct __pyx_obj_4lxml_5etree_Resolver;
struct __pyx_obj_4lxml_5etree__ResolverRegistry;
struct __pyx_obj_4lxml_5etree__ResolverContext;
struct __pyx_obj_4lxml_5etree__ParserDictionaryContext;
struct __pyx_obj_4lxml_5etree__FileReaderContext;
struct __pyx_obj_4lxml_5etree__ParserContext;
struct __pyx_obj_4lxml_5etree__BaseParser;
struct __pyx_obj_4lxml_5etree__FeedParser;
struct __pyx_obj_4lxml_5etree_XMLParser;
struct __pyx_obj_4lxml_5etree_XMLPullParser;
struct __pyx_obj_4lxml_5etree_ETCompatXMLParser;
struct __pyx_obj_4lxml_5etree_HTMLParser;
struct __pyx_obj_4lxml_5etree_HTMLPullParser;
struct __pyx_obj_4lxml_5etree__SaxParserTarget;
struct __pyx_obj_4lxml_5etree__SaxParserContext;
struct __pyx_obj_4lxml_5etree__ParseEventsIterator;
struct __pyx_obj_4lxml_5etree_TreeBuilder;
struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget;
struct __pyx_obj_4lxml_5etree__TargetParserContext;
struct __pyx_obj_4lxml_5etree__FilelikeWriter;
struct __pyx_obj_4lxml_5etree_xmlfile;
struct __pyx_obj_4lxml_5etree__IncrementalFileWriter;
struct __pyx_obj_4lxml_5etree__FileWriterElement;
struct __pyx_obj_4lxml_5etree_iterparse;
struct __pyx_obj_4lxml_5etree_iterwalk;
struct __pyx_obj_4lxml_5etree__IDDict;
struct __pyx_obj_4lxml_5etree_XInclude;
struct __pyx_obj_4lxml_5etree__BaseContext;
struct __pyx_obj_4lxml_5etree__ExsltRegExp;
struct __pyx_obj_4lxml_5etree__ElementUnicodeResult;
struct __pyx_obj_4lxml_5etree__XPathContext;
struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase;
struct __pyx_obj_4lxml_5etree_XPathElementEvaluator;
struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator;
struct __pyx_obj_4lxml_5etree_XPath;
struct __pyx_obj_4lxml_5etree_ETXPath;
struct __pyx_obj_4lxml_5etree__XSLTResolverContext;
struct __pyx_obj_4lxml_5etree_XSLTAccessControl;
struct __pyx_obj_4lxml_5etree__XSLTContext;
struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam;
struct __pyx_obj_4lxml_5etree_XSLT;
struct __pyx_obj_4lxml_5etree__XSLTResultTree;
struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction;
struct __pyx_obj_4lxml_5etree_XSLTExtension;
struct __pyx_obj_4lxml_5etree__Validator;
struct __pyx_obj_4lxml_5etree__DTDElementContentDecl;
struct __pyx_obj_4lxml_5etree__DTDAttributeDecl;
struct __pyx_obj_4lxml_5etree__DTDElementDecl;
struct __pyx_obj_4lxml_5etree__DTDEntityDecl;
struct __pyx_obj_4lxml_5etree_DTD;
struct __pyx_obj_4lxml_5etree_RelaxNG;
struct __pyx_obj_4lxml_5etree_XMLSchema;
struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext;
struct __pyx_obj_4lxml_5etree_Schematron;
struct __pyx_obj_4lxml_5etree__MemDebug;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements;
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities;
struct __pyx_t_4lxml_5etree_qname;
struct __pyx_t_4lxml_5etree__nscache;
typedef struct __pyx_t_4lxml_5etree__nscache __pyx_t_4lxml_5etree__nscache;
struct __pyx_t_4lxml_5etree__ns_node_ref;
typedef struct __pyx_t_4lxml_5etree__ns_node_ref __pyx_t_4lxml_5etree__ns_node_ref;
struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":3
 * # Custom resolver API
 * 
 * ctypedef enum _InputDocumentDataType:             # <<<<<<<<<<<<<<
 *     PARSER_DATA_INVALID
 *     PARSER_DATA_EMPTY
 */
enum __pyx_t_4lxml_5etree__InputDocumentDataType {
  __pyx_e_4lxml_5etree_PARSER_DATA_INVALID,
  __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY,
  __pyx_e_4lxml_5etree_PARSER_DATA_STRING,
  __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME,
  __pyx_e_4lxml_5etree_PARSER_DATA_FILE
};
typedef enum __pyx_t_4lxml_5etree__InputDocumentDataType __pyx_t_4lxml_5etree__InputDocumentDataType;
enum __pyx_t_4lxml_5etree__SaxParserEvents {
  __pyx_e_4lxml_5etree_SAX_EVENT_START = 1,
  __pyx_e_4lxml_5etree_SAX_EVENT_END = 2,
  __pyx_e_4lxml_5etree_SAX_EVENT_DATA = 4,
  __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE = 8,
  __pyx_e_4lxml_5etree_SAX_EVENT_PI = 16,
  __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT = 32
};
typedef enum __pyx_t_4lxml_5etree__SaxParserEvents __pyx_t_4lxml_5etree__SaxParserEvents;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":11
 *     SAX_EVENT_COMMENT = 32
 * 
 * ctypedef enum _ParseEventFilter:             # <<<<<<<<<<<<<<
 *     PARSE_EVENT_FILTER_START     =  1
 *     PARSE_EVENT_FILTER_END       =  2
 */
enum __pyx_t_4lxml_5etree__ParseEventFilter {
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START = 1,
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END = 2,
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS = 4,
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS = 8,
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT = 16,
  __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI = 32
};
typedef enum __pyx_t_4lxml_5etree__ParseEventFilter __pyx_t_4lxml_5etree__ParseEventFilter;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":10
 *     """
 * 
 * cdef enum _OutputMethods:             # <<<<<<<<<<<<<<
 *     OUTPUT_METHOD_XML
 *     OUTPUT_METHOD_HTML
 */
enum __pyx_t_4lxml_5etree__OutputMethods {
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML,
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML,
  __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT
};

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":646
 *             old_writer._close(raise_on_error)
 * 
 * cdef enum _IncrementalFileWriterStatus:             # <<<<<<<<<<<<<<
 *     WRITER_STARTING = 0
 *     WRITER_DECL_WRITTEN = 1
 */
enum __pyx_t_4lxml_5etree__IncrementalFileWriterStatus {
  __pyx_e_4lxml_5etree_WRITER_STARTING = 0,
  __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN = 1,
  __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN = 2,
  __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT = 3,
  __pyx_e_4lxml_5etree_WRITER_FINISHED = 4
};

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":153
 * # PyPy requires us to store a Python reference for the
 * # namespace in order to keep the byte buffer alive.
 * cdef struct qname:             # <<<<<<<<<<<<<<
 *     const_xmlChar* c_name
 *     python.PyObject* href
 */
struct __pyx_t_4lxml_5etree_qname {
  const xmlChar *c_name;
  PyObject *href;
};

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":335
 * cdef class _BaseParser
 * cdef class QName
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
typedef xmlNode *(*_node_to_node_function)(xmlNode *);

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":220
 *         c_parent = c_parent.parent
 * 
 * ctypedef struct _nscache:             # <<<<<<<<<<<<<<
 *     xmlNs** new
 *     xmlNs** old
 */
struct __pyx_t_4lxml_5etree__nscache {
  xmlNs **new;
  xmlNs **old;
  size_t size;
  size_t last;
};

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":300
 *     return 0
 * 
 * ctypedef struct _ns_node_ref:             # <<<<<<<<<<<<<<
 *     xmlNs* ns
 *     xmlNode* node
 */
struct __pyx_t_4lxml_5etree__ns_node_ref {
  xmlNs *ns;
  xmlNode *node;
};

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2570
 *                 self._storeTags(item, seen)
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
 */
struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags {
  int __pyx_n;
  int force_into_dict;
};

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":211
 * # Element class lookup
 * 
 * ctypedef public object (*_element_class_lookup_function)(object, _Document, xmlNode*)             # <<<<<<<<<<<<<<
 * 
 * # class to store element class lookup functions
 */
typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocument *, xmlNode *);

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":25
 * # forward declarations
 * 
 * ctypedef int (*_register_function)(void* ctxt, name_utf, ns_uri_utf)             # <<<<<<<<<<<<<<
 * cdef class _ExsltRegExp
 * 
 */
typedef int (*__pyx_t_4lxml_5etree__register_function)(void *, PyObject *, PyObject *);

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":290
 * @cython.final
 * @cython.internal
 * cdef class _TempStore:             # <<<<<<<<<<<<<<
 *     cdef list _storage
 *     def __init__(self):
 */
struct __pyx_obj_4lxml_5etree__TempStore {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__TempStore *__pyx_vtab;
  PyObject *_storage;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":305
 * # class for temporarily storing exceptions raised in extensions
 * @cython.internal
 * cdef class _ExceptionContext:             # <<<<<<<<<<<<<<
 *     cdef object _exc_info
 *     cdef void clear(self):
 */
struct __pyx_obj_4lxml_5etree__ExceptionContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtab;
  PyObject *_exc_info;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":40
 * @cython.final
 * @cython.freelist(16)
 * cdef class _LogEntry:             # <<<<<<<<<<<<<<
 *     """A log message entry from an error log.
 * 
 */
struct __pyx_obj_4lxml_5etree__LogEntry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtab;
  int domain;
  int type;
  int level;
  int line;
  int column;
  PyObject *_message;
  PyObject *_filename;
  char *_c_message;
  xmlChar *_c_filename;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":167
 * 
 * 
 * cdef class _BaseErrorLog:             # <<<<<<<<<<<<<<
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 */
struct __pyx_obj_4lxml_5etree__BaseErrorLog {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__LogEntry *_first_error;
  PyObject *last_error;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":257
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"Immutable base version of a list based error log."
 *     cdef list _entries
 */
struct __pyx_obj_4lxml_5etree__ListErrorLog {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog __pyx_base;
  PyObject *_entries;
  int _offset;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":374
 * @cython.final
 * @cython.internal
 * cdef class _ErrorLogContext:             # <<<<<<<<<<<<<<
 *     """
 *     Error log context for the 'with' statement.
 */
struct __pyx_obj_4lxml_5etree__ErrorLogContext {
  PyObject_HEAD
  xmlStructuredErrorFunc old_error_func;
  void *old_error_context;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":383
 *     cdef void* old_error_context
 * 
 * cdef class _ErrorLog(_ListErrorLog):             # <<<<<<<<<<<<<<
 *     cdef list _logContexts
 *     def __cinit__(self):
 */
struct __pyx_obj_4lxml_5etree__ErrorLog {
  struct __pyx_obj_4lxml_5etree__ListErrorLog __pyx_base;
  PyObject *_logContexts;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":440
 *         self._entries.append(entry)
 * 
 * cdef class _DomainErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 */
struct __pyx_obj_4lxml_5etree__DomainErrorLog {
  struct __pyx_obj_4lxml_5etree__ErrorLog __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":449
 *             _ErrorLog.receive(self, entry)
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     cdef int _max_len
 *     def __init__(self, max_len):
 */
struct __pyx_obj_4lxml_5etree__RotatingErrorLog {
  struct __pyx_obj_4lxml_5etree__ErrorLog __pyx_base;
  int _max_len;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":467
 *                 del self._entries[:offset]
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"""PyErrorLog(self, logger_name=None, logger=None)
 *     A global error log that connects to the Python stdlib logging package.
 */
struct __pyx_obj_4lxml_5etree_PyErrorLog {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog __pyx_base;
  PyObject *level_map;
  PyObject *_map_level;
  PyObject *_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":331
 * 
 * # forward declarations
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]             # <<<<<<<<<<<<<<
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]
 * cdef class _BaseParser
 */
struct LxmlDocument {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtab;
  int _ns_counter;
  PyObject *_prefix_tail;
  xmlDoc *_c_doc;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlDocumentType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":520
 * 
 * 
 * cdef class DocInfo:             # <<<<<<<<<<<<<<
 *     u"Document information provided by parser and DTD."
 *     cdef _Document _doc
 */
struct __pyx_obj_4lxml_5etree_DocInfo {
  PyObject_HEAD
  struct LxmlDocument *_doc;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":332
 * # forward declarations
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]             # <<<<<<<<<<<<<<
 * cdef class _BaseParser
 * cdef class QName
 */
struct LxmlElement {
  PyObject_HEAD
  struct LxmlDocument *_doc;
  xmlNode *_c_node;
  PyObject *_tag;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1542
 * 
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):             # <<<<<<<<<<<<<<
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, u"this element does not have children or attributes"
 */
struct __pyx_obj_4lxml_5etree___ContentOnlyElement {
  struct LxmlElement __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *__pyx_vtab;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1609
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */
struct __pyx_obj_4lxml_5etree__Comment {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1617
 *         return u"<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */
struct __pyx_obj_4lxml_5etree__ProcessingInstruction {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1667
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(ur'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */
struct __pyx_obj_4lxml_5etree__Entity {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":334
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]
 * cdef class _BaseParser
 * cdef class QName             # <<<<<<<<<<<<<<
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)
 * 
 */
struct __pyx_obj_4lxml_5etree_QName {
  PyObject_HEAD
  PyObject *text;
  PyObject *localname;
  PyObject *namespace;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1764
 * 
 * 
 * cdef public class _ElementTree [ type LxmlElementTreeType,             # <<<<<<<<<<<<<<
 *                                  object LxmlElementTree ]:
 *     cdef _Document _doc
 */
struct LxmlElementTree {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtab;
  struct LxmlDocument *_doc;
  struct LxmlElement *_context_node;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTreeType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2234
 * @cython.final
 * @cython.freelist(16)
 * cdef class _Attrib:             # <<<<<<<<<<<<<<
 *     u"""A dict-like proxy for the ``Element.attrib`` property.
 *     """
 */
struct __pyx_obj_4lxml_5etree__Attrib {
  PyObject_HEAD
  struct LxmlElement *_element;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2374
 * @cython.final
 * @cython.internal
 * cdef class _AttribIterator:             # <<<<<<<<<<<<<<
 *     u"""Attribute iterator - for internal use only!
 *     """
 */
struct __pyx_obj_4lxml_5etree__AttribIterator {
  PyObject_HEAD
  struct LxmlElement *_node;
  xmlAttr *_c_attr;
  int _keysvalues;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2415
 * 
 * 
 * cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher,             # <<<<<<<<<<<<<<
 *                                        type LxmlElementTagMatcherType ]:
 *     """
 */
struct LxmlElementTagMatcher {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtab;
  PyObject *_pystrings;
  int _node_type;
  char *_href;
  char *_name;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2446
 *                 self._name = NULL
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [             # <<<<<<<<<<<<<<
 *     object LxmlElementIterator, type LxmlElementIteratorType ]:
 *     """
 */
struct LxmlElementIterator {
  struct LxmlElementTagMatcher __pyx_base;
  struct LxmlElement *_node;
  _node_to_node_function _next_element;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementIteratorType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2483
 * @cython.final
 * @cython.internal
 * cdef class _MultiTagMatcher:             # <<<<<<<<<<<<<<
 *     """
 *     Match an xmlNode against a list of tags.
 */
struct __pyx_obj_4lxml_5etree__MultiTagMatcher {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher *__pyx_vtab;
  PyObject *_py_tags;
  struct __pyx_t_4lxml_5etree_qname *_cached_tags;
  size_t _tag_count;
  size_t _cached_size;
  struct LxmlDocument *_cached_doc;
  int _node_types;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2624
 *         return False
 * 
 * cdef class _ElementMatchIterator:             # <<<<<<<<<<<<<<
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 */
struct __pyx_obj_4lxml_5etree__ElementMatchIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator *__pyx_vtab;
  struct LxmlElement *_node;
  _node_to_node_function _next_element;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2653
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     u"""ElementChildIterator(self, node, tag=None, reversed=False)
 *     Iterates over the children of an element.
 */
struct __pyx_obj_4lxml_5etree_ElementChildIterator {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2673
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     u"""SiblingsIterator(self, node, tag=None, preceding=False)
 *     Iterates over the siblings of an element.
 */
struct __pyx_obj_4lxml_5etree_SiblingsIterator {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2688
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     u"""AncestorsIterator(self, node, tag=None)
 *     Iterates over the ancestors of an element (from parent to parent).
 */
struct __pyx_obj_4lxml_5etree_AncestorsIterator {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2698
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator:             # <<<<<<<<<<<<<<
 *     u"""ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
 *     Iterates over an element and its sub-elements in document order (depth
 */
struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *__pyx_vtab;
  struct LxmlElement *_next_node;
  struct LxmlElement *_top_node;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2774
 *         return NULL
 * 
 * cdef class ElementTextIterator:             # <<<<<<<<<<<<<<
 *     u"""ElementTextIterator(self, element, tag=None, with_tail=True)
 *     Iterates over the text content of a subtree.
 */
struct __pyx_obj_4lxml_5etree_ElementTextIterator {
  PyObject_HEAD
  PyObject *_nextEvent;
  struct LxmlElement *_start_element;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2885
 * PI = ProcessingInstruction
 * 
 * cdef class CDATA:             # <<<<<<<<<<<<<<
 *     u"""CDATA(data)
 * 
 */
struct __pyx_obj_4lxml_5etree_CDATA {
  PyObject_HEAD
  PyObject *_utf8_data;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":4
 * 
 * @cython.internal
 * cdef class _ReadOnlyProxy:             # <<<<<<<<<<<<<<
 *     u"A read-only proxy class suitable for PIs/Comments (for internal use only!)."
 *     cdef bint _free_after_use
 */
struct __pyx_obj_4lxml_5etree__ReadOnlyProxy {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *__pyx_vtab;
  int _free_after_use;
  xmlNode *_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *_source_proxy;
  PyObject *_dependent_proxies;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":248
 * @cython.final
 * @cython.internal
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 */
struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":257
 * @cython.final
 * @cython.internal
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */
struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":275
 * 
 * @cython.internal
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"The main read-only Element proxy class (for internal use only!)."
 * 
 */
struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":365
 * 
 * @cython.internal
 * cdef class _OpaqueNodeWrapper:             # <<<<<<<<<<<<<<
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 */
struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper {
  PyObject_HEAD
  xmlNode *_c_node;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":372
 * @cython.final
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *     cdef int _assertNode(self) except -1:
 *         u"""This is our way of saying: this proxy is invalid!
 */
struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper {
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *__pyx_vtab;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":416
 * 
 * @cython.internal
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text content.
 *     """
 */
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":439
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text/target content of a
 *     processing instruction.
 */
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":456
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */
struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":472
 * @cython.final
 * @cython.internal
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only element that allows adding children and changing the
 *     text content (i.e. everything that adds to the subtree).
 */
struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy {
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":6
 * # Custom Element classes
 * 
 * cdef public class ElementBase(_Element) [ type LxmlElementBaseType,             # <<<<<<<<<<<<<<
 *                                           object LxmlElementBase ]:
 *     u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 */
struct LxmlElementBase {
  struct LxmlElement __pyx_base;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementBaseType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":97
 *                 raise TypeError, "Invalid child type: %r" % type(child)
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     u"""All custom Comment classes must inherit from this one.
 * 
 */
struct __pyx_obj_4lxml_5etree_CommentBase {
  struct __pyx_obj_4lxml_5etree__Comment __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":126
 *         self._init()
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     u"""All custom Processing Instruction classes must inherit from this one.
 * 
 */
struct __pyx_obj_4lxml_5etree_PIBase {
  struct __pyx_obj_4lxml_5etree__ProcessingInstruction __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":157
 *         self._init()
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     u"""All custom Entity classes must inherit from this one.
 * 
 */
struct __pyx_obj_4lxml_5etree_EntityBase {
  struct __pyx_obj_4lxml_5etree__Entity __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":214
 * 
 * # class to store element class lookup functions
 * cdef public class ElementClassLookup [ type LxmlElementClassLookupType,             # <<<<<<<<<<<<<<
 *                                        object LxmlElementClassLookup ]:
 *     u"""ElementClassLookup(self)
 */
struct LxmlElementClassLookup {
  PyObject_HEAD
  _element_class_lookup_function _lookup_function;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementClassLookupType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":223
 *         self._lookup_function = NULL # use default lookup
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \             # <<<<<<<<<<<<<<
 *          [ type LxmlFallbackElementClassLookupType,
 *            object LxmlFallbackElementClassLookup ]:
 */
struct LxmlFallbackElementClassLookup {
  struct LxmlElementClassLookup __pyx_base;
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtab;
  struct LxmlElementClassLookup *fallback;
  _element_class_lookup_function _fallback_function;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":265
 * # default lookup scheme
 * 
 * cdef class ElementDefaultClassLookup(ElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)
 *     Element class lookup scheme that always returns the default Element
 */
struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup {
  struct LxmlElementClassLookup __pyx_base;
  PyObject *element_class;
  PyObject *comment_class;
  PyObject *pi_class;
  PyObject *entity_class;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":344
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
 *     Checks an attribute of an Element and looks up the value in a
 */
struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_class_mapping;
  PyObject *_pytag;
  const xmlChar *_c_ns;
  const xmlChar *_c_name;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":396
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ParserBasedElementClassLookup(self, fallback=None)
 *     Element class lookup based on the XML parser.
 */
struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":413
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""CustomElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */
struct __pyx_obj_4lxml_5etree_CustomElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":468
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""PythonElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */
struct __pyx_obj_4lxml_5etree_PythonElementClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":15
 * 
 * @cython.internal
 * cdef class _NamespaceRegistry:             # <<<<<<<<<<<<<<
 *     u"Dictionary-like namespace registry"
 *     cdef object _ns_uri
 */
struct __pyx_obj_4lxml_5etree__NamespaceRegistry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *__pyx_vtab;
  PyObject *_ns_uri;
  PyObject *_ns_uri_utf;
  PyObject *_entries;
  char *_c_ns_uri_utf;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":87
 * @cython.final
 * @cython.internal
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 */
struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":101
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ElementNamespaceClassLookup(self, fallback=None)
 * 
 */
struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup {
  struct LxmlFallbackElementClassLookup __pyx_base;
  PyObject *_namespace_registries;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":192
 * 
 * @cython.internal
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 */
struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":207
 * @cython.final
 * @cython.internal
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):             # <<<<<<<<<<<<<<
 *     cdef object _prefix
 *     cdef bytes _prefix_utf
 */
struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry {
  struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry __pyx_base;
  PyObject *_prefix;
  PyObject *_prefix_utf;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":12
 * @cython.final
 * @cython.internal
 * cdef class _InputDocument:             # <<<<<<<<<<<<<<
 *     cdef _InputDocumentDataType _type
 *     cdef bytes _data_bytes
 */
struct __pyx_obj_4lxml_5etree__InputDocument {
  PyObject_HEAD
  __pyx_t_4lxml_5etree__InputDocumentDataType _type;
  PyObject *_data_bytes;
  PyObject *_filename;
  PyObject *_file;
  int _close_file;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":23
 * 
 * 
 * cdef class Resolver:             # <<<<<<<<<<<<<<
 *     u"This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):
 */
struct __pyx_obj_4lxml_5etree_Resolver {
  PyObject_HEAD
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":113
 * @cython.final
 * @cython.internal
 * cdef class _ResolverRegistry:             # <<<<<<<<<<<<<<
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 */
struct __pyx_obj_4lxml_5etree__ResolverRegistry {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *__pyx_vtab;
  PyObject *_resolvers;
  struct __pyx_obj_4lxml_5etree_Resolver *_default_resolver;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":161
 * 
 * @cython.internal
 * cdef class _ResolverContext(_ExceptionContext):             # <<<<<<<<<<<<<<
 *     cdef _ResolverRegistry _resolvers
 *     cdef _TempStore _storage
 */
struct __pyx_obj_4lxml_5etree__ResolverContext {
  struct __pyx_obj_4lxml_5etree__ExceptionContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *_resolvers;
  struct __pyx_obj_4lxml_5etree__TempStore *_storage;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":42
 * @cython.final
 * @cython.internal
 * cdef class _ParserDictionaryContext:             # <<<<<<<<<<<<<<
 *     # Global parser context to share the string dictionary.
 *     #
 */
struct __pyx_obj_4lxml_5etree__ParserDictionaryContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtab;
  xmlDict *_c_dict;
  struct __pyx_obj_4lxml_5etree__BaseParser *_default_parser;
  PyObject *_implied_parser_contexts;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":253
 * @cython.final
 * @cython.internal
 * cdef class _FileReaderContext:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _encoding
 */
struct __pyx_obj_4lxml_5etree__FileReaderContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *__pyx_vtab;
  PyObject *_filelike;
  PyObject *_encoding;
  PyObject *_url;
  PyObject *_bytes;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc_context;
  Py_ssize_t _bytes_read;
  char *_c_url;
  int _close_file_after_read;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":6
 * from lxml.includes cimport htmlparser
 * 
 * cdef class _ParserContext(_ResolverContext)             # <<<<<<<<<<<<<<
 * cdef class _SaxParserContext(_ParserContext)
 * cdef class _TargetParserContext(_SaxParserContext)
 */
struct __pyx_obj_4lxml_5etree__ParserContext {
  struct __pyx_obj_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *_validator;
  xmlParserCtxt *_c_ctxt;
  PyThread_type_lock _lock;
  struct LxmlDocument *_doc;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":333
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]
 * cdef public class _Element [ type LxmlElementType, object LxmlElement ]
 * cdef class _BaseParser             # <<<<<<<<<<<<<<
 * cdef class QName
 * ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*)
 */
struct __pyx_obj_4lxml_5etree__BaseParser {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser *__pyx_vtab;
  struct LxmlElementClassLookup *_class_lookup;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *_resolvers;
  struct __pyx_obj_4lxml_5etree__ParserContext *_parser_context;
  struct __pyx_obj_4lxml_5etree__ParserContext *_push_parser_context;
  int _parse_options;
  int _for_html;
  int _remove_comments;
  int _remove_pis;
  int _strip_cdata;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  PyObject *_filename;
  PyObject *target;
  PyObject *_default_encoding;
  PyObject *_events_to_collect;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1143
 * ############################################################
 * 
 * cdef class _FeedParser(_BaseParser):             # <<<<<<<<<<<<<<
 *     cdef bint _feed_parser_running
 * 
 */
struct __pyx_obj_4lxml_5etree__FeedParser {
  struct __pyx_obj_4lxml_5etree__BaseParser __pyx_base;
  int _feed_parser_running;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1359
 *     )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)
 * 
 */
struct __pyx_obj_4lxml_5etree_XMLParser {
  struct __pyx_obj_4lxml_5etree__FeedParser __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1442
 * 
 * 
 * cdef class XMLPullParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """XMLPullParser(self, events=None, *, tag=None, **kwargs)
 * 
 */
struct __pyx_obj_4lxml_5etree_XMLPullParser {
  struct __pyx_obj_4lxml_5etree_XMLParser __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1471
 * 
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     u"""ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \
 *                  dtd_validation=False, load_dtd=False, no_network=True, \
 */
struct __pyx_obj_4lxml_5etree_ETCompatXMLParser {
  struct __pyx_obj_4lxml_5etree_XMLParser __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1550
 *     )
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""HTMLParser(self, encoding=None, remove_blank_text=False, \
 *                    remove_comments=False, remove_pis=False, strip_cdata=True, \
 */
struct __pyx_obj_4lxml_5etree_HTMLParser {
  struct __pyx_obj_4lxml_5etree__FeedParser __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1606
 * 
 * 
 * cdef class HTMLPullParser(HTMLParser):             # <<<<<<<<<<<<<<
 *     """HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)
 * 
 */
struct __pyx_obj_4lxml_5etree_HTMLPullParser {
  struct __pyx_obj_4lxml_5etree_HTMLParser __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":41
 * 
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 *     def __cinit__(self):
 */
struct __pyx_obj_4lxml_5etree__SaxParserTarget {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtab;
  int _sax_event_filter;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":7
 * 
 * cdef class _ParserContext(_ResolverContext)
 * cdef class _SaxParserContext(_ParserContext)             # <<<<<<<<<<<<<<
 * cdef class _TargetParserContext(_SaxParserContext)
 * cdef class _ParserSchemaValidationContext
 */
struct __pyx_obj_4lxml_5etree__SaxParserContext {
  struct __pyx_obj_4lxml_5etree__ParserContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__SaxParserTarget *_target;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
  startElementNsSAX2Func _origSaxStart;
  endElementNsSAX2Func _origSaxEnd;
  startElementSAXFunc _origSaxStartNoNs;
  endElementSAXFunc _origSaxEndNoNs;
  charactersSAXFunc _origSaxData;
  cdataBlockSAXFunc _origSaxCData;
  internalSubsetSAXFunc _origSaxDoctype;
  commentSAXFunc _origSaxComment;
  processingInstructionSAXFunc _origSaxPI;
  startDocumentSAXFunc _origSaxStartDocument;
  int _event_filter;
  PyObject *_ns_stack;
  PyObject *_node_stack;
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *events_iterator;
  struct LxmlElement *_root;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":222
 * @cython.final
 * @cython.internal
 * cdef class _ParseEventsIterator:             # <<<<<<<<<<<<<<
 *     """A reusable parse events iterator"""
 *     cdef list _events
 */
struct __pyx_obj_4lxml_5etree__ParseEventsIterator {
  PyObject_HEAD
  PyObject *_events;
  int _event_index;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":627
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     u"""TreeBuilder(self, element_factory=None, parser=None)
 *     Parser target that builds a tree.
 */
struct __pyx_obj_4lxml_5etree_TreeBuilder {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
  PyObject *_factory;
  PyObject *_data;
  PyObject *_element_stack;
  PyObject *_element_stack_pop;
  struct LxmlElement *_last;
  int _in_tail;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":15
 * @cython.final
 * @cython.internal
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     cdef object _target_start
 *     cdef object _target_end
 */
struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget __pyx_base;
  PyObject *_target_start;
  PyObject *_target_end;
  PyObject *_target_data;
  PyObject *_target_doctype;
  PyObject *_target_pi;
  PyObject *_target_comment;
  int _start_takes_nsmap;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":8
 * cdef class _ParserContext(_ResolverContext)
 * cdef class _SaxParserContext(_ParserContext)
 * cdef class _TargetParserContext(_SaxParserContext)             # <<<<<<<<<<<<<<
 * cdef class _ParserSchemaValidationContext
 * cdef class _Validator
 */
struct __pyx_obj_4lxml_5etree__TargetParserContext {
  struct __pyx_obj_4lxml_5etree__SaxParserContext __pyx_base;
  PyObject *_python_target;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":373
 * @cython.final
 * @cython.internal
 * cdef class _FilelikeWriter:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _close_filelike
 */
struct __pyx_obj_4lxml_5etree__FilelikeWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *__pyx_vtab;
  PyObject *_filelike;
  PyObject *_close_filelike;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc_context;
  struct __pyx_obj_4lxml_5etree__ErrorLog *error_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":602
 * # incremental serialisation
 * 
 * cdef class xmlfile:             # <<<<<<<<<<<<<<
 *     """xmlfile(self, output_file, encoding=None, compression=None)
 * 
 */
struct __pyx_obj_4lxml_5etree_xmlfile {
  PyObject_HEAD
  PyObject *output_file;
  PyObject *encoding;
  int compresslevel;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *writer;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":655
 * @cython.final
 * @cython.internal
 * cdef class _IncrementalFileWriter:             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* _c_out
 *     cdef bytes _encoding
 */
struct __pyx_obj_4lxml_5etree__IncrementalFileWriter {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter *__pyx_vtab;
  xmlOutputBuffer *_c_out;
  PyObject *_encoding;
  const char *_c_encoding;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *_target;
  PyObject *_element_stack;
  int _status;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":891
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _FileWriterElement:             # <<<<<<<<<<<<<<
 *     cdef object _element
 *     cdef _IncrementalFileWriter _writer
 */
struct __pyx_obj_4lxml_5etree__FileWriterElement {
  PyObject_HEAD
  PyObject *_element;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *_writer;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * cdef class iterparse:             # <<<<<<<<<<<<<<
 *     u"""iterparse(self, source, events=("end",), tag=None, \
 *                   attribute_defaults=False, dtd_validation=False, \
 */
struct __pyx_obj_4lxml_5etree_iterparse {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_iterparse *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__FeedParser *_parser;
  PyObject *_tag;
  PyObject *_events;
  PyObject *root;
  PyObject *_source;
  PyObject *_filename;
  PyObject *_error;
  int _close_source_after_read;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":231
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     u"""iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
 */
struct __pyx_obj_4lxml_5etree_iterwalk {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_iterwalk *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *_matcher;
  PyObject *_node_stack;
  int _index;
  PyObject *_events;
  PyObject *_pop_event;
  int _event_filter;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":58
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     u"""IDDict(self, etree)
 *     A dictionary-like proxy class that mapps ID attributes to elements.
 */
struct __pyx_obj_4lxml_5etree__IDDict {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__IDDict *__pyx_vtab;
  struct LxmlDocument *_doc;
  PyObject *_keys;
  PyObject *_items;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":10
 *     pass
 * 
 * cdef class XInclude:             # <<<<<<<<<<<<<<
 *     u"""XInclude(self)
 *     XInclude processor.
 */
struct __pyx_obj_4lxml_5etree_XInclude {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":32
 * 
 * @cython.internal
 * cdef class _BaseContext:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _Document _doc
 */
struct __pyx_obj_4lxml_5etree__BaseContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtab;
  xmlXPathContext *_xpathCtxt;
  struct LxmlDocument *_doc;
  PyObject *_extensions;
  PyObject *_namespaces;
  PyObject *_global_namespaces;
  PyObject *_utf_refs;
  PyObject *_function_cache;
  PyObject *_eval_context_dict;
  int _build_smart_strings;
  struct __pyx_obj_4lxml_5etree__TempStore *_temp_refs;
  PyObject *_temp_documents;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *_exc;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":26
 * 
 * ctypedef int (*_register_function)(void* ctxt, name_utf, ns_uri_utf)
 * cdef class _ExsltRegExp             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
struct __pyx_obj_4lxml_5etree__ExsltRegExp {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *__pyx_vtab;
  PyObject *_compile_map;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":722
 * 
 * @cython.final
 * cdef class _ElementUnicodeResult(unicode):             # <<<<<<<<<<<<<<
 *     cdef _Element _parent
 *     cdef readonly object attrname
 */
struct __pyx_obj_4lxml_5etree__ElementUnicodeResult {
  PyUnicodeObject __pyx_base;
  struct LxmlElement *_parent;
  PyObject *attrname;
  int is_tail;
  int is_text;
  int is_attribute;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":52
 * @cython.final
 * @cython.internal
 * cdef class _XPathContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,
 */
struct __pyx_obj_4lxml_5etree__XPathContext {
  struct __pyx_obj_4lxml_5etree__BaseContext __pyx_base;
  PyObject *_variables;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":123
 *     _XPATH_VERSION_WARNING_REQUIRED = 0
 * 
 * cdef class _XPathEvaluatorBase:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _XPathContext _context
 */
struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *__pyx_vtab;
  xmlXPathContext *_xpathCtxt;
  struct __pyx_obj_4lxml_5etree__XPathContext *_context;
  PyThread_type_lock _eval_lock;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":249
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an element.
 */
struct __pyx_obj_4lxml_5etree_XPathElementEvaluator {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase __pyx_base;
  struct LxmlElement *_element;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":326
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     u"""XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an ElementTree.
 */
struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":405
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     A compiled XPath expression that can be called on Elements and ElementTrees.
 */
struct __pyx_obj_4lxml_5etree_XPath {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase __pyx_base;
  xmlXPathCompExpr *_xpath;
  PyObject *_path;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":481
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     u"""ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
 *     Special XPath class that supports the ElementTree {uri} notation for namespaces.
 */
struct __pyx_obj_4lxml_5etree_ETXPath {
  struct __pyx_obj_4lxml_5etree_XPath __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":52
 * @cython.final
 * @cython.internal
 * cdef class _XSLTResolverContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* _c_style_doc
 *     cdef _BaseParser _parser
 */
struct __pyx_obj_4lxml_5etree__XSLTResolverContext {
  struct __pyx_obj_4lxml_5etree__ResolverContext __pyx_base;
  xmlDoc *_c_style_doc;
  struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":168
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     u"""XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
 * 
 */
struct __pyx_obj_4lxml_5etree_XSLTAccessControl {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *__pyx_vtab;
  xsltSecurityPrefs *_prefs;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":271
 * @cython.final
 * @cython.internal
 * cdef class _XSLTContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef xslt.xsltTransformContext* _xsltCtxt
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 */
struct __pyx_obj_4lxml_5etree__XSLTContext {
  struct __pyx_obj_4lxml_5etree__BaseContext __pyx_base;
  xsltTransformContext *_xsltCtxt;
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *_extension_element_proxy;
  PyObject *_extension_elements;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":324
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _XSLTQuotedStringParam:             # <<<<<<<<<<<<<<
 *     u"""A wrapper class for literal XSLT string parameters that require
 *     quote escaping.
 */
struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam {
  PyObject_HEAD
  PyObject *strval;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":334
 * 
 * @cython.no_gc_clear
 * cdef class XSLT:             # <<<<<<<<<<<<<<
 *     u"""XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
 * 
 */
struct __pyx_obj_4lxml_5etree_XSLT {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLT *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__XSLTContext *_context;
  xsltStylesheet *_c_style;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *_xslt_resolver_context;
  struct __pyx_obj_4lxml_5etree_XSLTAccessControl *_access_control;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":698
 * 
 * @cython.final
 * cdef class _XSLTResultTree(_ElementTree):             # <<<<<<<<<<<<<<
 *     cdef XSLT _xslt
 *     cdef _Document _profile
 */
struct __pyx_obj_4lxml_5etree__XSLTResultTree {
  struct LxmlElementTree __pyx_base;
  struct __pyx_obj_4lxml_5etree_XSLT *_xslt;
  struct LxmlDocument *_profile;
  xmlChar *_buffer;
  Py_ssize_t _buffer_len;
  Py_ssize_t _buffer_refcnt;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":849
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         u"""parseXSL(self, parser=None)
 */
struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_obj_4lxml_5etree_PIBase __pyx_base;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     u"""Base class of an XSLT extension element.
 *     """
 */
struct __pyx_obj_4lxml_5etree_XSLTExtension {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *__pyx_vtab;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":10
 * cdef class _TargetParserContext(_SaxParserContext)
 * cdef class _ParserSchemaValidationContext
 * cdef class _Validator             # <<<<<<<<<<<<<<
 * cdef class XMLSchema(_Validator)
 * 
 */
struct __pyx_obj_4lxml_5etree__Validator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree__ErrorLog *_error_log;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":26
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _DTDElementContentDecl:             # <<<<<<<<<<<<<<
 *     cdef DTD _dtd
 *     cdef tree.xmlElementContent* _c_node
 */
struct __pyx_obj_4lxml_5etree__DTDElementContentDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlElementContent *_c_node;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":96
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _DTDAttributeDecl:             # <<<<<<<<<<<<<<
 *     cdef DTD _dtd
 *     cdef tree.xmlAttribute* _c_node
 */
struct __pyx_obj_4lxml_5etree__DTDAttributeDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlAttribute *_c_node;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":179
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _DTDElementDecl:             # <<<<<<<<<<<<<<
 *     cdef DTD _dtd
 *     cdef tree.xmlElement* _c_node
 */
struct __pyx_obj_4lxml_5etree__DTDElementDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlElement *_c_node;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":242
 * @cython.internal
 * @cython.freelist(8)
 * cdef class _DTDEntityDecl:             # <<<<<<<<<<<<<<
 *     cdef DTD _dtd
 *     cdef tree.xmlEntity* _c_node
 */
struct __pyx_obj_4lxml_5etree__DTDEntityDecl {
  PyObject_HEAD
  struct __pyx_obj_4lxml_5etree_DTD *_dtd;
  xmlEntity *_c_node;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":267
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     u"""DTD(self, file=None, external_id=None)
 *     A DTD validator.
 */
struct __pyx_obj_4lxml_5etree_DTD {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlDtd *_c_dtd;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":22
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     u"""RelaxNG(self, etree=None, file=None)
 *     Turn a document into a Relax NG validator.
 */
struct __pyx_obj_4lxml_5etree_RelaxNG {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlRelaxNG *_c_schema;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":11
 * cdef class _ParserSchemaValidationContext
 * cdef class _Validator
 * cdef class XMLSchema(_Validator)             # <<<<<<<<<<<<<<
 * 
 * class ParseError(LxmlSyntaxError):
 */
struct __pyx_obj_4lxml_5etree_XMLSchema {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchema *_c_schema;
  int _has_default_attributes;
  int _add_attribute_defaults;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":9
 * cdef class _SaxParserContext(_ParserContext)
 * cdef class _TargetParserContext(_SaxParserContext)
 * cdef class _ParserSchemaValidationContext             # <<<<<<<<<<<<<<
 * cdef class _Validator
 * cdef class XMLSchema(_Validator)
 */
struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *__pyx_vtab;
  struct __pyx_obj_4lxml_5etree_XMLSchema *_schema;
  xmlSchemaValidCtxt *_valid_ctxt;
  xmlSchemaSAXPlugStruct *_sax_plug;
  int _add_default_attributes;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":22
 * # Schematron
 * 
 * cdef class Schematron(_Validator):             # <<<<<<<<<<<<<<
 *     u"""Schematron(self, etree=None, file=None)
 *     A Schematron validator.
 */
struct __pyx_obj_4lxml_5etree_Schematron {
  struct __pyx_obj_4lxml_5etree__Validator __pyx_base;
  xmlSchematron *_c_schema;
  xmlDoc *_c_schema_doc;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":4
 * @cython.final
 * @cython.internal
 * cdef class _MemDebug:             # <<<<<<<<<<<<<<
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 */
struct __pyx_obj_4lxml_5etree__MemDebug {
  PyObject_HEAD
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":165
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues {
  PyObject_HEAD
  xmlEnumeration *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":225
 *                return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes {
  PyObject_HEAD
  xmlAttribute *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":316
 *            return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements {
  PyObject_HEAD
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self;
};


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":329
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 */
struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities {
  PyObject_HEAD
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_node;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self;
};



/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":290
 * @cython.final
 * @cython.internal
 * cdef class _TempStore:             # <<<<<<<<<<<<<<
 *     cdef list _storage
 *     def __init__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__TempStore {
  int (*add)(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *);
  int (*clear)(struct __pyx_obj_4lxml_5etree__TempStore *);
};
static struct __pyx_vtabstruct_4lxml_5etree__TempStore *__pyx_vtabptr_4lxml_5etree__TempStore;
static int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *);
static int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":305
 * # class for temporarily storing exceptions raised in extensions
 * @cython.internal
 * cdef class _ExceptionContext:             # <<<<<<<<<<<<<<
 *     cdef object _exc_info
 *     cdef void clear(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext {
  void (*clear)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  void (*_store_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  void (*_store_exception)(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *);
  int (*_has_raised)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
  int (*_raise_if_stored)(struct __pyx_obj_4lxml_5etree__ExceptionContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *__pyx_vtabptr_4lxml_5etree__ExceptionContext;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlDocumentType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":350
 * @cython.final
 * @cython.freelist(8)
 * cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:             # <<<<<<<<<<<<<<
 *     u"""Internal base class to reference a libxml document.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__Document {
  PyObject *(*getroot)(struct LxmlDocument *);
  int (*hasdoctype)(struct LxmlDocument *);
  PyObject *(*getdoctype)(struct LxmlDocument *);
  PyObject *(*getxmlinfo)(struct LxmlDocument *);
  PyObject *(*isstandalone)(struct LxmlDocument *);
  PyObject *(*buildNewPrefix)(struct LxmlDocument *);
  xmlNs *(*_findOrBuildNodeNs)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *, int);
  int (*_setNodeNs)(struct LxmlDocument *, xmlNode *, const xmlChar *);
};
static struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtabptr_4lxml_5etree__Document;
static PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *);
static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *);
static xmlNs *__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *, int);
static int __pyx_f_4lxml_5etree_9_Document__setNodeNs(struct LxmlDocument *, xmlNode *, const xmlChar *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":753
 * 
 * @cython.internal
 * cdef class _BaseParser:             # <<<<<<<<<<<<<<
 *     cdef ElementClassLookup _class_lookup
 *     cdef _ResolverRegistry _resolvers
 */

struct __pyx_vtabstruct_4lxml_5etree__BaseParser {
  PyObject *(*_setBaseURL)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *);
  PyObject *(*_collectEvents)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_getParserContext)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_getPushParserContext)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_createContext)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *);
  int (*_registerHtmlErrorHandler)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *);
  xmlParserCtxt *(*_newParserCtxt)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  xmlParserCtxt *(*_newPushParserCtxt)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__BaseParser *(*_copy)(struct __pyx_obj_4lxml_5etree__BaseParser *);
  xmlDoc *(*_parseUnicodeDoc)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, char *);
  xmlDoc *(*_parseDoc)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *, int, char *);
  xmlDoc *(*_parseDocFromFile)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *);
  xmlDoc *(*_parseDocFromFilelike)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseParser *__pyx_vtabptr_4lxml_5etree__BaseParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":40
 * @cython.final
 * @cython.freelist(16)
 * cdef class _LogEntry:             # <<<<<<<<<<<<<<
 *     """A log message entry from an error log.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__LogEntry {
  PyObject *(*_setError)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError *);
  PyObject *(*_setGeneric)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, int, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry *__pyx_vtabptr_4lxml_5etree__LogEntry;
static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError *);
static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setGeneric(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, int, PyObject *, PyObject *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":167
 * 
 * 
 * cdef class _BaseErrorLog:             # <<<<<<<<<<<<<<
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 */

struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog {
  PyObject *(*copy)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch);
  PyObject *(*receive)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch);
  void (*_receive)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError *);
  void (*_receiveGeneric)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, int, PyObject *, PyObject *);
  PyObject *(*_buildParseException)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *);
  PyObject *(*_buildExceptionMessage)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
static void __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError *);
static void __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, int, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":257
 *         return message
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"Immutable base version of a list based error log."
 *     cdef list _entries
 */

struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog *__pyx_vtabptr_4lxml_5etree__ListErrorLog;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":383
 *     cdef void* old_error_context
 * 
 * cdef class _ErrorLog(_ListErrorLog):             # <<<<<<<<<<<<<<
 *     cdef list _logContexts
 *     def __cinit__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog __pyx_base;
  int (*__pyx___enter__)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  int (*connect)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  int (*disconnect)(struct __pyx_obj_4lxml_5etree__ErrorLog *);
  PyObject *(*clear)(struct __pyx_obj_4lxml_5etree__ErrorLog *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *__pyx_vtabptr_4lxml_5etree__ErrorLog;
static int __pyx_f_4lxml_5etree_9_ErrorLog___enter__(struct __pyx_obj_4lxml_5etree__ErrorLog *);
static int __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *);
static int __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":440
 *         self._entries.append(entry)
 * 
 * cdef class _DomainErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 */

struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog *__pyx_vtabptr_4lxml_5etree__DomainErrorLog;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":449
 *             _ErrorLog.receive(self, entry)
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):             # <<<<<<<<<<<<<<
 *     cdef int _max_len
 *     def __init__(self, max_len):
 */

struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog *__pyx_vtabptr_4lxml_5etree__RotatingErrorLog;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":467
 *                 del self._entries[:offset]
 * 
 * cdef class PyErrorLog(_BaseErrorLog):             # <<<<<<<<<<<<<<
 *     u"""PyErrorLog(self, logger_name=None, logger=None)
 *     A global error log that connects to the Python stdlib logging package.
 */

struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog {
  struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog *__pyx_vtabptr_4lxml_5etree_PyErrorLog;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1542
 * 
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):             # <<<<<<<<<<<<<<
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, u"this element does not have children or attributes"
 */

struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement {
  int (*_raiseImmutable)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1609
 *         return []
 * 
 * cdef class _Comment(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__Comment {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__Comment *__pyx_vtabptr_4lxml_5etree__Comment;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1617
 *         return u"<!--%s-->" % self.text
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1667
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(ur'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 * 
 * cdef class _Entity(__ContentOnlyElement):             # <<<<<<<<<<<<<<
 *     property tag:
 *         def __get__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__Entity {
  struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__Entity *__pyx_vtabptr_4lxml_5etree__Entity;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTreeType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1764
 * 
 * 
 * cdef public class _ElementTree [ type LxmlElementTreeType,             # <<<<<<<<<<<<<<
 *                                  object LxmlElementTree ]:
 *     cdef _Document _doc
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementTree {
  int (*_assertHasRoot)(struct LxmlElementTree *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtabptr_4lxml_5etree__ElementTree;
static int __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *);

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2415
 * 
 * 
 * cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher,             # <<<<<<<<<<<<<<
 *                                        type LxmlElementTagMatcherType ]:
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher {
  PyObject *(*_initTagMatch)(struct LxmlElementTagMatcher *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlElementIteratorType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2446
 *                 self._name = NULL
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [             # <<<<<<<<<<<<<<
 *     object LxmlElementIterator, type LxmlElementIteratorType ]:
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_base;
  void (*_storeNext)(struct LxmlElementIterator *, struct LxmlElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *__pyx_vtabptr_4lxml_5etree__ElementIterator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2483
 * @cython.final
 * @cython.internal
 * cdef class _MultiTagMatcher:             # <<<<<<<<<<<<<<
 *     """
 *     Match an xmlNode against a list of tags.
 */

struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher {
  int (*rejectsAll)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
  int (*rejectsAllAttributes)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
  int (*matchesType)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int);
  void (*_clear)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
  PyObject *(*initTagMatch)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *);
  PyObject *(*_storeTags)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *, PyObject *);
  int (*cacheTags)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, struct LxmlDocument *, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args);
  int (*matches)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlNode *);
  int (*matchesNsTag)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, const xmlChar *, const xmlChar *);
  int (*matchesAttribute)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlAttr *);
};
static struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher *__pyx_vtabptr_4lxml_5etree__MultiTagMatcher;
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int);
static void __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *);
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *, PyObject *);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, struct LxmlDocument *, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlNode *);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, const xmlChar *, const xmlChar *);
static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlAttr *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2624
 *         return False
 * 
 * cdef class _ElementMatchIterator:             # <<<<<<<<<<<<<<
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 */

struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator {
  PyObject *(*_initTagMatcher)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, PyObject *);
  int (*_storeNext)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, struct LxmlElement *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
static PyObject *__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, PyObject *);
static int __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, struct LxmlElement *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2653
 *         return current_node
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     u"""ElementChildIterator(self, node, tag=None, reversed=False)
 *     Iterates over the children of an element.
 */

struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator *__pyx_vtabptr_4lxml_5etree_ElementChildIterator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2673
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     u"""SiblingsIterator(self, node, tag=None, preceding=False)
 *     Iterates over the siblings of an element.
 */

struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator *__pyx_vtabptr_4lxml_5etree_SiblingsIterator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2688
 *         self._storeNext(node)
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):             # <<<<<<<<<<<<<<
 *     u"""AncestorsIterator(self, node, tag=None)
 *     Iterates over the ancestors of an element (from parent to parent).
 */

struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator {
  struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator *__pyx_vtabptr_4lxml_5etree_AncestorsIterator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2698
 *         self._storeNext(node)
 * 
 * cdef class ElementDepthFirstIterator:             # <<<<<<<<<<<<<<
 *     u"""ElementDepthFirstIterator(self, node, tag=None, inclusive=True)
 *     Iterates over an element and its sub-elements in document order (depth
 */

struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator {
  xmlNode *(*_nextNodeAnyTag)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
  xmlNode *(*_nextNodeMatchTag)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator *__pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator;
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);
static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":4
 * 
 * @cython.internal
 * cdef class _ReadOnlyProxy:             # <<<<<<<<<<<<<<
 *     u"A read-only proxy class suitable for PIs/Comments (for internal use only!)."
 *     cdef bint _free_after_use
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy {
  int (*_assertNode)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  int (*_raise_unsupported_type)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  void (*free_after_use)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *);
  PyObject *(*__pyx___copy__)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch);
  PyObject *(*getchildren)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":248
 * @cython.final
 * @cython.internal
 * cdef class _ReadOnlyPIProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":257
 * @cython.final
 * @cython.internal
 * cdef class _ReadOnlyEntityProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":275
 * 
 * @cython.internal
 * cdef class _ReadOnlyElementProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"The main read-only Element proxy class (for internal use only!)."
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":372
 * @cython.final
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *     cdef int _assertNode(self) except -1:
 *         u"""This is our way of saying: this proxy is invalid!
 */

struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper {
  int (*_assertNode)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *);
  PyObject *(*append)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper *__pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper;
static int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *);
static PyObject *__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":416
 * 
 * @cython.internal
 * cdef class _ModifyContentOnlyProxy(_ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text content.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":439
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyPIProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only proxy that allows changing the text/target content of a
 *     processing instruction.
 */

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":456
 * @cython.final
 * @cython.internal
 * cdef class _ModifyContentOnlyEntityProxy(_ModifyContentOnlyProxy):             # <<<<<<<<<<<<<<
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 */

struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":472
 * @cython.final
 * @cython.internal
 * cdef class _AppendOnlyElementProxy(_ReadOnlyElementProxy):             # <<<<<<<<<<<<<<
 *     u"""A read-only element that allows adding children and changing the
 *     text content (i.e. everything that adds to the subtree).
 */

struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy {
  struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy __pyx_base;
  PyObject *(*append)(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *__pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy;
static PyObject *__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":97
 *                 raise TypeError, "Invalid child type: %r" % type(child)
 * 
 * cdef class CommentBase(_Comment):             # <<<<<<<<<<<<<<
 *     u"""All custom Comment classes must inherit from this one.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_CommentBase {
  struct __pyx_vtabstruct_4lxml_5etree__Comment __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_CommentBase *__pyx_vtabptr_4lxml_5etree_CommentBase;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":126
 *         self._init()
 * 
 * cdef class PIBase(_ProcessingInstruction):             # <<<<<<<<<<<<<<
 *     u"""All custom Processing Instruction classes must inherit from this one.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_PIBase {
  struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PIBase *__pyx_vtabptr_4lxml_5etree_PIBase;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":157
 *         self._init()
 * 
 * cdef class EntityBase(_Entity):             # <<<<<<<<<<<<<<
 *     u"""All custom Entity classes must inherit from this one.
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_EntityBase {
  struct __pyx_vtabstruct_4lxml_5etree__Entity __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_EntityBase *__pyx_vtabptr_4lxml_5etree_EntityBase;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":223
 *         self._lookup_function = NULL # use default lookup
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \             # <<<<<<<<<<<<<<
 *          [ type LxmlFallbackElementClassLookupType,
 *            object LxmlFallbackElementClassLookup ]:
 */

struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup {
  void (*_setFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *);
};
static struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":344
 * # attribute based lookup scheme
 * 
 * cdef class AttributeBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)
 *     Checks an attribute of an Element and looks up the value in a
 */

struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":396
 * #  per-parser lookup scheme
 * 
 * cdef class ParserBasedElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ParserBasedElementClassLookup(self, fallback=None)
 *     Element class lookup based on the XML parser.
 */

struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup *__pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":413
 * #  custom class lookup based on node type, namespace, name
 * 
 * cdef class CustomElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""CustomElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */

struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup *__pyx_vtabptr_4lxml_5etree_CustomElementClassLookup;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":468
 * # read-only tree based class lookup
 * 
 * cdef class PythonElementClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""PythonElementClassLookup(self, fallback=None)
 *     Element class lookup based on a subclass method.
 */

struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup *__pyx_vtabptr_4lxml_5etree_PythonElementClassLookup;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":15
 * 
 * @cython.internal
 * cdef class _NamespaceRegistry:             # <<<<<<<<<<<<<<
 *     u"Dictionary-like namespace registry"
 *     cdef object _ns_uri
 */

struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry {
  PyObject *(*_get)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, PyObject *);
  PyObject *(*_getForString)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, char *);
};
static struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":87
 * @cython.final
 * @cython.internal
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 */

struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":101
 * 
 * 
 * cdef class ElementNamespaceClassLookup(FallbackElementClassLookup):             # <<<<<<<<<<<<<<
 *     u"""ElementNamespaceClassLookup(self, fallback=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup {
  struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup *__pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":192
 * 
 * @cython.internal
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):             # <<<<<<<<<<<<<<
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 */

struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":207
 * @cython.final
 * @cython.internal
 * cdef class _XPathFunctionNamespaceRegistry(_FunctionNamespaceRegistry):             # <<<<<<<<<<<<<<
 *     cdef object _prefix
 *     cdef bytes _prefix_utf
 */

struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry {
  struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":113
 * @cython.final
 * @cython.internal
 * cdef class _ResolverRegistry:             # <<<<<<<<<<<<<<
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 */

struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *(*_copy)(struct __pyx_obj_4lxml_5etree__ResolverRegistry *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry *__pyx_vtabptr_4lxml_5etree__ResolverRegistry;
static struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":161
 * 
 * @cython.internal
 * cdef class _ResolverContext(_ExceptionContext):             # <<<<<<<<<<<<<<
 *     cdef _ResolverRegistry _resolvers
 *     cdef _TempStore _storage
 */

struct __pyx_vtabstruct_4lxml_5etree__ResolverContext {
  struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverContext *__pyx_vtabptr_4lxml_5etree__ResolverContext;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":504
 * 
 * @cython.internal
 * cdef class _ParserContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef _ErrorLog _error_log
 *     cdef _ParserSchemaValidationContext _validator
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__ParserContext *(*_copy)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  void (*_initParserContext)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *);
  void (*_resetParserContext)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*prepare)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  int (*cleanup)(struct __pyx_obj_4lxml_5etree__ParserContext *);
  PyObject *(*_handleParseResult)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *);
  xmlDoc *(*_handleParseResultDoc)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserContext *__pyx_vtabptr_4lxml_5etree__ParserContext;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":62
 * #@cython.final
 * @cython.internal
 * cdef class _SaxParserContext(_ParserContext):             # <<<<<<<<<<<<<<
 *     u"""This class maps SAX2 events to parser target events.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_base;
  void (*_setSaxParserTarget)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, struct __pyx_obj_4lxml_5etree__SaxParserTarget *);
  void (*_connectTarget)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
  void (*_connectEvents)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
  PyObject *(*_setEventFilter)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, PyObject *);
  int (*startDocument)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlDoc *);
  int (*pushEvent)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, xmlNode *);
  int (*flushEvents)(struct __pyx_obj_4lxml_5etree__SaxParserContext *);
  void (*_handleSaxException)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *__pyx_vtabptr_4lxml_5etree__SaxParserContext;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":97
 * @cython.final
 * @cython.internal
 * cdef class _TargetParserContext(_SaxParserContext):             # <<<<<<<<<<<<<<
 *     u"""This class maps SAX2 events to the ET parser target interface.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext __pyx_base;
  int (*_setTarget)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *);
  void (*_cleanupTargetParserContext)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *);
};
static struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *__pyx_vtabptr_4lxml_5etree__TargetParserContext;
static int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *);
static void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":172
 * @cython.final
 * @cython.internal
 * cdef class _ParserSchemaValidationContext:             # <<<<<<<<<<<<<<
 *     cdef XMLSchema _schema
 *     cdef xmlschema.xmlSchemaValidCtxt* _valid_ctxt
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*copy)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
  void (*inject_default_attributes)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *);
  int (*connect)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
  void (*disconnect)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
  int (*isvalid)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext *__pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext;
static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *);
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *);
static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);
static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3282
 *     pass
 * 
 * cdef class _Validator:             # <<<<<<<<<<<<<<
 *     u"Base class for XML validators."
 *     cdef _ErrorLog _error_log
 */

struct __pyx_vtabstruct_4lxml_5etree__Validator {
  PyObject *(*_append_log_message)(struct __pyx_obj_4lxml_5etree__Validator *, int, int, int, int, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_clear_error_log)(struct __pyx_obj_4lxml_5etree__Validator *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__Validator *__pyx_vtabptr_4lxml_5etree__Validator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":26
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 * 
 * cdef class XMLSchema(_Validator):             # <<<<<<<<<<<<<<
 *     u"""XMLSchema(self, etree=None, file=None)
 *     Turn a document into an XML Schema validator.
 */

struct __pyx_vtabstruct_4lxml_5etree_XMLSchema {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*_newSaxValidator)(struct __pyx_obj_4lxml_5etree_XMLSchema *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *__pyx_vtabptr_4lxml_5etree_XMLSchema;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":42
 * @cython.final
 * @cython.internal
 * cdef class _ParserDictionaryContext:             # <<<<<<<<<<<<<<
 *     # Global parser context to share the string dictionary.
 *     #
 */

struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext {
  void (*initMainParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*_findThreadParserContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  void (*setDefaultParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  struct __pyx_obj_4lxml_5etree__BaseParser *(*getDefaultParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  xmlDict *(*_getThreadDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *);
  void (*initThreadDictRef)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
  void (*initParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
  void (*initXPathParserDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
  void (*initDocDict)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *);
  struct __pyx_obj_4lxml_5etree__ParserContext *(*findImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
  void (*pushImpliedContextFromParser)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
  void (*pushImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
  void (*popImpliedContext)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext *__pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *);
static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *);
static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":253
 * @cython.final
 * @cython.internal
 * cdef class _FileReaderContext:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _encoding
 */

struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext {
  PyObject *(*_close_file)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlParserInputBuffer *(*_createParserInputBuffer)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlParserInput *(*_createParserInput)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *);
  xmlDtd *(*_readDtd)(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
  xmlDoc *(*_readDoc)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int);
  int (*copyToBuffer)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext *__pyx_vtabptr_4lxml_5etree__FileReaderContext;
static PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
static xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *);
static xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *);
static xmlDoc *__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int);
static int __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1143
 * ############################################################
 * 
 * cdef class _FeedParser(_BaseParser):             # <<<<<<<<<<<<<<
 *     cdef bint _feed_parser_running
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree__FeedParser {
  struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_base;
  PyObject *(*feed)(struct __pyx_obj_4lxml_5etree__FeedParser *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*close)(struct __pyx_obj_4lxml_5etree__FeedParser *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4lxml_5etree__FeedParser *__pyx_vtabptr_4lxml_5etree__FeedParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1359
 *     )
 * 
 * cdef class XMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XMLParser {
  struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLParser *__pyx_vtabptr_4lxml_5etree_XMLParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1442
 * 
 * 
 * cdef class XMLPullParser(XMLParser):             # <<<<<<<<<<<<<<
 *     """XMLPullParser(self, events=None, *, tag=None, **kwargs)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser {
  struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *__pyx_vtabptr_4lxml_5etree_XMLPullParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1471
 * 
 * 
 * cdef class ETCompatXMLParser(XMLParser):             # <<<<<<<<<<<<<<
 *     u"""ETCompatXMLParser(self, encoding=None, attribute_defaults=False, \
 *                  dtd_validation=False, load_dtd=False, no_network=True, \
 */

struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser {
  struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser *__pyx_vtabptr_4lxml_5etree_ETCompatXMLParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1550
 *     )
 * 
 * cdef class HTMLParser(_FeedParser):             # <<<<<<<<<<<<<<
 *     u"""HTMLParser(self, encoding=None, remove_blank_text=False, \
 *                    remove_comments=False, remove_pis=False, strip_cdata=True, \
 */

struct __pyx_vtabstruct_4lxml_5etree_HTMLParser {
  struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLParser *__pyx_vtabptr_4lxml_5etree_HTMLParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1606
 * 
 * 
 * cdef class HTMLPullParser(HTMLParser):             # <<<<<<<<<<<<<<
 *     """HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser {
  struct __pyx_vtabstruct_4lxml_5etree_HTMLParser __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *__pyx_vtabptr_4lxml_5etree_HTMLPullParser;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":41
 * 
 * 
 * cdef class _SaxParserTarget:             # <<<<<<<<<<<<<<
 *     cdef int _sax_event_filter
 *     def __cinit__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget {
  PyObject *(*_handleSaxStart)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_handleSaxEnd)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  int (*_handleSaxData)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
  int (*_handleSaxDoctype)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_handleSaxPi)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *);
  PyObject *(*_handleSaxComment)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":627
 * ############################################################
 * 
 * cdef class TreeBuilder(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     u"""TreeBuilder(self, element_factory=None, parser=None)
 *     Parser target that builds a tree.
 */

struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_base;
  int (*_flush)(struct __pyx_obj_4lxml_5etree_TreeBuilder *);
};
static struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder *__pyx_vtabptr_4lxml_5etree_TreeBuilder;
static int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":15
 * @cython.final
 * @cython.internal
 * cdef class _PythonSaxParserTarget(_SaxParserTarget):             # <<<<<<<<<<<<<<
 *     cdef object _target_start
 *     cdef object _target_end
 */

struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget {
  struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget *__pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":373
 * @cython.final
 * @cython.internal
 * cdef class _FilelikeWriter:             # <<<<<<<<<<<<<<
 *     cdef object _filelike
 *     cdef object _close_filelike
 */

struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter {
  xmlOutputBuffer *(*_createOutputBuffer)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *);
  int (*write)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int);
  int (*close)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *);
};
static struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter *__pyx_vtabptr_4lxml_5etree__FilelikeWriter;
static xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *);
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_write(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int);
static int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":655
 * @cython.final
 * @cython.internal
 * cdef class _IncrementalFileWriter:             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* _c_out
 *     cdef bytes _encoding
 */

struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter {
  PyObject *(*_write_qname)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *);
  PyObject *(*_write_start_element)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_write_attributes_and_namespaces)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_write_attributes_list)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_write_end_element)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_find_prefix)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_collect_namespaces)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
  PyObject *(*_close)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);
  PyObject *(*_handle_error)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);
};
static struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter *__pyx_vtabptr_4lxml_5etree__IncrementalFileWriter;
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);
static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":5
 * DEF __ITERPARSE_CHUNK_SIZE = 32768
 * 
 * cdef class iterparse:             # <<<<<<<<<<<<<<
 *     u"""iterparse(self, source, events=("end",), tag=None, \
 *                   attribute_defaults=False, dtd_validation=False, \
 */

struct __pyx_vtabstruct_4lxml_5etree_iterparse {
  PyObject *(*_close_source)(struct __pyx_obj_4lxml_5etree_iterparse *);
  int (*_read_more_events)(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__SaxParserContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree_iterparse *__pyx_vtabptr_4lxml_5etree_iterparse;
static PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *);
static int __pyx_f_4lxml_5etree_9iterparse__read_more_events(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__SaxParserContext *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":231
 * 
 * 
 * cdef class iterwalk:             # <<<<<<<<<<<<<<
 *     u"""iterwalk(self, element_or_tree, events=("end",), tag=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_iterwalk {
  int (*_start_node)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *);
  struct LxmlElement *(*_end_node)(struct __pyx_obj_4lxml_5etree_iterwalk *);
};
static struct __pyx_vtabstruct_4lxml_5etree_iterwalk *__pyx_vtabptr_4lxml_5etree_iterwalk;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":58
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))
 * 
 * cdef class _IDDict:             # <<<<<<<<<<<<<<
 *     u"""IDDict(self, etree)
 *     A dictionary-like proxy class that mapps ID attributes to elements.
 */

struct __pyx_vtabstruct_4lxml_5etree__IDDict {
  PyObject *(*_build_keys)(struct __pyx_obj_4lxml_5etree__IDDict *);
  PyObject *(*_build_items)(struct __pyx_obj_4lxml_5etree__IDDict *);
};
static struct __pyx_vtabstruct_4lxml_5etree__IDDict *__pyx_vtabptr_4lxml_5etree__IDDict;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":456
 * @cython.final
 * @cython.internal
 * cdef class _ExsltRegExp:             # <<<<<<<<<<<<<<
 *     cdef dict _compile_map
 *     def __cinit__(self):
 */

struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp {
  PyObject *(*_make_string)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *);
  PyObject *(*_compile)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *);
  PyObject *(*_register_in_context)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp *__pyx_vtabptr_4lxml_5etree__ExsltRegExp;
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__compile(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":32
 * 
 * @cython.internal
 * cdef class _BaseContext:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _Document _doc
 */

struct __pyx_vtabstruct_4lxml_5etree__BaseContext {
  struct __pyx_obj_4lxml_5etree__BaseContext *(*_copy)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_to_utf)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  void (*_set_xpath_context)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlXPathContext *);
  PyObject *(*_register_context)(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *);
  PyObject *(*_cleanup_context)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_release_context)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*addNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *);
  PyObject *(*registerNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *);
  PyObject *(*registerLocalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*registerGlobalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*unregisterGlobalNamespaces)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  void (*_unregisterNamespace)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  int (*_addLocalExtensionFunction)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *, PyObject *);
  PyObject *(*registerGlobalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*registerLocalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*unregisterAllFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*unregisterGlobalFunctions)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function);
  PyObject *(*_find_cached_function)(struct __pyx_obj_4lxml_5etree__BaseContext *, const xmlChar *, const xmlChar *);
  PyObject *(*_release_temp_refs)(struct __pyx_obj_4lxml_5etree__BaseContext *);
  PyObject *(*_hold)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
  struct LxmlDocument *(*_findDocumentForNode)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *);
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseContext *__pyx_vtabptr_4lxml_5etree__BaseContext;
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(struct __pyx_obj_4lxml_5etree__BaseContext *, const xmlChar *, const xmlChar *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *);
static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *);
static struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":52
 * @cython.final
 * @cython.internal
 * cdef class _XPathContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,
 */

struct __pyx_vtabstruct_4lxml_5etree__XPathContext {
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_base;
  PyObject *(*set_context)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *);
  PyObject *(*register_context)(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *);
  PyObject *(*unregister_context)(struct __pyx_obj_4lxml_5etree__XPathContext *);
  void (*registerExsltFunctions)(struct __pyx_obj_4lxml_5etree__XPathContext *);
  PyObject *(*registerVariables)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *);
  PyObject *(*registerVariable)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathContext *__pyx_vtabptr_4lxml_5etree__XPathContext;
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *);
static void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *);
static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":123
 *     _XPATH_VERSION_WARNING_REQUIRED = 0
 * 
 * cdef class _XPathEvaluatorBase:             # <<<<<<<<<<<<<<
 *     cdef xpath.xmlXPathContext* _xpathCtxt
 *     cdef _XPathContext _context
 */

struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase {
  PyObject *(*set_context)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathContext *);
  int (*_checkAbsolutePath)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, char *);
  int (*_lock)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  void (*_unlock)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_raise_parse_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_raise_eval_error)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
  PyObject *(*_handle_result)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathObject *, struct LxmlDocument *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);
static void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":249
 * 
 * 
 * cdef class XPathElementEvaluator(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an element.
 */

struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator {
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":326
 * 
 * 
 * cdef class XPathDocumentEvaluator(XPathElementEvaluator):             # <<<<<<<<<<<<<<
 *     u"""XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     Create an XPath evaluator for an ElementTree.
 */

struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator {
  struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *__pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":405
 * 
 * 
 * cdef class XPath(_XPathEvaluatorBase):             # <<<<<<<<<<<<<<
 *     u"""XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 *     A compiled XPath expression that can be called on Elements and ElementTrees.
 */

struct __pyx_vtabstruct_4lxml_5etree_XPath {
  struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_XPath *__pyx_vtabptr_4lxml_5etree_XPath;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":481
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 * cdef class ETXPath(XPath):             # <<<<<<<<<<<<<<
 *     u"""ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)
 *     Special XPath class that supports the ElementTree {uri} notation for namespaces.
 */

struct __pyx_vtabstruct_4lxml_5etree_ETXPath {
  struct __pyx_vtabstruct_4lxml_5etree_XPath __pyx_base;
  PyObject *(*_nsextract_path)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *);
};
static struct __pyx_vtabstruct_4lxml_5etree_ETXPath *__pyx_vtabptr_4lxml_5etree_ETXPath;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":52
 * @cython.final
 * @cython.internal
 * cdef class _XSLTResolverContext(_ResolverContext):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* _c_style_doc
 *     cdef _BaseParser _parser
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext {
  struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_base;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *(*_copy)(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *__pyx_vtabptr_4lxml_5etree__XSLTResolverContext;
static struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":168
 * # XSLT file/network access control
 * 
 * cdef class XSLTAccessControl:             # <<<<<<<<<<<<<<
 *     u"""XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl {
  PyObject *(*_setAccess)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, int);
  void (*_register_in_context)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *);
  PyObject *(*_optval)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl *__pyx_vtabptr_4lxml_5etree_XSLTAccessControl;
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, int);
static void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *);
static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":271
 * @cython.final
 * @cython.internal
 * cdef class _XSLTContext(_BaseContext):             # <<<<<<<<<<<<<<
 *     cdef xslt.xsltTransformContext* _xsltCtxt
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTContext {
  struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_base;
  PyObject *(*register_context)(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *);
  PyObject *(*free_context)(struct __pyx_obj_4lxml_5etree__XSLTContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *__pyx_vtabptr_4lxml_5etree__XSLTContext;
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_register_context(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *);
static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":334
 * 
 * @cython.no_gc_clear
 * cdef class XSLT:             # <<<<<<<<<<<<<<
 *     u"""XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)
 * 
 */

struct __pyx_vtabstruct_4lxml_5etree_XSLT {
  xmlDoc *(*_run_transform)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, const char **, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLT *__pyx_vtabptr_4lxml_5etree_XSLT;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":698
 * 
 * @cython.final
 * cdef class _XSLTResultTree(_ElementTree):             # <<<<<<<<<<<<<<
 *     cdef XSLT _xslt
 *     cdef _Document _profile
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree {
  struct __pyx_vtabstruct_4lxml_5etree__ElementTree __pyx_base;
  PyObject *(*_saveToStringAndSize)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, xmlChar **, int *);
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree *__pyx_vtabptr_4lxml_5etree__XSLTResultTree;
static PyObject *__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, xmlChar **, int *);


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":849
 *     return __findStylesheetByID(doc, id=id)
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):             # <<<<<<<<<<<<<<
 *     def parseXSL(self, parser=None):
 *         u"""parseXSL(self, parser=None)
 */

struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction {
  struct __pyx_vtabstruct_4lxml_5etree_PIBase __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction *__pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":3
 * # XSLT extension elements
 * 
 * cdef class XSLTExtension:             # <<<<<<<<<<<<<<
 *     u"""Base class of an XSLT extension element.
 *     """
 */

struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension {
  PyObject *(*_collectXSLTResultContent)(struct __pyx_obj_4lxml_5etree_XSLTExtension *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xmlNode *, int, int);
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *__pyx_vtabptr_4lxml_5etree_XSLTExtension;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":267
 * # DTD
 * 
 * cdef class DTD(_Validator):             # <<<<<<<<<<<<<<
 *     u"""DTD(self, file=None, external_id=None)
 *     A DTD validator.
 */

struct __pyx_vtabstruct_4lxml_5etree_DTD {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_DTD *__pyx_vtabptr_4lxml_5etree_DTD;


/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":22
 * # RelaxNG
 * 
 * cdef class RelaxNG(_Validator):             # <<<<<<<<<<<<<<
 *     u"""RelaxNG(self, etree=None, file=None)
 *     Turn a document into a Relax NG validator.
 */

struct __pyx_vtabstruct_4lxml_5etree_RelaxNG {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_RelaxNG *__pyx_vtabptr_4lxml_5etree_RelaxNG;


struct __pyx_vtabstruct_4lxml_5etree_Schematron {
  struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_base;
};
static struct __pyx_vtabstruct_4lxml_5etree_Schematron *__pyx_vtabptr_4lxml_5etree_Schematron;
#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); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

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

static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*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 void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*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 void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

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

static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
    PyObject *method, *result = NULL;
    if (unlikely(!args)) return NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_Call(method, args, NULL);
    Py_DECREF(method);
bad:
    Py_DECREF(args);
    return result;
}
#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
#define __Pyx_PyObject_CallMethod0(obj, name) \
    __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

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

#include <string.h>

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

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

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

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

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

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

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

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

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

#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) \
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback); /*proto*/

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

static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

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

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

#if 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) */
#endif /* < Py2.5  */

#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) : \
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */

static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
         PyObject* string, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    return __Pyx_decode_c_bytes(
        PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string),
        start, stop, encoding, errors, decode_func);
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/

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

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

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

#define __Pyx_PyObject_Pop(L) (PyList_CheckExact(L) ? \
    __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); /*proto*/
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L); /*proto*/

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

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

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

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

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

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

#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

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

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
                                             int is_tuple, int has_known_size, int decref_tuple);

static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

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

static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/

static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); /*proto*/

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

static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);

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

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

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

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

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

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

static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); /*proto*/

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static void __pyx_module_cleanup(PyObject *self); /*proto*/
static int __Pyx_RegisterCleanup(void); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

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

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character); /*proto*/

static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

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

static int __Pyx_check_binary_version(void);

static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/

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

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

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'cython' */

/* Module declarations from 'lxml' */

/* Module declarations from 'libc' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'lxml.python' */

/* Module declarations from 'lxml.includes' */

/* Module declarations from 'lxml.includes.tree' */

/* Module declarations from 'lxml.includes.config' */

/* Module declarations from 'lxml.includes.xmlerror' */

/* Module declarations from 'lxml.includes.xpath' */

/* Module declarations from 'lxml.includes.c14n' */

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'libc.limits' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'lxml.includes.uri' */

/* Module declarations from 'lxml.cvarargs' */

/* Module declarations from 'lxml.includes.xmlparser' */

/* Module declarations from 'lxml.includes.htmlparser' */

/* Module declarations from 'lxml.includes.xinclude' */

/* Module declarations from 'lxml.includes.xslt' */

/* Module declarations from 'lxml.includes.dtdvalid' */

/* Module declarations from 'lxml.includes.relaxng' */

/* Module declarations from 'lxml.includes.xmlschema' */

/* Module declarations from 'lxml.includes.schematron' */

/* Module declarations from 'lxml.etree' */
static PyTypeObject *__pyx_ptype_4lxml_5etree__TempStore = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ExceptionContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Document = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Element = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__BaseParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_QName = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__LogEntry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__BaseErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ListErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLogContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__DomainErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__RotatingErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_PyErrorLog = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_DocInfo = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree___ContentOnlyElement = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Comment = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ProcessingInstruction = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Entity = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTree = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Attrib = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__AttribIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementTagMatcher = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__MultiTagMatcher = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementMatchIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementChildIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_SiblingsIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_AncestorsIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementTextIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_CDATA = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_CommentBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_PIBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_EntityBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_FallbackElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_CustomElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_PythonElementClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__NamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__InputDocument = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_Resolver = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverRegistry = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ResolverContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParserContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__TargetParserContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__Validator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XMLSchema = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParserDictionaryContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FileReaderContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FeedParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XMLParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XMLPullParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ETCompatXMLParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_HTMLPullParser = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__SaxParserTarget = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ParseEventsIterator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_TreeBuilder = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__PythonSaxParserTarget = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FilelikeWriter = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_xmlfile = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__IncrementalFileWriter = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__FileWriterElement = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_iterparse = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_iterwalk = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__IDDict = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XInclude = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ExsltRegExp = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__BaseContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__ElementUnicodeResult = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XPathContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XPathEvaluatorBase = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XPathElementEvaluator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XPath = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_ETXPath = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResolverContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTAccessControl = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTContext = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XSLT = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTResultTree = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_XSLTExtension = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__DTDElementContentDecl = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__DTDAttributeDecl = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__DTDElementDecl = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__DTDEntityDecl = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_DTD = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_RelaxNG = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree_Schematron = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree__MemDebug = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct__itervalues = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_1_iterattributes = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_2_iterelements = 0;
static PyTypeObject *__pyx_ptype_4lxml_5etree___pyx_scope_struct_3_iterentities = 0;
static PyObject *__pyx_v_4lxml_5etree__unicode = 0;
static PyObject *__pyx_v_4lxml_5etree_os_path_abspath = 0;
static PyObject *__pyx_v_4lxml_5etree_BytesIO = 0;
static PyObject *__pyx_v_4lxml_5etree_StringIO = 0;
static PyObject *__pyx_v_4lxml_5etree__elementpath = 0;
static PyObject *__pyx_v_4lxml_5etree_sys = 0;
static PyObject *__pyx_v_4lxml_5etree_re = 0;
static PyObject *__pyx_v_4lxml_5etree_islice = 0;
static PyObject *__pyx_v_4lxml_5etree_ITER_EMPTY = 0;
static PyObject *__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING = 0;
static PyObject *__pyx_v_4lxml_5etree__FILENAME_ENCODING = 0;
static char *__pyx_v_4lxml_5etree__C_FILENAME_ENCODING;
static PyObject *__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = 0;
static PyObject *__pyx_v_4lxml_5etree__check_internal_prefix = 0;
static PyObject *__pyx_v_4lxml_5etree__Error = 0;
static PyObject *__pyx_v_4lxml_5etree_error_super_init = 0;
static int __pyx_v_4lxml_5etree__LIBXML_VERSION_INT;
static PyObject *__pyx_v_4lxml_5etree_OrderedDict = 0;
static PyObject *__pyx_v_4lxml_5etree___RE_XML_ENCODING = 0;
static PyObject *__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = 0;
static PyObject *__pyx_v_4lxml_5etree___HAS_XML_ENCODING = 0;
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = 0;
static PyObject *__pyx_v_4lxml_5etree___ERROR_LEVELS = 0;
static PyObject *__pyx_v_4lxml_5etree___ERROR_DOMAINS = 0;
static PyObject *__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = 0;
static PyObject *__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = 0;
static PyObject *__pyx_v_4lxml_5etree__PREFIX_CACHE = 0;
static PyObject *__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = 0;
static _element_class_lookup_function __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS;
static PyObject *__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = 0;
static struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = 0;
static PyObject *__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = 0;
static PyObject *__pyx_v_4lxml_5etree__LxmlSyntaxError = 0;
static PyObject *__pyx_v_4lxml_5etree__ParseError = 0;
static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = 0;
static const char *__pyx_v_4lxml_5etree__UNICODE_ENCODING;
static xmlExternalEntityLoader __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER;
static int __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;
static struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = 0;
static int __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS;
static struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = 0;
static PyObject *__pyx_v_4lxml_5etree_NS_END_EVENT = 0;
static PyObject *__pyx_v_4lxml_5etree_inspect_getargspec = 0;
static PyObject *__pyx_v_4lxml_5etree_GzipFile = 0;
static PyObject *__pyx_v_4lxml_5etree__find_id_attributes = 0;
static PyObject *__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES = 0;
static PyObject *__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = 0;
static PyObject *__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = 0;
static int __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED;
static PyObject *__pyx_v_4lxml_5etree__replace_strings = 0;
static PyObject *__pyx_v_4lxml_5etree__find_namespaces = 0;
static xsltDocLoaderFunc __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER;
static PyObject *__pyx_v_4lxml_5etree_EMPTY_DICT = 0;
static PyObject *__pyx_v_4lxml_5etree__RE_PI_HREF = 0;
static PyObject *__pyx_v_4lxml_5etree__FIND_PI_HREF = 0;
static PyObject *__pyx_v_4lxml_5etree__REPLACE_PI_HREF = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree___findStylesheetByID = 0;
static struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_4lxml_5etree__check_for_default_attributes = 0;
static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int); /*proto*/
static CYTHON_INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__isProxyAliveInPypy(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *, struct LxmlDocument *, xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *, xmlNode *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__plainFakeRootDoc(xmlDoc *, xmlNode *, int); /*proto*/
static void __pyx_f_4lxml_5etree__destroyFakeDoc(xmlDoc *, xmlDoc *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__fakeDocElementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree_attemptDeallocation(xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree_getDeallocationTop(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree_canDeallocateChildNodes(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__copyParentNamespaces(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__appendToNsCache(__pyx_t_4lxml_5etree__nscache *, xmlNs *, xmlNs *); /*proto*/
static int __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(xmlNode *, __pyx_t_4lxml_5etree__nscache *, xmlNs **); /*proto*/
static int __pyx_f_4lxml_5etree_moveNodeToDocument(struct LxmlDocument *, xmlDoc *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *, struct LxmlDocument *, size_t); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNameForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *, xmlDict *, xmlDict *); /*proto*/
static void __pyx_f_4lxml_5etree_displayNode(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidNode(struct LxmlElement *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDoc(struct LxmlDocument *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentOrRaise(PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOrRaise(PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__makeElement(PyObject *, xmlDoc *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__initNewElement(struct LxmlElement *, int, PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__initNodeNamespaces(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initNodeAttributes(xmlNode *, struct LxmlDocument *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__addAttributeToNode(xmlNode *, struct LxmlDocument *, int, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *); /*proto*/
static xmlNs *__pyx_f_4lxml_5etree__searchNsByHref(xmlNode *, const xmlChar *, int); /*proto*/
static int __pyx_f_4lxml_5etree__replaceNodeByChildren(struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeValue(xmlNode *, xmlAttr *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeValueFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNodeAttributeValue(xmlNode *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__delAttribute(struct LxmlElement *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__delAttributeFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectAttributes(xmlNode *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__stripEncodingDeclaration(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__hasEncodingDeclaration(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__removeText(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__setNodeText(xmlNode *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__setTailText(xmlNode *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__resolveQNameText(struct LxmlElement *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *); /*proto*/
static CYTHON_INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__findChildSlice(PyObject *, xmlNode *, xmlNode **, Py_ssize_t *, Py_ssize_t *); /*proto*/
static int __pyx_f_4lxml_5etree__isFullSlice(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatchesExactly(xmlNode *, struct __pyx_t_4lxml_5etree_qname *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__nsTagMatchesExactly(const xmlChar *, const xmlChar *, struct __pyx_t_4lxml_5etree_qname *); /*proto*/
static Py_ssize_t __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(xmlDoc *, PyObject *, struct __pyx_t_4lxml_5etree_qname *, int); /*proto*/
static int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__removeSiblings(xmlNode *, xmlElementType, int); /*proto*/
static void __pyx_f_4lxml_5etree__moveTail(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__copyTail(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__copyNonElementSiblings(xmlNode *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__deleteSlice(struct LxmlDocument *, xmlNode *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_f_4lxml_5etree__replaceSlice(struct LxmlElement *, xmlNode *, Py_ssize_t, Py_ssize_t, int, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__prependChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *, struct LxmlElement *); /*proto*/
static int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *, struct LxmlElement *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree_isutf8(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree_check_string_utf8(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrNone(const xmlChar *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrEmpty(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_funicode(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__utf8orNone(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__isFilePath(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__encodeFilename(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__decodeFilename(const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__decodeFilenameWithLength(const xmlChar *, size_t); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__encodeFilenameUTF8(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___getNsTag(PyObject *, int); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlNameIsValid(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__characterReferenceIsValid(const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__uriValidOrRaise(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(const xmlChar *, const xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__getFilenameForFile(PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(void *, char *, ...); /*proto*/
static void __pyx_f_4lxml_5etree__initThreadLogging(void); /*proto*/
static void __pyx_f_4lxml_5etree_connectErrorLog(void *); /*proto*/
static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getGlobalErrorLog(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__setGlobalErrorLog(struct __pyx_obj_4lxml_5etree__BaseErrorLog *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___copyGlobalErrorLog(void); /*proto*/
static void __pyx_f_4lxml_5etree__forwardError(void *, xmlError *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveError(void *, xmlError *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXSLTError(void *, char *, ...); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___initErrorConstants(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree___initPrefixCache(void); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__documentFactory(xmlDoc *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
static struct LxmlElementTree *__pyx_f_4lxml_5etree__elementTreeFactory(struct LxmlDocument *, struct LxmlElement *); /*proto*/
static struct LxmlElementTree *__pyx_f_4lxml_5etree__newElementTree(struct LxmlDocument *, struct LxmlElement *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attributeIteratorFactory(struct LxmlElement *, int); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createElement(xmlDoc *, PyObject *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createComment(xmlDoc *, const xmlChar *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createPI(xmlDoc *, const xmlChar *, const xmlChar *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__createEntity(xmlDoc *, const xmlChar *); /*proto*/
static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, xmlNode *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *); /*proto*/
static struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(xmlNode *); /*proto*/
static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__nonRoNodeOf(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__validateNodeClass(xmlNode *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__lookupDefaultElementClass(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__attribute_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__parser_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__custom_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__python_class_lookup(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static void __pyx_f_4lxml_5etree__setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_nselement_class(PyObject *, struct LxmlDocument *, xmlNode *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__find_all_extension_prefixes(void); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initResolverContext(struct __pyx_obj_4lxml_5etree__ResolverContext *, struct __pyx_obj_4lxml_5etree__ResolverRegistry *); /*proto*/
static int __pyx_f_4lxml_5etree__setupPythonUnicode(void); /*proto*/
static const char *__pyx_f_4lxml_5etree__findEncodingName(const xmlChar *, int); /*proto*/
static int __pyx_f_4lxml_5etree__readFilelikeParser(void *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__readFileParser(void *, char *, int); /*proto*/
static xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(const char *, const char *, xmlParserCtxt *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__ResolverRegistry *, xmlParserCtxt *); /*proto*/
static void __pyx_f_4lxml_5etree__forwardParserError(xmlParserCtxt *, xmlError *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveParserError(void *, xmlError *); /*proto*/
static int __pyx_f_4lxml_5etree__raiseParseError(xmlParserCtxt *, PyObject *, struct __pyx_obj_4lxml_5etree__ErrorLog *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *, xmlDoc *, PyObject *, int, int); /*proto*/
static int __pyx_f_4lxml_5etree__fixHtmlDictNames(xmlDict *, xmlDoc *); /*proto*/
static int __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(xmlDict *, xmlDoc *, xmlNode *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(xmlDict *, xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__htmlCtxtResetPush(xmlParserCtxt *, const char *, int, const char *, const char *, int); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDoc(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFile(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFilelike(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__newXMLDoc(void); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__newHTMLDoc(void); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__copyDoc(xmlDoc *, int); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__copyDocRoot(xmlDoc *, xmlNode *); /*proto*/
static xmlNode *__pyx_f_4lxml_5etree__copyNodeToDoc(xmlNode *, xmlDoc *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocument(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocumentFromURL(PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseMemoryDocument(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static struct LxmlDocument *__pyx_f_4lxml_5etree__parseFilelikeDocument(PyObject *, PyObject *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static int __pyx_f_4lxml_5etree__buildParseEventFilter(PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__appendNsEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *, int, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStart(void *, const xmlChar *, const xmlChar *, const xmlChar *, int, const xmlChar **, int, int, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetStart(void *, const xmlChar *, const xmlChar *, const xmlChar *, int, const xmlChar **, int, int, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStartNoNs(void *, const xmlChar *, const xmlChar **); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs(void *, const xmlChar *, const xmlChar **); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__callTargetSaxStart(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *, PyObject *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *, const xmlChar *, const xmlChar *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxEnd(void *, const xmlChar *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxEndNoNs(void *, const xmlChar *); /*proto*/
static int __pyx_f_4lxml_5etree__pushSaxNsEndEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *); /*proto*/
static int __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *, const xmlChar *, const xmlChar *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxData(void *, const xmlChar *, int); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetDoctype(void *, const xmlChar *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxStartDocument(void *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxPI(void *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxPIEvent(void *, const xmlChar *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxTargetComment(void *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__handleSaxComment(void *, const xmlChar *); /*proto*/
static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findLastEventNode(xmlParserCtxt *); /*proto*/
static int __pyx_f_4lxml_5etree__findOutputMethod(PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__textToString(xmlNode *, PyObject *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tostring(struct LxmlElement *, PyObject *, PyObject *, PyObject *, int, int, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tostringC14N(PyObject *, int, int, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDoctype(xmlOutputBuffer *, const xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *, xmlNode *, const char *, const xmlChar *, int, int, int, int, int, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDeclarationToBuffer(xmlOutputBuffer *, const xmlChar *, const char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeDtdToBuffer(xmlOutputBuffer *, xmlDoc *, const xmlChar *, const char *); /*proto*/
static void __pyx_f_4lxml_5etree__writeTail(xmlOutputBuffer *, xmlNode *, const char *, int, int); /*proto*/
static void __pyx_f_4lxml_5etree__writePrevSiblings(xmlOutputBuffer *, xmlNode *, const char *, int); /*proto*/
static void __pyx_f_4lxml_5etree__writeNextSiblings(xmlOutputBuffer *, xmlNode *, const char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__writeFilelikeWriter(void *, char *, int); /*proto*/
static int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tofilelike(PyObject *, struct LxmlElement *, PyObject *, PyObject *, PyObject *, int, int, int, int, int, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__create_output_buffer(PyObject *, const char *, int, xmlOutputBuffer **); /*proto*/
static xmlChar **__pyx_f_4lxml_5etree__convert_ns_prefixes(xmlDict *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__tofilelikeC14N(PyObject *, struct LxmlElement *, int, int, int, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__countNsDefs(xmlNode *); /*proto*/
static int __pyx_f_4lxml_5etree__appendStartNsEvents(xmlNode *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashItemList(void *, void *, xmlChar *); /*proto*/
static void __pyx_f_4lxml_5etree__collectIdHashKeys(void *, void *, xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_attributes(xmlNode *, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_elements(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__strip_tags(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *); /*proto*/
static void __pyx_f_4lxml_5etree__forwardXPathError(void *, xmlError *); /*proto*/
static void __pyx_f_4lxml_5etree__receiveXPathError(void *, xmlError *); /*proto*/
static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *, xmlNode *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *, int); /*proto*/
static void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *); /*proto*/
static struct LxmlElement *__pyx_f_4lxml_5etree__instantiateElementFromXPath(xmlNode *, struct LxmlDocument *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *, struct LxmlElement *, PyObject *, int); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *, xmlNode *, struct __pyx_obj_4lxml_5etree__BaseContext *); /*proto*/
static void __pyx_f_4lxml_5etree__extension_function_call(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, xmlXPathParserContext *, int); /*proto*/
static void __pyx_f_4lxml_5etree__xpath_function_call(xmlXPathParserContext *, int); /*proto*/
static int __pyx_f_4lxml_5etree__register_xpath_function(void *, PyObject *, PyObject *); /*proto*/
static int __pyx_f_4lxml_5etree__unregister_xpath_function(void *, PyObject *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *, void *, xmlChar *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__initXSLTResolverContext(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *, struct __pyx_obj_4lxml_5etree__BaseParser *); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__xslt_resolve_from_python(const xmlChar *, void *, int, int *); /*proto*/
static void __pyx_f_4lxml_5etree__xslt_store_resolver_exception(const xmlChar *, void *, xsltLoadType); /*proto*/
static xmlDoc *__pyx_f_4lxml_5etree__xslt_doc_loader(const xmlChar *, xmlDict *, int, void *, xsltLoadType); /*proto*/
static int __pyx_f_4lxml_5etree__register_xslt_function(void *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__convert_xslt_parameters(xsltTransformContext *, PyObject *, const char ***); /*proto*/
static struct __pyx_obj_4lxml_5etree_XSLT *__pyx_f_4lxml_5etree__copyXSLT(struct __pyx_obj_4lxml_5etree_XSLT *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__xsltResultTreeFactory(struct LxmlDocument *, struct __pyx_obj_4lxml_5etree_XSLT *, struct LxmlDocument *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__findStylesheetByID(struct LxmlDocument *, PyObject *); /*proto*/
static PyObject *__pyx_f_4lxml_5etree__registerXSLTExtensions(xsltTransformContext *, PyObject *); /*proto*/
static void __pyx_f_4lxml_5etree__callExtensionElement(xsltTransformContext *, xmlNode *, xmlNode *, void *); /*proto*/
static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDTDNode(PyObject *, void *); /*proto*/
static xmlDtd *__pyx_f_4lxml_5etree__parseDtdFromFilelike(PyObject *); /*proto*/
static struct __pyx_obj_4lxml_5etree_DTD *__pyx_f_4lxml_5etree__dtdFactory(xmlDtd *); /*proto*/
static xmlDtd *__pyx_f_4lxml_5etree__copyDtd(xmlDtd *); /*proto*/
static void __pyx_f_4lxml_5etree__linkDtdAttribute(xmlDtd *, xmlAttribute *); /*proto*/
static int __pyx_f_4lxml_5etree__isDtdNsDecl(xmlAttribute *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElement) *deepcopyNodeToDocument(struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElementTree) *elementTreeFactory(struct LxmlElement *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElementTree) *newElementTree(struct LxmlElement *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElement) *elementFactory(struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElement) *makeElement(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElement) *makeSubElement(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(void) setElementClassLookupFunction(_element_class_lookup_function, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *lookupDefaultElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *lookupNamespaceElementClass(PyObject *, PyObject *, xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *callLookupFallback(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) tagMatches(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlDocument) *documentOrRaise(PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(struct LxmlElement) *rootNodeOrRaise(PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) hasText(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) hasTail(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *textOf(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *tailOf(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) setNodeText(xmlNode *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) setTailText(xmlNode *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *attributeValue(xmlNode *, xmlAttr *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *attributeValueFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *getAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *iterattributes(struct LxmlElement *, int); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *collectAttributes(xmlNode *, int); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) setAttributeValue(struct LxmlElement *, PyObject *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) delAttribute(struct LxmlElement *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) delAttributeFromNsName(xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) hasChild(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(xmlNode) *findChild(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C DL_EXPORT(xmlNode) *findChildForwards(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C DL_EXPORT(xmlNode) *findChildBackwards(xmlNode *, Py_ssize_t); /*proto*/
__PYX_EXTERN_C DL_EXPORT(xmlNode) *nextElement(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(xmlNode) *previousElement(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(void) appendChild(struct LxmlElement *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(int) appendChildToElement(struct LxmlElement *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *pyunicode(const xmlChar *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *utf8(PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *getNsTag(PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *getNsTagWithEmptyNs(PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *namespacedName(xmlNode *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(PyObject) *namespacedNameFromNsName(const xmlChar *, const xmlChar *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(void) iteratorStoreNext(struct LxmlElementIterator *, struct LxmlElement *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(void) initTagMatch(struct LxmlElementTagMatcher *, PyObject *); /*proto*/
__PYX_EXTERN_C DL_EXPORT(xmlNs) *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *); /*proto*/
#define __Pyx_MODULE_NAME "lxml.etree"
int __pyx_module_is_main_lxml__etree = 0;

/* Implementation of 'lxml.etree' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_SyntaxError;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_UnicodeEncodeError;
static PyObject *__pyx_builtin_UnicodeDecodeError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_FutureWarning;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_ReferenceError;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_LookupError;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_BaseException;
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_pf_4lxml_5etree_14MutableMapping_keys(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping___getitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_2__setitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_4__delitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_6__contains__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_register_namespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9LxmlError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_error_log); /* proto */
static int __pyx_pf_4lxml_5etree_10_TempStore___init__(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_2clear_error_log(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static void __pyx_pf_4lxml_5etree_9_LogEntry___dealloc__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_2__repr__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_2copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_4__repr__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_2copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_4__iter__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_6__repr__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_8__getitem__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog_10__len__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_ListErrorLog_12__contains__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_error_type); /* proto */
static int __pyx_pf_4lxml_5etree_13_ListErrorLog_14__nonzero__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_domains); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_types); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_levels); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_24filter_from_fatals(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_26filter_from_errors(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_28filter_from_warnings(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9_ErrorLog___cinit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9_ErrorLog_2__init__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_4__exit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_6clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_8copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_10__iter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_12receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static int __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, PyObject *__pyx_v_domains); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static int __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, PyObject *__pyx_v_max_len); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry); /* proto */
static int __pyx_pf_4lxml_5etree_10PyErrorLog___init__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_logger_name, PyObject *__pyx_v_logger); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_2copy(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_4log(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_log_entry, PyObject *__pyx_v_message, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_6receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4use_global_python_log(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_log); /* proto */
static void __pyx_pf_4lxml_5etree_9_Document___dealloc__(struct LxmlDocument *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo___cinit__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7DocInfo_3URL_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(CYTHON_UNUSED struct LxmlElement *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_8_Element_2__dealloc__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4__setitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_6__delitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(struct LxmlElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_10__copy__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_12set(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_14append(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_16addnext(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_18addprevious(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_20extend(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_elements); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_22clear(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_24insert(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_index, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_26remove(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_28replace(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_old_element, struct LxmlElement *__pyx_v_new_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_3tag___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_3tag_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6attrib___get__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4text___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4text_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4tail___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4tail_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_6prefix___get__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_10sourceline_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_4base___get__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_4base_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_30__repr__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_32__getitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element_34__len__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_36__nonzero__(struct LxmlElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8_Element_38__contains__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_40__iter__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_42__reversed__(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_44index(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_child, PyObject *__pyx_v_start, PyObject *__pyx_v_stop); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_46get(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_48keys(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_50values(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_52items(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_54getchildren(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_56getparent(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_58getnext(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_60getprevious(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_62itersiblings(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_preceding, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_64iterancestors(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_66iterdescendants(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_68iterchildren(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_70getroottree(struct LxmlElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_72getiterator(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_74iter(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_76itertext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_78makeelement(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_80find(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_82findtext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_84findall(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_86iterfind(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Element_88xpath(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4insert(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6__setitem__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_2__set__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8__getitem__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement_10__len__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_12get(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_14keys(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_16items(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_18values(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Comment_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8_Comment___repr__(struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_2__set__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_2get(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6attrib___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4name___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7_Entity_4name_2__set__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4text___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Entity___repr__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_5QName___init__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, PyObject *__pyx_v_text_or_uri_or_element, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_2__str__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static Py_hash_t __pyx_pf_4lxml_5etree_5QName_4__hash__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_6__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_4text___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_9localname___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5QName_9namespace___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_parse(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_root); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_4getroot(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6__copy__(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(struct LxmlElementTree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_10write(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, PyObject *__pyx_v_pretty_print, PyObject *__pyx_v_xml_declaration, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_docstring, PyObject *__pyx_v_compression, PyObject *__pyx_v_exclusive, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_inclusive_ns_prefixes); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_12getpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14getiterator(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16iter(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18find(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_20findtext(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_22findall(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_24iterfind(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_26xpath(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_28xslt(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__xslt, PyObject *__pyx_v_extensions, PyObject *__pyx_v_access_control, PyObject *__pyx_v__kw); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_30relaxng(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_relaxng); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_32xmlschema(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_xmlschema); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_34xinclude(struct LxmlElementTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_36write_c14n(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_exclusive, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_compression, PyObject *__pyx_v_inclusive_ns_prefixes); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib___cinit__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, struct LxmlElement *__pyx_v_element); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_2__setitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_4__delitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_6update(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_8pop(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_10clear(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_12__repr__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_14__copy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_18__getitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_20__bool__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib_22__len__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_24get(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_26keys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_28__iter__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_30iterkeys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_32values(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_34itervalues(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_36items(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_38iteritems(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_40has_key(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_4lxml_5etree_7_Attrib_42__contains__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___iter__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator_2__next__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___iter__(struct LxmlElementIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator_2__next__(struct LxmlElementIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_16_MultiTagMatcher___cinit__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags); /* proto */
static void __pyx_pf_4lxml_5etree_16_MultiTagMatcher_2__dealloc__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator___iter__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator_2__next__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementChildIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_reversed); /* proto */
static int __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(struct __pyx_obj_4lxml_5etree_SiblingsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_preceding); /* proto */
static int __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(struct __pyx_obj_4lxml_5etree_AncestorsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag); /* proto */
static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_inclusive); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_tag, int __pyx_v_with_tail); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_6Element(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Comment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ProcessingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text); /* proto */
static int __pyx_pf_4lxml_5etree_5CDATA___cinit__(struct __pyx_obj_4lxml_5etree_CDATA *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12Entity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14SubElement(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v__parent, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16ElementTree(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_file, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18HTML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20XML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_24fromstringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26iselement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_28dump(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_elem, int __pyx_v_pretty_print, PyObject *__pyx_v_with_tail); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_30tostring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, PyObject *__pyx_v_xml_declaration, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, int __pyx_v_exclusive, int __pyx_v_with_comments, PyObject *__pyx_v_inclusive_ns_prefixes); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_32tostringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_34tounicode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_method, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_36parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__repr__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__getitem__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__len__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__nonzero__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12__copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_14__iter__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_16iterchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_18getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_20getparent(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_22getnext(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_24getprevious(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2keys(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4values(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6items(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_elements); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_elements); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4lxml_5etree_11ElementBase___init__(struct LxmlElementBase *__pyx_v_self, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_children, PyObject *__pyx_v__extra); /* proto */
static int __pyx_pf_4lxml_5etree_11CommentBase___init__(struct __pyx_obj_4lxml_5etree_CommentBase *__pyx_v_self, PyObject *__pyx_v_text); /* proto */
static int __pyx_pf_4lxml_5etree_6PIBase___init__(struct __pyx_obj_4lxml_5etree_PIBase *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text); /* proto */
static int __pyx_pf_4lxml_5etree_10EntityBase___init__(struct __pyx_obj_4lxml_5etree_EntityBase *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4lxml_5etree_18ElementClassLookup___cinit__(struct LxmlElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(struct LxmlFallbackElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2__init__(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(struct LxmlFallbackElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_comment, PyObject *__pyx_v_pi, PyObject *__pyx_v_entity); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self, PyObject *__pyx_v_attribute_name, PyObject *__pyx_v_class_mapping, struct LxmlElementClassLookup *__pyx_v_fallback); /* proto */
static int __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_namespace, CYTHON_UNUSED PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_38set_element_class_lookup(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_ns_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__getitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry_6__delitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_8__iter__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_10items(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_12iteritems(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_14clear(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, PyObject *__pyx_v_ns_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_40FunctionNamespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ns_uri); /* proto */
static int __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__get__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_4__set__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
static int __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_system_url, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_4resolve_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_string, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_6resolve_filename(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8Resolver_8resolve_file(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url, int __pyx_v_close); /* proto */
static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_resolver); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_resolver); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_6copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_8resolve(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_system_url, PyObject *__pyx_v_public_id, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_10__repr__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10ParseError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_code, PyObject *__pyx_v_line, PyObject *__pyx_v_column); /* proto */
static int __pyx_pf_4lxml_5etree_24_ParserDictionaryContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_url, PyObject *__pyx_v_encoding, int __pyx_v_close_file); /* proto */
static int __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_14_ParserContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_11_BaseParser___init__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, int __pyx_v_parse_options, int __pyx_v_for_html, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_encoding); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2setElementClassLookup(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_4set_element_class_lookup(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_8makeelement(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_2close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9XMLParser___init__(struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_compact); /* proto */
static int __pyx_pf_4lxml_5etree_13XMLPullParser___init__(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, PyObject *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_compact); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_42set_default_parser(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_44get_default_parser(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_4lxml_5etree_10HTMLParser___init__(struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_no_network, PyObject *__pyx_v_target, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_recover, PyObject *__pyx_v_compact); /* proto */
static int __pyx_pf_4lxml_5etree_14HTMLPullParser___init__(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14HTMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_16_SaxParserTarget___cinit__(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_17_SaxParserContext___cinit__(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser); /* proto */
static int __pyx_pf_4lxml_5etree_20_ParseEventsIterator___cinit__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_2__iter__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_4__next__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_11TreeBuilder___init__(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_element_factory, PyObject *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_2close(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_4data(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_6start(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_nsmap); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_8end(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_10pi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_12comment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19_TargetParserResult___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_result); /* proto */
static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target); /* proto */
static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_compression); /* proto */
static int __pyx_pf_4lxml_5etree_7xmlfile___init__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_2__enter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_4__exit__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static int __pyx_pf_4lxml_5etree_22_IncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel); /* proto */
static void __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_2__dealloc__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_4write_declaration(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10write(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_with_tail, int __pyx_v_pretty_print, PyObject *__pyx_v_args); /* proto */
static int __pyx_pf_4lxml_5etree_18_FileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, PyObject *__pyx_v_element_config); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_2__enter__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static int __pyx_pf_4lxml_5etree_9iterparse___init__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_compact, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_encoding, PyObject *__pyx_v_html, PyObject *__pyx_v_recover, PyObject *__pyx_v_huge_tree, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9resolvers___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_7version___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_2set_element_class_lookup(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4makeelement(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v__tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_6__iter__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_8__next__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4root___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8iterwalk___init__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_events, PyObject *__pyx_v_tag); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_2__iter__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_4__next__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_46XMLID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_48XMLDTDID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_50parseid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url); /* proto */
static int __pyx_pf_4lxml_5etree_7_IDDict___cinit__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_2copy(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_4__getitem__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_6get(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static int __pyx_pf_4lxml_5etree_7_IDDict_8__contains__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_10has_key(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_12__repr__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_14keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_16__iter__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_18iterkeys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict_20__len__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_22items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_24iteritems(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_26values(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_28itervalues(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_8XInclude___init__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_8XInclude_2__call__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self, struct LxmlElement *__pyx_v_node); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_52cleanup_namespaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_54strip_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_attribute_names); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_56strip_elements(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, int __pyx_v_with_tail, PyObject *__pyx_v_tag_names); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_58strip_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_tag_names); /* proto */
static int __pyx_pf_4lxml_5etree_12_BaseContext___cinit__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_12_BaseContext_2__init__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_60Extension(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_function_mapping, PyObject *__pyx_v_ns); /* proto */
static int __pyx_pf_4lxml_5etree_12_ExsltRegExp___cinit__(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_2test(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_4match(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_6replace(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags, PyObject *__pyx_v_replacement); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_20_ElementStringResult_getparent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_13_XPathContext___init__(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_variables, PyObject *__pyx_v_build_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__init__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_4__dealloc__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_6evaluate(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, PyObject *__pyx_v__eval_arg, PyObject *__pyx_v__variables); /* proto */
static int __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespace(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_namespaces); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_6__call__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables); /* proto */
static int __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, struct LxmlElementTree *__pyx_v_etree, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_2__call__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_62XPathEvaluator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_etree_or_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_5XPath___cinit__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_5XPath_2__init__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5XPath_4__call__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v__etree_or_element, PyObject *__pyx_v__variables); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5XPath_4path___get__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_5XPath_6__dealloc__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_5XPath_8__repr__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7ETXPath___init__(struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_17XSLTAccessControl___cinit__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__init__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, int __pyx_v_read_file, int __pyx_v_write_file, int __pyx_v_create_dir, int __pyx_v_read_network, int __pyx_v_write_network); /* proto */
static void __pyx_pf_4lxml_5etree_17XSLTAccessControl_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_6__repr__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_12_XSLTContext_2__init__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings); /* proto */
static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_v_self, PyObject *__pyx_v_strval); /* proto */
static int __pyx_pf_4lxml_5etree_4XSLT___cinit__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_4XSLT_2__init__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v_xslt_input, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_access_control); /* proto */
static void __pyx_pf_4lxml_5etree_4XSLT_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_6strparam(PyObject *__pyx_v_strval); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_8set_global_max_depth(int __pyx_v_max_depth); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_10apply(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v__input, PyObject *__pyx_v_profile_run, PyObject *__pyx_v_kw); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_12tostring(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, struct LxmlElementTree *__pyx_v_result_tree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_14__deepcopy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_16__copy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_4XSLT_18__call__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v__input, PyObject *__pyx_v_profile_run, PyObject *__pyx_v_kw); /* proto */
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree___cinit__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_4__unicode__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__getbuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /* proto */
static void __pyx_pf_4lxml_5etree_15_XSLTResultTree_8__releasebuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_2__del__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_parser); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2set(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_execute(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_self_node, CYTHON_UNUSED PyObject *__pyx_v_input_node, CYTHON_UNUSED PyObject *__pyx_v_output_parent); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_2apply_templates(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_node, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_4process_children(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text); /* proto */
static int __pyx_pf_4lxml_5etree_10_Validator___cinit__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_2validate(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4assertValid(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_6assert_(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_8_append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_10_clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5occur___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4left___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5right___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_8elemname___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_7default___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_13default_value___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_2itervalues(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_5values(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_2iterattributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_5attributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4orig___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_3DTD___init__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_external_id); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_4name___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_11external_id___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_10system_url___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_2iterelements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_5elements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_7iterentities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_10entities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_3DTD_12__dealloc__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_3DTD_14__call__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static int __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_7RelaxNG_2__init__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file); /* proto */
static void __pyx_pf_4lxml_5etree_7RelaxNG_4__dealloc__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_6__call__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static int __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_9XMLSchema_2__init__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file, PyObject *__pyx_v_attribute_defaults); /* proto */
static void __pyx_pf_4lxml_5etree_9XMLSchema_4__dealloc__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema_6__call__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static int __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto */
static void __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_10Schematron___cinit__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self); /* proto */
static int __pyx_pf_4lxml_5etree_10Schematron_2__init__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file); /* proto */
static void __pyx_pf_4lxml_5etree_10Schematron_4__dealloc__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_10Schematron_6__call__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_bytes_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_2blocks_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_4dict_size(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_6dump(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_byte_count); /* proto */
static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_8show(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_block_count); /* proto */
static PyObject *__pyx_tp_new_4lxml_5etree__TempStore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ExceptionContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Document(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Element(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__BaseParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_QName(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__LogEntry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__BaseErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ListErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLogContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DomainErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__RotatingErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_PyErrorLog(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_DocInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___ContentOnlyElement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Comment(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Entity(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementTree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Attrib(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AttribIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__MultiTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementMatchIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementChildIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_SiblingsIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_AncestorsIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementTextIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_CDATA(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_CommentBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_PIBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_EntityBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_CustomElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_PythonElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__NamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__InputDocument(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_Resolver(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ResolverRegistry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ResolverContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParserContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__TargetParserContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__Validator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XMLSchema(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FileReaderContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FeedParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XMLParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ETCompatXMLParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_HTMLParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_HTMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ParseEventsIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_TreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FilelikeWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_xmlfile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__IncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__FileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_iterparse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_iterwalk(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__IDDict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XInclude(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ExsltRegExp(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__BaseContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XPathContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XPathElementEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XPath(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_ETXPath(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResolverContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XSLTAccessControl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XSLT(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResultTree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_XSLTExtension(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDAttributeDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__DTDEntityDecl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_DTD(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_RelaxNG(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree_Schematron(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree__MemDebug(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct__itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1_iterattributes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2_iterelements(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3_iterentities(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_A[] = "A";
static char __pyx_k_B[] = "B";
static char __pyx_k_U[] = "U";
static char __pyx_k_f[] = "f";
static char __pyx_k_g[] = "g";
static char __pyx_k_i[] = "i";
static char __pyx_k_k[] = "k";
static char __pyx_k_s[] = "<!--%s-->";
static char __pyx_k_v[] = "v";
static char __pyx_k_w[] = "w";
static char __pyx_k_Ok[] = "Ok";
static char __pyx_k_PI[] = "PI";
static char __pyx_k__3[] = "-";
static char __pyx_k__4[] = ".";
static char __pyx_k_dc[] = "dc";
static char __pyx_k_id[] = "id";
static char __pyx_k_io[] = "io";
static char __pyx_k_ns[] = "ns";
static char __pyx_k_or[] = "or";
static char __pyx_k_pi[] = "pi";
static char __pyx_k_py[] = "py";
static char __pyx_k_rb[] = "rb";
static char __pyx_k_re[] = "re";
static char __pyx_k_wb[] = "wb";
static char __pyx_k_xs[] = "xs";
static char __pyx_k_0_9[] = "[0-9]+";
static char __pyx_k_1_0[] = "1.0";
static char __pyx_k_DTD[] = "DTD";
static char __pyx_k_TAG[] = "TAG";
static char __pyx_k_XML[] = "XML";
static char __pyx_k__14[] = " ";
static char __pyx_k__15[] = "";
static char __pyx_k__21[] = "\n";
static char __pyx_k__24[] = "&";
static char __pyx_k__25[] = ";";
static char __pyx_k__30[] = "/";
static char __pyx_k__34[] = "*";
static char __pyx_k__35[] = "{*}*";
static char __pyx_k__46[] = "_";
static char __pyx_k__51[] = "'?>\n";
static char __pyx_k__52[] = "\" \"";
static char __pyx_k__53[] = "\"";
static char __pyx_k__54[] = ">\n";
static char __pyx_k__55[] = " [\n";
static char __pyx_k__56[] = "]>\n";
static char __pyx_k__60[] = ":";
static char __pyx_k__62[] = "<";
static char __pyx_k__63[] = ">";
static char __pyx_k__64[] = "=\"";
static char __pyx_k__70[] = "</";
static char __pyx_k__92[] = ", ";
static char __pyx_k_add[] = "add";
static char __pyx_k_all[] = "__all__";
static char __pyx_k_any[] = "any";
static char __pyx_k_dev[] = "dev";
static char __pyx_k_dic[] = "dic";
static char __pyx_k_doc[] = "_doc";
static char __pyx_k_end[] = "end";
static char __pyx_k_get[] = "get";
static char __pyx_k_key[] = "key";
static char __pyx_k_len[] = "__len__";
static char __pyx_k_log[] = "log";
static char __pyx_k_opt[] = "opt";
static char __pyx_k_pop[] = "pop";
static char __pyx_k_rdf[] = "rdf";
static char __pyx_k_s_2[] = "<?%s?>";
static char __pyx_k_s_3[] = "&%s;";
static char __pyx_k_s_4[] = "s";
static char __pyx_k_s_r[] = "%s=%r";
static char __pyx_k_s_s[] = "%s:%s";
static char __pyx_k_seq[] = "seq";
static char __pyx_k_str[] = "str";
static char __pyx_k_sub[] = "sub";
static char __pyx_k_sys[] = "sys";
static char __pyx_k_tag[] = "tag";
static char __pyx_k_uri[] = "uri";
static char __pyx_k_url[] = "url";
static char __pyx_k_xml[] = "xml";
static char __pyx_k_xsi[] = "xsi";
static char __pyx_k_xsl[] = "xsl";
static char __pyx_k_HTML[] = "HTML";
static char __pyx_k_UTF8[] = "UTF8";
static char __pyx_k_XSLT[] = "XSLT";
static char __pyx_k__201[] = "(\"[^\"]*\")|('[^']*')";
static char __pyx_k__203[] = "({[^}]+})";
static char __pyx_k_args[] = "args";
static char __pyx_k_beta[] = "beta";
static char __pyx_k_c14n[] = "c14n";
static char __pyx_k_code[] = "code";
static char __pyx_k_copy[] = "copy";
static char __pyx_k_ctxt[] = "ctxt";
static char __pyx_k_data[] = "data";
static char __pyx_k_dict[] = "__dict__";
static char __pyx_k_dump[] = "dump";
static char __pyx_k_elem[] = "elem";
static char __pyx_k_exit[] = "__exit__";
static char __pyx_k_feed[] = "feed";
static char __pyx_k_file[] = "file";
static char __pyx_k_find[] = "find";
static char __pyx_k_gzip[] = "gzip";
static char __pyx_k_href[] = "href";
static char __pyx_k_html[] = "html";
static char __pyx_k_init[] = "__init__";
static char __pyx_k_iter[] = "iter";
static char __pyx_k_join[] = "join";
static char __pyx_k_keys[] = "keys";
static char __pyx_k_line[] = "line";
static char __pyx_k_lxml[] = "lxml";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_mode[] = "mode";
static char __pyx_k_mult[] = "mult";
static char __pyx_k_name[] = "__name__";
static char __pyx_k_next[] = "__next__";
static char __pyx_k_node[] = "node";
static char __pyx_k_none[] = "none";
static char __pyx_k_ns_d[] = "ns%d";
static char __pyx_k_once[] = "once";
static char __pyx_k_open[] = "open";
static char __pyx_k_path[] = "path";
static char __pyx_k_plus[] = "plus";
static char __pyx_k_read[] = "read";
static char __pyx_k_rexp[] = "rexp";
static char __pyx_k_root[] = "root";
static char __pyx_k_self[] = "self";
static char __pyx_k_send[] = "send";
static char __pyx_k_stop[] = "stop";
static char __pyx_k_tags[] = "tags";
static char __pyx_k_tail[] = "tail";
static char __pyx_k_tell[] = "tell";
static char __pyx_k_test[] = "test";
static char __pyx_k_text[] = "text";
static char __pyx_k_tree[] = "tree";
static char __pyx_k_type[] = "type";
static char __pyx_k_utf8[] = "utf8";
static char __pyx_k_warn[] = "warn";
static char __pyx_k_wsdl[] = "wsdl";
static char __pyx_k_xslt[] = "<xslt>";
static char __pyx_k_ASCII[] = "ASCII";
static char __pyx_k_CDATA[] = "CDATA";
static char __pyx_k_DEBUG[] = "DEBUG";
static char __pyx_k_ERROR[] = "ERROR";
static char __pyx_k_Error[] = "Error";
static char __pyx_k_FATAL[] = "FATAL";
static char __pyx_k_QName[] = "QName";
static char __pyx_k_UTF_8[] = "UTF-8";
static char __pyx_k_XMLID[] = "XMLID";
static char __pyx_k_XPath[] = "XPath";
static char __pyx_k_alpha[] = "alpha";
static char __pyx_k_ascii[] = "ascii";
static char __pyx_k_attrs[] = "attrs";
static char __pyx_k_c_doc[] = "c_doc";
static char __pyx_k_cdata[] = "cdata";
static char __pyx_k_child[] = "child";
static char __pyx_k_class[] = "__class__";
static char __pyx_k_clear[] = "clear";
static char __pyx_k_close[] = "close";
static char __pyx_k_doc_2[] = "doc";
static char __pyx_k_doc_3[] = "__doc__";
static char __pyx_k_dummy[] = "dummy";
static char __pyx_k_empty[] = "empty";
static char __pyx_k_etree[] = "etree";
static char __pyx_k_extra[] = "_extra";
static char __pyx_k_fixed[] = "fixed";
static char __pyx_k_flags[] = "flags";
static char __pyx_k_group[] = "group";
static char __pyx_k_idref[] = "idref";
static char __pyx_k_index[] = "index";
static char __pyx_k_input[] = "_input";
static char __pyx_k_items[] = "items";
static char __pyx_k_level[] = "level";
static char __pyx_k_lower[] = "lower";
static char __pyx_k_match[] = "match";
static char __pyx_k_mixed[] = "mixed";
static char __pyx_k_names[] = "_names";
static char __pyx_k_nsmap[] = "nsmap";
static char __pyx_k_occur[] = "occur";
static char __pyx_k_parse[] = "parse";
static char __pyx_k_print[] = "print";
static char __pyx_k_range[] = "range";
static char __pyx_k_s_s_2[] = "{%s}%s";
static char __pyx_k_s_s_3[] = "<?%s %s?>";
static char __pyx_k_s_s_4[] = "%s(%s)";
static char __pyx_k_split[] = "split";
static char __pyx_k_start[] = "start";
static char __pyx_k_strip[] = "strip";
static char __pyx_k_super[] = "super";
static char __pyx_k_tag_2[] = "_tag";
static char __pyx_k_throw[] = "throw";
static char __pyx_k_upper[] = "upper";
static char __pyx_k_utf_8[] = "utf-8";
static char __pyx_k_value[] = "value";
static char __pyx_k_write[] = "write";
static char __pyx_k_xmlns[] = "xmlns";
static char __pyx_k_Entity[] = "Entity";
static char __pyx_k_PARSER[] = "PARSER";
static char __pyx_k_PIBase[] = "PIBase";
static char __pyx_k_PUBLIC[] = " PUBLIC \"";
static char __pyx_k_SYSTEM[] = " SYSTEM \"";
static char __pyx_k_attrib[] = "attrib";
static char __pyx_k_c_name[] = "c_name";
static char __pyx_k_c_next[] = "c_next";
static char __pyx_k_c_node[] = "c_node";
static char __pyx_k_column[] = "column";
static char __pyx_k_copy_2[] = "__copy__";
static char __pyx_k_decode[] = "decode";
static char __pyx_k_domain[] = "domain";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_end_ns[] = "end-ns";
static char __pyx_k_entity[] = "entity";
static char __pyx_k_events[] = "events";
static char __pyx_k_exc_tb[] = "exc_tb";
static char __pyx_k_extend[] = "extend";
static char __pyx_k_file_s[] = "file %s";
static char __pyx_k_geturl[] = "geturl";
static char __pyx_k_groups[] = "groups";
static char __pyx_k_href_s[] = " href=\"%s\"";
static char __pyx_k_idrefs[] = "idrefs";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_init_2[] = "_init";
static char __pyx_k_islice[] = "islice";
static char __pyx_k_iter_2[] = "__iter__";
static char __pyx_k_kwargs[] = "kwargs";
static char __pyx_k_line_d[] = "line %d";
static char __pyx_k_logger[] = "logger";
static char __pyx_k_lookup[] = "lookup";
static char __pyx_k_method[] = "method";
static char __pyx_k_module[] = "module";
static char __pyx_k_name_2[] = "name";
static char __pyx_k_ns_d_2[] = "ns\\d+$";
static char __pyx_k_ns_uri[] = "ns_uri";
static char __pyx_k_ns_utf[] = "ns_utf";
static char __pyx_k_object[] = "object";
static char __pyx_k_parent[] = "_parent";
static char __pyx_k_parser[] = "parser";
static char __pyx_k_path_2[] = "_path";
static char __pyx_k_pcdata[] = "pcdata";
static char __pyx_k_prefix[] = "prefix";
static char __pyx_k_regexp[] = "regexp";
static char __pyx_k_remove[] = "remove";
static char __pyx_k_result[] = "result";
static char __pyx_k_schema[] = "schema";
static char __pyx_k_search[] = "search";
static char __pyx_k_sorted[] = "sorted";
static char __pyx_k_source[] = "source";
static char __pyx_k_stdout[] = "stdout";
static char __pyx_k_strict[] = "strict";
static char __pyx_k_string[] = "<string>";
static char __pyx_k_strval[] = "strval";
static char __pyx_k_target[] = "target";
static char __pyx_k_test_2[] = "__test__";
static char __pyx_k_values[] = "values";
static char __pyx_k_writer[] = "writer";
static char __pyx_k_xrange[] = "xrange";
static char __pyx_k_xslt_2[] = "_xslt";
static char __pyx_k_BytesIO[] = "BytesIO";
static char __pyx_k_Comment[] = "Comment";
static char __pyx_k_DOCTYPE[] = "<!DOCTYPE ";
static char __pyx_k_ETXPath[] = "ETXPath";
static char __pyx_k_Element[] = "Element";
static char __pyx_k_IOError[] = "IOError";
static char __pyx_k_RelaxNG[] = "RelaxNG";
static char __pyx_k_UCS_4BE[] = "UCS-4BE";
static char __pyx_k_UCS_4LE[] = "UCS-4LE";
static char __pyx_k_UNICODE[] = "UNICODE";
static char __pyx_k_WARNING[] = "WARNING";
static char __pyx_k_abspath[] = "abspath";
static char __pyx_k_builtin[] = "__builtin__";
static char __pyx_k_comment[] = "comment";
static char __pyx_k_compact[] = "compact";
static char __pyx_k_compile[] = "compile";
static char __pyx_k_context[] = "context";
static char __pyx_k_default[] = "default";
static char __pyx_k_delitem[] = "__delitem__";
static char __pyx_k_discard[] = "discard";
static char __pyx_k_doctype[] = "doctype";
static char __pyx_k_domains[] = "domains";
static char __pyx_k_element[] = "element";
static char __pyx_k_entries[] = "entries";
static char __pyx_k_exc_val[] = "exc_val";
static char __pyx_k_execute[] = "execute";
static char __pyx_k_fileobj[] = "fileobj";
static char __pyx_k_findall[] = "findall";
static char __pyx_k_g_1_g_2[] = "\\g<1>\\g<2>";
static char __pyx_k_getName[] = "_getName";
static char __pyx_k_getitem[] = "__getitem__";
static char __pyx_k_getnext[] = "getnext";
static char __pyx_k_getroot[] = "getroot";
static char __pyx_k_implied[] = "implied";
static char __pyx_k_inspect[] = "inspect";
static char __pyx_k_is_tail[] = "is_tail";
static char __pyx_k_is_text[] = "is_text";
static char __pyx_k_logging[] = "logging";
static char __pyx_k_matcher[] = "matcher";
static char __pyx_k_matches[] = "matches";
static char __pyx_k_max_len[] = "max_len";
static char __pyx_k_message[] = "message";
static char __pyx_k_nmtoken[] = "nmtoken";
static char __pyx_k_ns_tags[] = "ns_tags";
static char __pyx_k_options[] = "options";
static char __pyx_k_os_path[] = "os.path";
static char __pyx_k_outfile[] = "outfile";
static char __pyx_k_parseid[] = "parseid";
static char __pyx_k_prepare[] = "__prepare__";
static char __pyx_k_receive[] = "receive";
static char __pyx_k_recover[] = "recover";
static char __pyx_k_replace[] = "replace";
static char __pyx_k_resolve[] = "resolve";
static char __pyx_k_s_w_s_s[] = "\\s+(\\w+)\\s*=\\s*(?:\\'([^\\']*)\\'|\"([^\"]*)\")";
static char __pyx_k_setitem[] = "__setitem__";
static char __pyx_k_strings[] = "strings";
static char __pyx_k_unicode[] = "unicode";
static char __pyx_k_unknown[] = "unknown";
static char __pyx_k_uri_utf[] = "uri_utf";
static char __pyx_k_version[] = "version";
static char __pyx_k_xpp_02d[] = "__xpp%02d";
static char __pyx_k_CRITICAL[] = "CRITICAL";
static char __pyx_k_DENY_ALL[] = "DENY_ALL";
static char __pyx_k_DTDError[] = "DTDError";
static char __pyx_k_GzipFile[] = "GzipFile";
static char __pyx_k_KeyError[] = "KeyError";
static char __pyx_k_RELAXNGV[] = "RELAXNGV";
static char __pyx_k_Resolver[] = "Resolver";
static char __pyx_k_StringIO[] = "StringIO";
static char __pyx_k_US_ASCII[] = "US-ASCII";
static char __pyx_k_UTF_16BE[] = "UTF-16BE";
static char __pyx_k_UTF_16LE[] = "UTF-16LE";
static char __pyx_k_UserDict[] = "UserDict";
static char __pyx_k_XInclude[] = "XInclude";
static char __pyx_k_XMLDTDID[] = "XMLDTDID";
static char __pyx_k_attrname[] = "attrname";
static char __pyx_k_base_url[] = "base_url";
static char __pyx_k_builtins[] = "builtins";
static char __pyx_k_contains[] = "__contains__";
static char __pyx_k_elemname[] = "elemname";
static char __pyx_k_encoding[] = "encoding";
static char __pyx_k_entities[] = "entities";
static char __pyx_k_eval_arg[] = "_eval_arg";
static char __pyx_k_exc_info[] = "exc_info";
static char __pyx_k_exc_type[] = "exc_type";
static char __pyx_k_fallback[] = "fallback";
static char __pyx_k_filelike[] = "filelike";
static char __pyx_k_filename[] = "filename";
static char __pyx_k_findtext[] = "findtext";
static char __pyx_k_for_html[] = "for_html";
static char __pyx_k_getvalue[] = "getvalue";
static char __pyx_k_iterfind[] = "iterfind";
static char __pyx_k_iterkeys[] = "iterkeys";
static char __pyx_k_iterwalk[] = "iterwalk";
static char __pyx_k_line_d_s[] = "line %d: %s";
static char __pyx_k_load_dtd[] = "load_dtd";
static char __pyx_k_module_2[] = "__module__";
static char __pyx_k_name_utf[] = "name_utf";
static char __pyx_k_nmtokens[] = "nmtokens";
static char __pyx_k_notation[] = "notation";
static char __pyx_k_ns_clean[] = "ns_clean";
static char __pyx_k_position[] = "position";
static char __pyx_k_qualname[] = "__qualname__";
static char __pyx_k_registry[] = "registry";
static char __pyx_k_required[] = "required";
static char __pyx_k_reversed[] = "reversed";
static char __pyx_k_s_line_d[] = "%s, line %d";
static char __pyx_k_start_ns[] = "start-ns";
static char __pyx_k_string_2[] = "string";
static char __pyx_k_strparam[] = "strparam";
static char __pyx_k_text_xml[] = "text/xml";
static char __pyx_k_text_xsl[] = "text/xsl";
static char __pyx_k_tostring[] = "tostring";
static char __pyx_k_validate[] = "validate";
static char __pyx_k_warnings[] = "warnings";
static char __pyx_k_C14NError[] = "C14NError";
static char __pyx_k_DOCTYPE_s[] = "<!DOCTYPE %s>";
static char __pyx_k_Exception[] = "Exception";
static char __pyx_k_Extension[] = "Extension";
static char __pyx_k_LxmlError[] = "LxmlError";
static char __pyx_k_NAMESPACE[] = "NAMESPACE";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_XMLParser[] = "XMLParser";
static char __pyx_k_XMLSchema[] = "XMLSchema";
static char __pyx_k_XSLTError[] = "XSLTError";
static char __pyx_k_c_ns_tags[] = "c_ns_tags";
static char __pyx_k_docformat[] = "__docformat__";
static char __pyx_k_docstring[] = "docstring";
static char __pyx_k_element_s[] = "element %s";
static char __pyx_k_enumerate[] = "enumerate";
static char __pyx_k_error_log[] = "error_log";
static char __pyx_k_exclusive[] = "exclusive";
static char __pyx_k_functions[] = "functions";
static char __pyx_k_getLogger[] = "getLogger";
static char __pyx_k_getparent[] = "getparent";
static char __pyx_k_huge_tree[] = "huge_tree";
static char __pyx_k_inclusive[] = "inclusive";
static char __pyx_k_iselement[] = "iselement";
static char __pyx_k_iteritems[] = "iteritems";
static char __pyx_k_iterparse[] = "iterparse";
static char __pyx_k_itertools[] = "itertools";
static char __pyx_k_log_entry[] = "log_entry";
static char __pyx_k_max_depth[] = "max_depth";
static char __pyx_k_metaclass[] = "__metaclass__";
static char __pyx_k_namespace[] = "namespace";
static char __pyx_k_preceding[] = "preceding";
static char __pyx_k_public_id[] = "public_id";
static char __pyx_k_read_file[] = "read_file";
static char __pyx_k_resolvers[] = "resolvers";
static char __pyx_k_self_node[] = "self_node";
static char __pyx_k_string_id[] = "//*[string(@id)]";
static char __pyx_k_strip_pis[] = "strip_pis";
static char __pyx_k_tag_names[] = "tag_names";
static char __pyx_k_text_root[] = "text-root";
static char __pyx_k_tounicode[] = "tounicode";
static char __pyx_k_type_name[] = "type_name";
static char __pyx_k_undefined[] = "undefined";
static char __pyx_k_unicode_2[] = "__unicode__";
static char __pyx_k_variables[] = "variables";
static char __pyx_k_version_2[] = "__version__";
static char __pyx_k_with_tail[] = "with_tail";
static char __pyx_k_DENY_WRITE[] = "DENY_WRITE";
static char __pyx_k_EntityBase[] = "EntityBase";
static char __pyx_k_ErrorTypes[] = "ErrorTypes";
static char __pyx_k_HTMLParser[] = "HTMLParser";
static char __pyx_k_IGNORECASE[] = "IGNORECASE";
static char __pyx_k_ISO_8859_1[] = "ISO-8859-1";
static char __pyx_k_IndexError[] = "IndexError";
static char __pyx_k_ParseError[] = "ParseError";
static char __pyx_k_PyErrorLog[] = "PyErrorLog";
static char __pyx_k_Schematron[] = "Schematron";
static char __pyx_k_SubElement[] = "SubElement";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_XPathError[] = "XPathError";
static char __pyx_k_byte_count[] = "byte_count";
static char __pyx_k_close_file[] = "close_file";
static char __pyx_k_create_dir[] = "create_dir";
static char __pyx_k_encoding_2[] = "' encoding='";
static char __pyx_k_extensions[] = "extensions";
static char __pyx_k_fromstring[] = "fromstring";
static char __pyx_k_getargspec[] = "getargspec";
static char __pyx_k_has_raised[] = "has_raised";
static char __pyx_k_input_node[] = "input_node";
static char __pyx_k_itervalues[] = "itervalues";
static char __pyx_k_last_error[] = "last_error";
static char __pyx_k_level_name[] = "level_name";
static char __pyx_k_lxml_etree[] = "lxml.etree";
static char __pyx_k_memorydump[] = ".memorydump";
static char __pyx_k_memorylist[] = ".memorylist";
static char __pyx_k_namespaces[] = "namespaces";
static char __pyx_k_no_network[] = "no_network";
static char __pyx_k_prefix_utf[] = "prefix_utf";
static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static char __pyx_k_remove_pis[] = "remove_pis";
static char __pyx_k_s_href_s_s[] = "\\s+href\\s*=\\s*(?:\\'([^\\']*)\\'|\"([^\"]*)\")";
static char __pyx_k_standalone[] = "standalone";
static char __pyx_k_startswith[] = "startswith";
static char __pyx_k_strip_tags[] = "strip_tags";
static char __pyx_k_system_url[] = "system_url";
static char __pyx_k_write_file[] = "write_file";
static char __pyx_k_xpath_name[] = "xpath_name";
static char __pyx_k_xslt_input[] = "xslt_input";
static char __pyx_k_C14N_failed[] = "C14N failed";
static char __pyx_k_CommentBase[] = "CommentBase";
static char __pyx_k_ElementBase[] = "ElementBase";
static char __pyx_k_ElementTree[] = "ElementTree";
static char __pyx_k_Element_tag[] = "Element tag\n        ";
static char __pyx_k_ErrorLevels[] = "ErrorLevels";
static char __pyx_k_ImportError[] = "ImportError";
static char __pyx_k_LookupError[] = "LookupError";
static char __pyx_k_MemoryError[] = "MemoryError";
static char __pyx_k_Namespace_r[] = "Namespace(%r)";
static char __pyx_k_OrderedDict[] = "OrderedDict";
static char __pyx_k_ParserError[] = "ParserError";
static char __pyx_k_SyntaxError[] = "SyntaxError";
static char __pyx_k_TreeBuilder[] = "TreeBuilder";
static char __pyx_k_XPATH_POINT[] = "XPATH_POINT";
static char __pyx_k_XPATH_RANGE[] = "XPATH_RANGE";
static char __pyx_k_XPATH_USERS[] = "XPATH_USERS";
static char __pyx_k_block_count[] = "block_count";
static char __pyx_k_c_node_copy[] = "c_node_copy";
static char __pyx_k_c_tag_count[] = "c_tag_count";
static char __pyx_k_collections[] = "collections";
static char __pyx_k_compression[] = "compression";
static char __pyx_k_domain_name[] = "domain_name";
static char __pyx_k_elementpath[] = "_elementpath";
static char __pyx_k_enumeration[] = "enumeration";
static char __pyx_k_exc_context[] = "exc_context";
static char __pyx_k_external_id[] = "external_id";
static char __pyx_k_fake_parent[] = "fake-parent";
static char __pyx_k_first_error[] = "first_error";
static char __pyx_k_getchildren[] = "getchildren";
static char __pyx_k_getiterator[] = "getiterator";
static char __pyx_k_logger_name[] = "logger_name";
static char __pyx_k_makeelement[] = "makeelement";
static char __pyx_k_new_element[] = "new_element";
static char __pyx_k_old_element[] = "old_element";
static char __pyx_k_output_file[] = "output_file";
static char __pyx_k_profile_run[] = "profile_run";
static char __pyx_k_read_events[] = "read_events";
static char __pyx_k_replacement[] = "replacement";
static char __pyx_k_s_element_s[] = "%s, element '%s'";
static char __pyx_k_strip_cdata[] = "strip_cdata";
static char __pyx_k_xml_version[] = "<?xml version='";
static char __pyx_k_ErrorDomains[] = "ErrorDomains";
static char __pyx_k_Invalid_type[] = "Invalid type";
static char __pyx_k_LXML_VERSION[] = "LXML_VERSION";
static char __pyx_k_RelaxNGError[] = "RelaxNGError";
static char __pyx_k_Syntax_error[] = "Syntax error";
static char __pyx_k_filter_types[] = "filter_types";
static char __pyx_k_getattribute[] = "__getattribute__";
static char __pyx_k_is_attribute[] = "is_attribute";
static char __pyx_k_iterelements[] = "iterelements";
static char __pyx_k_iterentities[] = "iterentities";
static char __pyx_k_pretty_print[] = "pretty_print";
static char __pyx_k_read_network[] = "read_network";
static char __pyx_k_staticmethod[] = "staticmethod";
static char __pyx_k_tostringlist[] = "tostringlist";
static char __pyx_k_BaseException[] = "BaseException";
static char __pyx_k_DTDParseError[] = "DTDParseError";
static char __pyx_k_FutureWarning[] = "FutureWarning";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_XIncludeError[] = "XIncludeError";
static char __pyx_k_XML_line_2987[] = "XML (line 2987)";
static char __pyx_k_XSLTExtension[] = "XSLTExtension";
static char __pyx_k_XSLTSaveError[] = "XSLTSaveError";
static char __pyx_k_class_mapping[] = "class_mapping";
static char __pyx_k_compresslevel[] = "compresslevel";
static char __pyx_k_default_value[] = "default_value";
static char __pyx_k_elements_only[] = "elements_only";
static char __pyx_k_enable_regexp[] = "enable_regexp";
static char __pyx_k_function_name[] = "function_name";
static char __pyx_k_is_standalone[] = "is_standalone";
static char __pyx_k_key_not_found[] = "key not found.";
static char __pyx_k_libxml2_d_d_d[] = "libxml2 %d.%d.%d";
static char __pyx_k_output_parent[] = "output_parent";
static char __pyx_k_parse_options[] = "parse_options";
static char __pyx_k_s_d_d_s_s_s_s[] = "%s:%d:%d:%s:%s:%s: %s";
static char __pyx_k_smart_strings[] = "smart_strings";
static char __pyx_k_standalone_no[] = "' standalone='no'?>\n";
static char __pyx_k_unknown_error[] = "unknown error";
static char __pyx_k_with_comments[] = "with_comments";
static char __pyx_k_write_network[] = "write_network";
static char __pyx_k_AssertionError[] = "AssertionError";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_Empty_tag_name[] = "Empty tag name";
static char __pyx_k_Encoding_error[] = "Encoding error";
static char __pyx_k_GlobalErrorLog[] = "_GlobalErrorLog";
static char __pyx_k_LIBXML_VERSION[] = "LIBXML_VERSION";
static char __pyx_k_MutableMapping[] = "MutableMapping";
static char __pyx_k_NotImplemented[] = "NotImplemented";
static char __pyx_k_ReferenceError[] = "ReferenceError";
static char __pyx_k_Resource_error[] = "Resource error";
static char __pyx_k_XMLSchemaError[] = "XMLSchemaError";
static char __pyx_k_XMLSyntaxError[] = "XMLSyntaxError";
static char __pyx_k_XMLTreeBuilder[] = "XMLTreeBuilder";
static char __pyx_k_XPathEvalError[] = "XPathEvalError";
static char __pyx_k_XPathEvaluator[] = "XPathEvaluator";
static char __pyx_k_XSLTApplyError[] = "XSLTApplyError";
static char __pyx_k_XSLTParseError[] = "XSLTParseError";
static char __pyx_k_access_control[] = "access_control";
static char __pyx_k_attribute_name[] = "attribute_name";
static char __pyx_k_dtd_validation[] = "dtd_validation";
static char __pyx_k_element_config[] = "element_config";
static char __pyx_k_feed_error_log[] = "feed_error_log";
static char __pyx_k_fromstringlist[] = "fromstringlist";
static char __pyx_k_iterattributes[] = "iterattributes";
static char __pyx_k_standalone_yes[] = "' standalone='yes'?>\n";
static char __pyx_k_strip_comments[] = "strip_comments";
static char __pyx_k_strip_elements[] = "strip_elements";
static char __pyx_k_strip_entities[] = "strip_entities";
static char __pyx_k_xml_stylesheet[] = "xml-stylesheet";
static char __pyx_k_DocumentInvalid[] = "DocumentInvalid";
static char __pyx_k_Error_reading_s[] = "Error reading '%s'";
static char __pyx_k_Invalid_operand[] = "Invalid operand";
static char __pyx_k_LIBXSLT_VERSION[] = "LIBXSLT_VERSION";
static char __pyx_k_LxmlSyntaxError[] = "LxmlSyntaxError";
static char __pyx_k_Number_encoding[] = "Number encoding";
static char __pyx_k_SchematronError[] = "SchematronError";
static char __pyx_k_attribute_names[] = "attribute_names";
static char __pyx_k_clear_error_log[] = "_clear_error_log";
static char __pyx_k_collections_abc[] = "collections.abc";
static char __pyx_k_element_factory[] = "element_factory";
static char __pyx_k_element_or_tree[] = "element_or_tree";
static char __pyx_k_invalid_element[] = "invalid element";
static char __pyx_k_memory_debugger[] = "memory_debugger";
static char __pyx_k_no_context_node[] = "no context node";
static char __pyx_k_remove_comments[] = "remove_comments";
static char __pyx_k_store_exception[] = "store_exception";
static char __pyx_k_tree_or_element[] = "tree_or_element";
static char __pyx_k_unknown_error_d[] = "unknown error %d";
static char __pyx_k_xml_declaration[] = "xml_declaration";
static char __pyx_k_DTDValidateError[] = "DTDValidateError";
static char __pyx_k_ImmutableMapping[] = "_ImmutableMapping";
static char __pyx_k_Invalid_tag_name[] = "Invalid tag name";
static char __pyx_k_LxmlError___init[] = "LxmlError.__init__";
static char __pyx_k_PI_lacks_content[] = "PI lacks content";
static char __pyx_k_Start_of_literal[] = "Start of literal";
static char __pyx_k_XPathResultError[] = "XPathResultError";
static char __pyx_k_XPathSyntaxError[] = "XPathSyntaxError";
static char __pyx_k_accepted_domains[] = "_accepted_domains";
static char __pyx_k_backslashreplace[] = "backslashreplace";
static char __pyx_k_default_resolver[] = "default_resolver";
static char __pyx_k_etree_or_element[] = "etree_or_element";
static char __pyx_k_function_mapping[] = "function_mapping";
static char __pyx_k_missing_end_tags[] = "missing end tags";
static char __pyx_k_no_element_found[] = "no element found";
static char __pyx_k_resolve_entities[] = "resolve_entities";
static char __pyx_k_result_container[] = "result_container";
static char __pyx_k_strip_attributes[] = "strip_attributes";
static char __pyx_k_ETCompatXMLParser[] = "ETCompatXMLParser";
static char __pyx_k_Element_s_at_0x_x[] = "<Element %s at 0x%x>";
static char __pyx_k_FunctionNamespace[] = "FunctionNamespace";
static char __pyx_k_Invalid_predicate[] = "Invalid predicate";
static char __pyx_k_LxmlRegistryError[] = "LxmlRegistryError";
static char __pyx_k_ParseError___init[] = "ParseError.__init__";
static char __pyx_k_Proxy_invalidated[] = "Proxy invalidated!";
static char __pyx_k_RelaxNGErrorTypes[] = "RelaxNGErrorTypes";
static char __pyx_k_RelaxNGParseError[] = "RelaxNGParseError";
static char __pyx_k_Stack_usage_error[] = "Stack usage error";
static char __pyx_k_XPATH_LOCATIONSET[] = "XPATH_LOCATIONSET";
static char __pyx_k_XSLTAccessControl[] = "XSLTAccessControl";
static char __pyx_k_clear_error_log_2[] = "clear_error_log";
static char __pyx_k_error_parsing_DTD[] = "error parsing DTD";
static char __pyx_k_filter_from_level[] = "filter_from_level";
static char __pyx_k_not_in_an_element[] = "not in an element";
static char __pyx_k_remove_blank_text[] = "remove_blank_text";
static char __pyx_k_s_line_d_column_d[] = "%s, line %d, column %d";
static char __pyx_k_write_declaration[] = "write_declaration";
static char __pyx_k_DOCTYPE_s_PUBLIC_s[] = "<!DOCTYPE %s PUBLIC \"%s\">";
static char __pyx_k_DOCTYPE_s_SYSTEM_s[] = "<!DOCTYPE %s SYSTEM \"%s\">";
static char __pyx_k_ElementClassLookup[] = "ElementClassLookup";
static char __pyx_k_Invalid_expression[] = "Invalid expression";
static char __pyx_k_Invalid_tag_name_r[] = "Invalid tag name %r";
static char __pyx_k_SerialisationError[] = "SerialisationError";
static char __pyx_k_Sub_resource_error[] = "Sub resource error";
static char __pyx_k_TargetParserResult[] = "_TargetParserResult";
static char __pyx_k_Undefined_variable[] = "Undefined variable";
static char __pyx_k_Unfinished_literal[] = "Unfinished literal";
static char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
static char __pyx_k_UnicodeEncodeError[] = "UnicodeEncodeError";
static char __pyx_k_XPathFunctionError[] = "XPathFunctionError";
static char __pyx_k_XSLTExtensionError[] = "XSLTExtensionError";
static char __pyx_k_append_log_message[] = "_append_log_message";
static char __pyx_k_attribute_defaults[] = "attribute_defaults";
static char __pyx_k_cannot_assign_None[] = "cannot assign None";
static char __pyx_k_cleanup_namespaces[] = "cleanup_namespaces";
static char __pyx_k_etree_or_element_2[] = "_etree_or_element";
static char __pyx_k_filter_from_errors[] = "filter_from_errors";
static char __pyx_k_get_default_parser[] = "get_default_parser";
static char __pyx_k_getdefaultencoding[] = "getdefaultencoding";
static char __pyx_k_no_content_written[] = "no content written";
static char __pyx_k_register_namespace[] = "register_namespace";
static char __pyx_k_set_default_parser[] = "set_default_parser";
static char __pyx_k_unknown_encoding_s[] = "unknown encoding: '%s'";
static char __pyx_k_DTD_not_initialised[] = "DTD not initialised";
static char __pyx_k_ElementStringResult[] = "_ElementStringResult";
static char __pyx_k_FunctionNamespace_r[] = "FunctionNamespace(%r)";
static char __pyx_k_Libxml2_error_types[] = "Libxml2 error types";
static char __pyx_k_MutableMapping_keys[] = "MutableMapping.keys";
static char __pyx_k_Name_not_registered[] = "Name not registered.";
static char __pyx_k_NotImplementedError[] = "NotImplementedError";
static char __pyx_k_Unknown_node_type_s[] = "Unknown node type: %s";
static char __pyx_k_XMLSchemaParseError[] = "XMLSchemaParseError";
static char __pyx_k_build_smart_strings[] = "build_smart_strings";
static char __pyx_k_cannot_parse_from_s[] = "cannot parse from '%s'";
static char __pyx_k_internal_error_tail[] = "internal error (tail)";
static char __pyx_k_internal_error_text[] = "internal error (text)";
static char __pyx_k_restructuredtext_en[] = "restructuredtext en";
static char __pyx_k_Cannot_resolve_URI_s[] = "Cannot resolve URI %s";
static char __pyx_k_DOCTYPE_s_PUBLIC_s_s[] = "<!DOCTYPE %s PUBLIC \"%s\" \"%s\">";
static char __pyx_k_Invalid_child_type_r[] = "Invalid child type: %r";
static char __pyx_k_Invalid_context_size[] = "Invalid context size";
static char __pyx_k_Libxml2_error_levels[] = "Libxml2 error levels";
static char __pyx_k_RelaxNGValidateError[] = "RelaxNGValidateError";
static char __pyx_k_SchematronParseError[] = "SchematronParseError";
static char __pyx_k_index_out_of_range_d[] = "index out of range: %d";
static char __pyx_k_invalid_event_name_s[] = "invalid event name '%s'";
static char __pyx_k_s_a_zA_Z0_9__s_s_0_9[] = "\\s*([a-zA-Z0-9_]+)\\s*=\\s*([0-9]+)";
static char __pyx_k_set_global_max_depth[] = "set_global_max_depth";
static char __pyx_k_xml_s_encoding_s_s_s[] = "^(<\\?xml[^>]+)\\s+encoding\\s*=\\s*[\"\\'][^\"\\']*[\"\\'](\\s*\\?>|)";
static char __pyx_k_Char_out_of_XML_range[] = "Char out of XML range";
static char __pyx_k_ERR_UNDECLARED_ENTITY[] = "ERR_UNDECLARED_ENTITY";
static char __pyx_k_Invalid_entity_name_s[] = "Invalid entity name '%s'";
static char __pyx_k_Libxml2_error_domains[] = "Libxml2 error domains";
static char __pyx_k_No_tree_or_file_given[] = "No tree or file given";
static char __pyx_k_Node_must_not_be_None[] = "Node must not be None";
static char __pyx_k_ProcessingInstruction[] = "ProcessingInstruction";
static char __pyx_k_Unknown_return_type_s[] = "Unknown return type: %s";
static char __pyx_k_Unregistered_function[] = "Unregistered function";
static char __pyx_k_WAR_UNDECLARED_ENTITY[] = "WAR_UNDECLARED_ENTITY";
static char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
static char __pyx_k_inclusive_ns_prefixes[] = "inclusive_ns_prefixes";
static char __pyx_k_parser_locking_failed[] = "parser locking failed";
static char __pyx_k_string___STRING__XSLT[] = "string://__STRING__XSLT";
static char __pyx_k_use_global_python_log[] = "use_global_python_log";
static char __pyx_k_Error_reading_file_s_s[] = "Error reading file '%s': %s";
static char __pyx_k_File_is_already_closed[] = "File is already closed";
static char __pyx_k_ID_attribute_not_found[] = "ID attribute not found.";
static char __pyx_k_Illegal_Unicode_kind_d[] = "Illegal Unicode kind %d";
static char __pyx_k_ImmutableMapping___len[] = "_ImmutableMapping.__len__";
static char __pyx_k_Invalid_input_object_s[] = "Invalid input object: %s";
static char __pyx_k_NamespaceRegistryError[] = "NamespaceRegistryError";
static char __pyx_k_Undefined_xpath_result[] = "Undefined xpath result";
static char __pyx_k_Unknown_xpath_result_s[] = "Unknown xpath result %s";
static char __pyx_k_XMLSchemaValidateError[] = "XMLSchemaValidateError";
static char __pyx_k_XPathDocumentEvaluator[] = "XPathDocumentEvaluator";
static char __pyx_k_can_only_parse_strings[] = "can only parse strings";
static char __pyx_k_invalid_DTD_proxy_at_s[] = "invalid DTD proxy at %s";
static char __pyx_k_text_or_uri_or_element[] = "text_or_uri_or_element";
static char __pyx_k_Cannot_parse_stylesheet[] = "Cannot parse stylesheet";
static char __pyx_k_Failed_to_create_file_s[] = "Failed to create file %s";
static char __pyx_k_ImmutableMapping___iter[] = "_ImmutableMapping.__iter__";
static char __pyx_k_Invalid_HTML_tag_name_r[] = "Invalid HTML tag name %r";
static char __pyx_k_Invalid_namespace_URI_r[] = "Invalid namespace URI %r";
static char __pyx_k_LIBXML_COMPILED_VERSION[] = "LIBXML_COMPILED_VERSION";
static char __pyx_k_Memory_allocation_error[] = "Memory allocation error";
static char __pyx_k_ParserDictionaryContext[] = "_ParserDictionaryContext";
static char __pyx_k_SchematronValidateError[] = "SchematronValidateError";
static char __pyx_k_Unsupported_node_type_d[] = "Unsupported node type: %d";
static char __pyx_k_invalid_argument_type_s[] = "invalid argument type %s";
static char __pyx_k_list_index_out_of_range[] = "list index out of range";
static char __pyx_k_malformed_PI_attributes[] = "malformed PI attributes";
static char __pyx_k_string___STRING__XSLT_2[] = "string://__STRING__XSLT__/";
static char __pyx_k_unknown_output_method_r[] = "unknown output method %r";
static char __pyx_k_Could_not_find_root_node[] = "Could not find root node";
static char __pyx_k_CustomElementClassLookup[] = "CustomElementClassLookup";
static char __pyx_k_Document_is_not_Relax_NG[] = "Document is not Relax NG";
static char __pyx_k_Invalid_attribute_name_r[] = "Invalid attribute name %r";
static char __pyx_k_Invalid_context_position[] = "Invalid context position";
static char __pyx_k_LIBXSLT_COMPILED_VERSION[] = "LIBXSLT_COMPILED_VERSION";
static char __pyx_k_Namespace_prefix_or_None[] = "Namespace prefix or None.\n        ";
static char __pyx_k_PythonElementClassLookup[] = "PythonElementClassLookup";
static char __pyx_k_double_registering_proxy[] = "double registering proxy!";
static char __pyx_k_missing_toplevel_element[] = "missing toplevel element";
static char __pyx_k_set_element_class_lookup[] = "set_element_class_lookup";
static char __pyx_k_xsl_stylesheet_xml_id_id[] = "//xsl:stylesheet[@xml:id = $id]";
static char __pyx_k_Base_class_for_DTD_errors[] = "Base class for DTD errors.\n    ";
static char __pyx_k_ElementDefaultClassLookup[] = "ElementDefaultClassLookup";
static char __pyx_k_Error_applying_stylesheet[] = "Error applying stylesheet";
static char __pyx_k_Error_in_xpath_expression[] = "Error in xpath expression";
static char __pyx_k_Error_while_parsing_a_DTD[] = "Error while parsing a DTD.\n    ";
static char __pyx_k_TargetParserResult___init[] = "_TargetParserResult.__init__";
static char __pyx_k_Unknown_libxml2_version_s[] = "Unknown libxml2 version: %s";
static char __pyx_k_s_s_object_name_r_at_0x_x[] = "<%s.%s object name=%r at 0x%x>";
static char __pyx_k_undecodable_error_message[] = "<undecodable error message>";
static char __pyx_k_Document_is_not_XML_Schema[] = "Document is not XML Schema";
static char __pyx_k_FallbackElementClassLookup[] = "FallbackElementClassLookup";
static char __pyx_k_ImmutableMapping___delitem[] = "_ImmutableMapping.__delitem__";
static char __pyx_k_ImmutableMapping___getitem[] = "_ImmutableMapping.__getitem__";
static char __pyx_k_ImmutableMapping___setitem[] = "_ImmutableMapping.__setitem__";
static char __pyx_k_Internal_lxml_parser_error[] = "Internal lxml parser error.\n    ";
static char __pyx_k_Invalid_entity_reference_s[] = "Invalid entity reference: '%s'";
static char __pyx_k_Invalid_namespace_prefix_r[] = "Invalid namespace prefix %r";
static char __pyx_k_No_ID_dictionary_available[] = "No ID dictionary available.";
static char __pyx_k_Undefined_namespace_prefix[] = "Undefined namespace prefix";
static char __pyx_k_Unsupported_element_type_d[] = "Unsupported element type: %d";
static char __pyx_k_XInclude_processing_failed[] = "XInclude processing failed";
static char __pyx_k_XPath_function_s_not_found[] = "XPath function '%s' not found";
static char __pyx_k_http_www_w3_org_1999_xhtml[] = "http://www.w3.org/1999/xhtml";
static char __pyx_k_invalid_Element_proxy_at_s[] = "invalid Element proxy at %s";
static char __pyx_k_list_index_x_x_not_in_list[] = "list.index(x): x not in list";
static char __pyx_k_pending_open_tags_on_close[] = "pending open tags on close";
static char __pyx_k_Document_is_not_well_formed[] = "Document is not well formed";
static char __pyx_k_ElementNamespaceClassLookup[] = "ElementNamespaceClassLookup";
static char __pyx_k_Element_is_not_in_this_tree[] = "Element is not in this tree.";
static char __pyx_k_ImmutableMapping___contains[] = "_ImmutableMapping.__contains__";
static char __pyx_k_Invalid_input_tag_of_type_r[] = "Invalid input tag of type %r";
static char __pyx_k_Invalid_number_of_arguments[] = "Invalid number of arguments";
static char __pyx_k_Libxml2_RelaxNG_error_types[] = "Libxml2 RelaxNG error types";
static char __pyx_k_Missing_closing_curly_brace[] = "Missing closing curly brace";
static char __pyx_k_Type_s_cannot_be_serialized[] = "Type '%s' cannot be serialized.";
static char __pyx_k_document_context_is_missing[] = "document context is missing";
static char __pyx_k_invalid_Document_proxy_at_s[] = "invalid Document proxy at %s";
static char __pyx_k_list_index_x_x_not_in_slice[] = "list.index(x): x not in slice";
static char __pyx_k_Parsing_requires_string_data[] = "Parsing requires string data";
static char __pyx_k_The_literal_XPath_expression[] = "The literal XPath expression.\n        ";
static char __pyx_k_XSLT_context_not_initialised[] = "XSLT context not initialised";
static char __pyx_k_Base_class_for_RelaxNG_errors[] = "Base class for RelaxNG errors.\n    ";
static char __pyx_k_Base_class_of_all_XSLT_errors[] = "Base class of all XSLT errors.\n    ";
static char __pyx_k_ElementStringResult_getparent[] = "_ElementStringResult.getparent";
static char __pyx_k_Error_during_XPath_evaluation[] = "Error during XPath evaluation.\n    ";
static char __pyx_k_Input_object_has_no_element_s[] = "Input object has no element: %s";
static char __pyx_k_Invalid_character_reference_s[] = "Invalid character reference: '%s'";
static char __pyx_k_Invalid_or_incomplete_context[] = "Invalid or incomplete context";
static char __pyx_k_ParserBasedElementClassLookup[] = "ParserBasedElementClassLookup";
static char __pyx_k_XPath_context_not_initialised[] = "XPath context not initialised";
static char __pyx_k_extension_element_s_not_found[] = "extension element %s not found";
static char __pyx_k_http_purl_org_dc_elements_1_1[] = "http://purl.org/dc/elements/1.1/";
static char __pyx_k_http_schemas_xmlsoap_org_wsdl[] = "http://schemas.xmlsoap.org/wsdl/";
static char __pyx_k_Base_class_of_all_XPath_errors[] = "Base class of all XPath errors.\n    ";
static char __pyx_k_Document_is_not_valid_Relax_NG[] = "Document is not valid Relax NG";
static char __pyx_k_Error_handling_an_XPath_result[] = "Error handling an XPath result.\n    ";
static char __pyx_k_Input_object_has_no_document_s[] = "Input object has no document: %s";
static char __pyx_k_Invalid_attribute_dictionary_s[] = "Invalid attribute dictionary: %s";
static char __pyx_k_XPath_evaluator_locking_failed[] = "XPath evaluator locking failed";
static char __pyx_k_cannot_append_parent_to_itself[] = "cannot append parent to itself";
static char __pyx_k_home_stefan_source_Python_lxml[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx";
static char __pyx_k_http_www_w3_org_2001_XMLSchema[] = "http://www.w3.org/2001/XMLSchema";
static char __pyx_k_invalid_node_type_d_expected_d[] = "invalid node type %d, expected %d";
static char __pyx_k_s_s_object_name_r_type_r_occur[] = "<%s.%s object name=%r type=%r occur=%r at 0x%x>";
static char __pyx_k_string___STRING__XSLT___d_xslt[] = "string://__STRING__XSLT__/%d.xslt";
static char __pyx_k_unsupported_XSLT_result_type_d[] = "unsupported XSLT result type: %d";
static char __pyx_k_ERR_ENCODING_NAME_79_ERR_HYPHEN[] = "ERR_ENCODING_NAME=79\nERR_HYPHEN_IN_COMMENT=80\nERR_INVALID_ENCODING=81\nERR_EXT_ENTITY_STANDALONE=82\nERR_CONDSEC_INVALID=83\nERR_VALUE_REQUIRED=84\nERR_NOT_WELL_BALANCED=85\nERR_EXTRA_CONTENT=86\nERR_ENTITY_CHAR_ERROR=87\nERR_ENTITY_PE_INTERNAL=88\nERR_ENTITY_LOOP=89\nERR_ENTITY_BOUNDARY=90\nERR_INVALID_URI=91\nERR_URI_FRAGMENT=92\nWAR_CATALOG_PI=93\nERR_NO_DTD=94\nERR_CONDSEC_INVALID_KEYWORD=95\nERR_VERSION_MISSING=96\nWAR_UNKNOWN_VERSION=97\nWAR_LANG_VALUE=98\nWAR_NS_URI=99\nWAR_NS_URI_RELATIVE=100\nERR_MISSING_ENCODING=101\nWAR_SPACE_VALUE=102\nERR_NOT_STANDALONE=103\nERR_ENTITY_PROCESSING=104\nERR_NOTATION_PROCESSING=105\nWAR_NS_COLUMN=106\nWAR_ENTITY_REDEFINED=107\nERR_UNKNOWN_VERSION=108\nERR_VERSION_MISMATCH=109\nERR_NAME_TOO_LONG=110\nERR_USER_STOP=111\nNS_ERR_XML_NAMESPACE=200\nNS_ERR_UNDEFINED_NAMESPACE=201\nNS_ERR_QNAME=202\nNS_ERR_ATTRIBUTE_REDEFINED=203\nNS_ERR_EMPTY=204\nNS_ERR_COLON=205\nDTD_ATTRIBUTE_DEFAULT=500\nDTD_ATTRIBUTE_REDEFINED=501\nDTD_ATTRIBUTE_VALUE=502\nDTD_CONTENT_ERROR=503\nDTD_CONTENT_MODEL=504\nDTD_CONTENT_NOT_DETERMINIST=505\nDTD_DIFFERENT_PREFIX=506\nDTD_ELEM_DEFAULT_NAMESPACE=507\nDTD_ELEM_NAMESPACE=508\nDTD_ELEM_REDEFINED=509\nDTD_EMPTY_NOTATION=510\nDTD_ENTITY_TYPE=511\nDTD_ID_FIXED=512\nDTD_ID_REDEFINED=513\nDTD_ID_SUBSET=514\nDTD_INVALID_CHILD=515\nDTD_INVALID_DEFAULT=516\nDTD_LOAD_ERROR=517\nDTD_MISSING_ATTRIBUTE=518\nDTD_MIXED_CORRUPT=519\nDTD_MULTIPLE_ID=520\nDTD_NO_DOC=521\nDTD_NO_DTD=522\nDTD_NO_ELEM_NAME=523\nDTD_NO_PREFIX=524\nDTD_NO_ROOT=525\nDTD_NOTATION_REDEFINED=526\nDTD_NOTATION_VALUE=527\nDTD_NOT_EMPTY=528\nDTD_NOT_PCDATA=529\nDTD_NOT_STANDALONE=530\nDTD_ROOT_NAME=531\nDTD_STANDALONE_WHITE_SPACE=532\nDTD_UNKNOWN_ATTRIBUTE=533\nDTD_UNKNOWN_ELEM=534\nDTD_UNKNOWN_ENTITY=535\nDTD_UNKNOWN_ID=536\nDTD_UNKNOWN_NOTATION=537\nDTD_STANDALONE_DEFAULTED=538\nDTD_XMLID_VALUE=539\nDTD_XMLID_TYPE=540\nDTD_DUP_TOKEN=541\nHTML_STRUCURE_ERROR=800\nHTML_UNKNOWN_TAG=801\nRNGP_ANYNAME_ATTR_ANCESTOR=1000\nRNGP_ATTR_CONFLICT=1001\nRNG""P_ATTRIBUTE_CHILDREN=1002\n";
static char __pyx_k_Error_during_C14N_serialisation[] = "Error during C14N serialisation.\n    ";
static char __pyx_k_Expected_for_variable_reference[] = "Expected $ for variable reference";
static char __pyx_k_File_or_filename_expected_got_s[] = "File or filename expected, got '%s'";
static char __pyx_k_Invalid_URL_must_not_contain_or[] = "Invalid URL, must not contain '\"' or '>'";
static char __pyx_k_Not_yet_implemented_result_node[] = "Not yet implemented result node type: %d";
static char __pyx_k_ParserSchemaValidationContext_n[] = "_ParserSchemaValidationContext not initialised";
static char __pyx_k_RELAXNG_OK_0_RELAXNG_ERR_MEMORY[] = "RELAXNG_OK=0\nRELAXNG_ERR_MEMORY=1\nRELAXNG_ERR_TYPE=2\nRELAXNG_ERR_TYPEVAL=3\nRELAXNG_ERR_DUPID=4\nRELAXNG_ERR_TYPECMP=5\nRELAXNG_ERR_NOSTATE=6\nRELAXNG_ERR_NODEFINE=7\nRELAXNG_ERR_LISTEXTRA=8\nRELAXNG_ERR_LISTEMPTY=9\nRELAXNG_ERR_INTERNODATA=10\nRELAXNG_ERR_INTERSEQ=11\nRELAXNG_ERR_INTEREXTRA=12\nRELAXNG_ERR_ELEMNAME=13\nRELAXNG_ERR_ATTRNAME=14\nRELAXNG_ERR_ELEMNONS=15\nRELAXNG_ERR_ATTRNONS=16\nRELAXNG_ERR_ELEMWRONGNS=17\nRELAXNG_ERR_ATTRWRONGNS=18\nRELAXNG_ERR_ELEMEXTRANS=19\nRELAXNG_ERR_ATTREXTRANS=20\nRELAXNG_ERR_ELEMNOTEMPTY=21\nRELAXNG_ERR_NOELEM=22\nRELAXNG_ERR_NOTELEM=23\nRELAXNG_ERR_ATTRVALID=24\nRELAXNG_ERR_CONTENTVALID=25\nRELAXNG_ERR_EXTRACONTENT=26\nRELAXNG_ERR_INVALIDATTR=27\nRELAXNG_ERR_DATAELEM=28\nRELAXNG_ERR_VALELEM=29\nRELAXNG_ERR_LISTELEM=30\nRELAXNG_ERR_DATATYPE=31\nRELAXNG_ERR_VALUE=32\nRELAXNG_ERR_LIST=33\nRELAXNG_ERR_NOGRAMMAR=34\nRELAXNG_ERR_EXTRADATA=35\nRELAXNG_ERR_LACKDATA=36\nRELAXNG_ERR_INTERNAL=37\nRELAXNG_ERR_ELEMWRONG=38\nRELAXNG_ERR_TEXTWRONG=39\n";
static char __pyx_k_Registered_element_classes_must[] = "Registered element classes must be subtypes of ElementBase";
static char __pyx_k_Schema_instance_not_initialised[] = "Schema instance not initialised";
static char __pyx_k_The_base_URI_of_the_Element_xml[] = "The base URI of the Element (xml:base or HTML base URL).\n        None if the base URI is unknown.\n\n        Note that the value depends on the URL of the document that\n        holds the Element if there is no xml:base attribute on the\n        Element or its ancestors.\n\n        Setting this property will set an xml:base attribute on the\n        Element, regardless of the document type (XML or HTML).\n        ";
static char __pyx_k_The_custom_resolver_registry_of[] = "The custom resolver registry of this parser.";
static char __pyx_k_The_name_of_the_error_level_See[] = "The name of the error level.  See lxml.etree.ErrorLevels\n        ";
static char __pyx_k_XML_declaration_already_written[] = "XML declaration already written";
static char __pyx_k_XPath_evaluator_not_initialised[] = "XPath evaluator not initialised";
static char __pyx_k_XSLT_stylesheet_not_initialised[] = "XSLT stylesheet not initialised";
static char __pyx_k_ambiguous_reference_to_embedded[] = "ambiguous reference to embedded stylesheet";
static char __pyx_k_boolean_xs_attribute_default_or[] = "boolean(//xs:attribute[@default or @fixed][1])";
static char __pyx_k_cannot_set_a_maximum_stylesheet[] = "cannot set a maximum stylesheet traversal depth < 0";
static char __pyx_k_document_external_context_nodes[] = "document-external context nodes are not supported";
static char __pyx_k_end_tag_mismatch_expected_s_got[] = "end tag mismatch (expected %s, got %s)";
static char __pyx_k_file_must_be_a_filename_or_file[] = "file must be a filename or file-like object";
static char __pyx_k_got_invalid_input_value_of_type[] = "got invalid input value of type %s, expected string or Element";
static char __pyx_k_http_relaxng_org_ns_structure_1[] = "http://relaxng.org/ns/structure/1.0";
static char __pyx_k_lxml_etree_was_compiled_without[] = "lxml.etree was compiled without Schematron support.";
static char __pyx_k_only_setting_the_href_attribute[] = "only setting the 'href' attribute is supported on XSLT-PIs";
static char __pyx_k_s_s_object_name_r_elemname_r_pr[] = "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>";
static char __pyx_k_s_s_object_name_r_prefix_r_type[] = "<%s.%s object name=%r prefix=%r type=%r at 0x%x>";
static char __pyx_k_A_libxml2_error_that_occurred_du[] = "A libxml2 error that occurred during serialisation.\n    ";
static char __pyx_k_All_strings_must_be_XML_compatib[] = "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters";
static char __pyx_k_Argument_is_not_a_file_like_obje[] = "Argument is not a file-like object";
static char __pyx_k_Argument_must_be_bytes_or_unicod[] = "Argument must be bytes or unicode, got '%.200s'";
static char __pyx_k_Argument_must_be_string_or_unico[] = "Argument must be string or unicode.";
static char __pyx_k_AttributeBasedElementClassLookup[] = "AttributeBasedElementClassLookup";
static char __pyx_k_Base_class_for_all_syntax_errors[] = "Base class for all syntax errors.\n    ";
static char __pyx_k_Base_class_of_all_Schematron_err[] = "Base class of all Schematron errors.\n    ";
static char __pyx_k_Base_class_of_all_XML_Schema_err[] = "Base class of all XML Schema errors\n    ";
static char __pyx_k_Base_class_of_lxml_registry_erro[] = "Base class of lxml registry errors.\n    ";
static char __pyx_k_Can_only_discard_comments_in_C14[] = "Can only discard comments in C14N serialisation";
static char __pyx_k_Cannot_enable_XML_declaration_in[] = "Cannot enable XML declaration in C14N";
static char __pyx_k_Cannot_specify_encoding_with_C14[] = "Cannot specify encoding with C14N";
static char __pyx_k_Could_not_create_I_O_writer_cont[] = "Could not create I/O writer context.";
static char __pyx_k_DOCTYPE_already_written_or_canno[] = "DOCTYPE already written or cannot write it here";
static char __pyx_k_Document_does_not_comply_with_sc[] = "Document does not comply with schema";
static char __pyx_k_Document_is_not_a_valid_Schematr[] = "Document is not a valid Schematron schema";
static char __pyx_k_Document_is_not_parsable_as_Rela[] = "Document is not parsable as Relax NG";
static char __pyx_k_Document_is_not_valid_XML_Schema[] = "Document is not valid XML Schema";
static char __pyx_k_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER[] = "ERR_OK=0\nERR_INTERNAL_ERROR=1\nERR_NO_MEMORY=2\nERR_DOCUMENT_START=3\nERR_DOCUMENT_EMPTY=4\nERR_DOCUMENT_END=5\nERR_INVALID_HEX_CHARREF=6\nERR_INVALID_DEC_CHARREF=7\nERR_INVALID_CHARREF=8\nERR_INVALID_CHAR=9\nERR_CHARREF_AT_EOF=10\nERR_CHARREF_IN_PROLOG=11\nERR_CHARREF_IN_EPILOG=12\nERR_CHARREF_IN_DTD=13\nERR_ENTITYREF_AT_EOF=14\nERR_ENTITYREF_IN_PROLOG=15\nERR_ENTITYREF_IN_EPILOG=16\nERR_ENTITYREF_IN_DTD=17\nERR_PEREF_AT_EOF=18\nERR_PEREF_IN_PROLOG=19\nERR_PEREF_IN_EPILOG=20\nERR_PEREF_IN_INT_SUBSET=21\nERR_ENTITYREF_NO_NAME=22\nERR_ENTITYREF_SEMICOL_MISSING=23\nERR_PEREF_NO_NAME=24\nERR_PEREF_SEMICOL_MISSING=25\nERR_UNDECLARED_ENTITY=26\nWAR_UNDECLARED_ENTITY=27\nERR_UNPARSED_ENTITY=28\nERR_ENTITY_IS_EXTERNAL=29\nERR_ENTITY_IS_PARAMETER=30\nERR_UNKNOWN_ENCODING=31\nERR_UNSUPPORTED_ENCODING=32\nERR_STRING_NOT_STARTED=33\nERR_STRING_NOT_CLOSED=34\nERR_NS_DECL_ERROR=35\nERR_ENTITY_NOT_STARTED=36\nERR_ENTITY_NOT_FINISHED=37\nERR_LT_IN_ATTRIBUTE=38\nERR_ATTRIBUTE_NOT_STARTED=39\nERR_ATTRIBUTE_NOT_FINISHED=40\nERR_ATTRIBUTE_WITHOUT_VALUE=41\nERR_ATTRIBUTE_REDEFINED=42\nERR_LITERAL_NOT_STARTED=43\nERR_LITERAL_NOT_FINISHED=44\nERR_COMMENT_NOT_FINISHED=45\nERR_PI_NOT_STARTED=46\nERR_PI_NOT_FINISHED=47\nERR_NOTATION_NOT_STARTED=48\nERR_NOTATION_NOT_FINISHED=49\nERR_ATTLIST_NOT_STARTED=50\nERR_ATTLIST_NOT_FINISHED=51\nERR_MIXED_NOT_STARTED=52\nERR_MIXED_NOT_FINISHED=53\nERR_ELEMCONTENT_NOT_STARTED=54\nERR_ELEMCONTENT_NOT_FINISHED=55\nERR_XMLDECL_NOT_STARTED=56\nERR_XMLDECL_NOT_FINISHED=57\nERR_CONDSEC_NOT_STARTED=58\nERR_CONDSEC_NOT_FINISHED=59\nERR_EXT_SUBSET_NOT_FINISHED=60\nERR_DOCTYPE_NOT_FINISHED=61\nERR_MISPLACED_CDATA_END=62\nERR_CDATA_NOT_FINISHED=63\nERR_RESERVED_XML_NAME=64\nERR_SPACE_REQUIRED=65\nERR_SEPARATOR_REQUIRED=66\nERR_NMTOKEN_REQUIRED=67\nERR_NAME_REQUIRED=68\nERR_PCDATA_REQUIRED=69\nERR_URI_REQUIRED=70\nERR_PUBID_REQUIRED=71\nERR_LT_REQUIRED=72\nERR_GT_REQUIRED=73\nERR_LTSLASH_REQUIRED=74\nERR_EQUAL_REQUIRED=75\nERR_TAG_NAME_MISMATCH=76\nERR_TAG_NOT_FIN""ISHED=77\nERR_STANDALONE_VALUE=78\n";
static char __pyx_k_ElementTree_not_initialized_miss[] = "ElementTree not initialized, missing root";
static char __pyx_k_Element_attribute_dictionary_Whe[] = "Element attribute dictionary. Where possible, use get(), set(),\n        keys(), values() and items() to access element attributes.\n        ";
static char __pyx_k_Element_is_not_a_child_of_this_n[] = "Element is not a child of this node.";
static char __pyx_k_Entity_class_must_be_subclass_of[] = "Entity class must be subclass of EntityBase";
static char __pyx_k_Error_applying_stylesheet_line_d[] = "Error applying stylesheet, line %d";
static char __pyx_k_Error_during_XInclude_processing[] = "Error during XInclude processing.\n    ";
static char __pyx_k_Error_during_XSLT_extension_elem[] = "Error during XSLT extension element evaluation";
static char __pyx_k_Error_during_serialisation_out_o[] = "Error during serialisation (out of memory?)";
static char __pyx_k_Error_executing_extension_elemen[] = "Error executing extension element '%s': %s";
static char __pyx_k_Error_parsing_a_stylesheet_docum[] = "Error parsing a stylesheet document.\n    ";
static char __pyx_k_Error_registering_a_namespace_ex[] = "Error registering a namespace extension.\n    ";
static char __pyx_k_Error_registering_an_XSLT_extens[] = "Error registering an XSLT extension.\n    ";
static char __pyx_k_Error_running_an_XSL_transformat[] = "Error running an XSL transformation.\n    ";
static char __pyx_k_Error_serialising_an_XSLT_result[] = "Error serialising an XSLT result.\n    ";
static char __pyx_k_Error_while_parsing_an_XML_docum[] = "Error while parsing an XML document as RelaxNG.\n    ";
static char __pyx_k_Error_while_validating_an_XML_do[] = "Error while validating an XML document with a DTD.\n    ";
static char __pyx_k_Failed_to_create_validation_cont[] = "Failed to create validation context";
static char __pyx_k_I18N_NO_OUTPUT_6004_BUF_OVERFLOW[] = "I18N_NO_OUTPUT=6004\nBUF_OVERFLOW=7000\n";
static char __pyx_k_Information_about_the_document_p[] = "Information about the document provided by parser and DTD.  This\n        value is only defined for ElementTree objects based on the root node\n        of a parsed document (e.g.  those returned by the parse functions),\n        not for trees that were built manually.\n        ";
static char __pyx_k_Internal_error_in_DTD_validation[] = "Internal error in DTD validation";
static char __pyx_k_Internal_error_in_Relax_NG_valid[] = "Internal error in Relax NG validation";
static char __pyx_k_Internal_error_in_Schematron_val[] = "Internal error in Schematron validation";
static char __pyx_k_Internal_error_in_XML_Schema_val[] = "Internal error in XML Schema validation.";
static char __pyx_k_Internal_error_looking_up_an_XPa[] = "Internal error looking up an XPath extension function.\n    ";
static char __pyx_k_Main_exception_base_class_for_lx[] = "Main exception base class for lxml.  All other exceptions inherit from\n    this one.\n    ";
static char __pyx_k_NONE_0_PARSER_1_TREE_2_NAMESPACE[] = "NONE=0\nPARSER=1\nTREE=2\nNAMESPACE=3\nDTD=4\nHTML=5\nMEMORY=6\nOUTPUT=7\nIO=8\nFTP=9\nHTTP=10\nXINCLUDE=11\nXPATH=12\nXPOINTER=13\nREGEXP=14\nDATATYPE=15\nSCHEMASP=16\nSCHEMASV=17\nRELAXNGP=18\nRELAXNGV=19\nCATALOG=20\nC14N=21\nXSLT=22\nVALID=23\nCHECK=24\nWRITER=25\nMODULE=26\nI18N=27\nSCHEMATRONV=28\nBUFFER=29\nURI=30\n";
static char __pyx_k_NONE_0_WARNING_1_ERROR_2_FATAL_3[] = "NONE=0\nWARNING=1\nERROR=2\nFATAL=3\n";
static char __pyx_k_Namespace_prefix_URI_mapping_kno[] = "Namespace prefix->URI mapping known in the context of this\n        Element.  This includes all namespace declarations of the\n        parents.\n\n        Note that changing the returned dict has no effect on the Element.\n        ";
static char __pyx_k_Namespace_prefix_for_extension_f[] = "Namespace prefix for extension functions.";
static char __pyx_k_Non_Element_values_not_supported[] = "Non-Element values not supported at this point - got %r";
static char __pyx_k_Only_elements_can_be_the_root_of[] = "Only elements can be the root of an ElementTree";
static char __pyx_k_Only_processing_instructions_and[] = "Only processing instructions and comments can be siblings of the root element";
static char __pyx_k_Original_line_number_as_found_by[] = "Original line number as found by the parser or None if unknown.\n        ";
static char __pyx_k_PI_class_must_be_subclass_of_PIB[] = "PI class must be subclass of PIBase";
static char __pyx_k_Prefix_format_reserved_for_inter[] = "Prefix format reserved for internal use";
static char __pyx_k_RNGP_ATTRIBUTE_CONTENT_1003_RNGP[] = "RNGP_ATTRIBUTE_CONTENT=1003\nRNGP_ATTRIBUTE_EMPTY=1004\nRNGP_ATTRIBUTE_NOOP=1005\nRNGP_CHOICE_CONTENT=1006\nRNGP_CHOICE_EMPTY=1007\nRNGP_CREATE_FAILURE=1008\nRNGP_DATA_CONTENT=1009\nRNGP_DEF_CHOICE_AND_INTERLEAVE=1010\nRNGP_DEFINE_CREATE_FAILED=1011\nRNGP_DEFINE_EMPTY=1012\nRNGP_DEFINE_MISSING=1013\nRNGP_DEFINE_NAME_MISSING=1014\nRNGP_ELEM_CONTENT_EMPTY=1015\nRNGP_ELEM_CONTENT_ERROR=1016\nRNGP_ELEMENT_EMPTY=1017\nRNGP_ELEMENT_CONTENT=1018\nRNGP_ELEMENT_NAME=1019\nRNGP_ELEMENT_NO_CONTENT=1020\nRNGP_ELEM_TEXT_CONFLICT=1021\nRNGP_EMPTY=1022\nRNGP_EMPTY_CONSTRUCT=1023\nRNGP_EMPTY_CONTENT=1024\nRNGP_EMPTY_NOT_EMPTY=1025\nRNGP_ERROR_TYPE_LIB=1026\nRNGP_EXCEPT_EMPTY=1027\nRNGP_EXCEPT_MISSING=1028\nRNGP_EXCEPT_MULTIPLE=1029\nRNGP_EXCEPT_NO_CONTENT=1030\nRNGP_EXTERNALREF_EMTPY=1031\nRNGP_EXTERNAL_REF_FAILURE=1032\nRNGP_EXTERNALREF_RECURSE=1033\nRNGP_FORBIDDEN_ATTRIBUTE=1034\nRNGP_FOREIGN_ELEMENT=1035\nRNGP_GRAMMAR_CONTENT=1036\nRNGP_GRAMMAR_EMPTY=1037\nRNGP_GRAMMAR_MISSING=1038\nRNGP_GRAMMAR_NO_START=1039\nRNGP_GROUP_ATTR_CONFLICT=1040\nRNGP_HREF_ERROR=1041\nRNGP_INCLUDE_EMPTY=1042\nRNGP_INCLUDE_FAILURE=1043\nRNGP_INCLUDE_RECURSE=1044\nRNGP_INTERLEAVE_ADD=1045\nRNGP_INTERLEAVE_CREATE_FAILED=1046\nRNGP_INTERLEAVE_EMPTY=1047\nRNGP_INTERLEAVE_NO_CONTENT=1048\nRNGP_INVALID_DEFINE_NAME=1049\nRNGP_INVALID_URI=1050\nRNGP_INVALID_VALUE=1051\nRNGP_MISSING_HREF=1052\nRNGP_NAME_MISSING=1053\nRNGP_NEED_COMBINE=1054\nRNGP_NOTALLOWED_NOT_EMPTY=1055\nRNGP_NSNAME_ATTR_ANCESTOR=1056\nRNGP_NSNAME_NO_NS=1057\nRNGP_PARAM_FORBIDDEN=1058\nRNGP_PARAM_NAME_MISSING=1059\nRNGP_PARENTREF_CREATE_FAILED=1060\nRNGP_PARENTREF_NAME_INVALID=1061\nRNGP_PARENTREF_NO_NAME=1062\nRNGP_PARENTREF_NO_PARENT=1063\nRNGP_PARENTREF_NOT_EMPTY=1064\nRNGP_PARSE_ERROR=1065\nRNGP_PAT_ANYNAME_EXCEPT_ANYNAME=1066\nRNGP_PAT_ATTR_ATTR=1067\nRNGP_PAT_ATTR_ELEM=1068\nRNGP_PAT_DATA_EXCEPT_ATTR=1069\nRNGP_PAT_DATA_EXCEPT_ELEM=1070\nRNGP_PAT_DATA_EXCEPT_EMPTY=1071\nRNGP_PAT_DATA_EXCEPT_GROUP=1072\nRNGP_PAT_DATA_EXCEPT_INTERLEAVE=107""3\nRNGP_PAT_DATA_EXCEPT_LIST=1074\n";
static char __pyx_k_RNGP_PAT_DATA_EXCEPT_ONEMORE_107[] = "RNGP_PAT_DATA_EXCEPT_ONEMORE=1075\nRNGP_PAT_DATA_EXCEPT_REF=1076\nRNGP_PAT_DATA_EXCEPT_TEXT=1077\nRNGP_PAT_LIST_ATTR=1078\nRNGP_PAT_LIST_ELEM=1079\nRNGP_PAT_LIST_INTERLEAVE=1080\nRNGP_PAT_LIST_LIST=1081\nRNGP_PAT_LIST_REF=1082\nRNGP_PAT_LIST_TEXT=1083\nRNGP_PAT_NSNAME_EXCEPT_ANYNAME=1084\nRNGP_PAT_NSNAME_EXCEPT_NSNAME=1085\nRNGP_PAT_ONEMORE_GROUP_ATTR=1086\nRNGP_PAT_ONEMORE_INTERLEAVE_ATTR=1087\nRNGP_PAT_START_ATTR=1088\nRNGP_PAT_START_DATA=1089\nRNGP_PAT_START_EMPTY=1090\nRNGP_PAT_START_GROUP=1091\nRNGP_PAT_START_INTERLEAVE=1092\nRNGP_PAT_START_LIST=1093\nRNGP_PAT_START_ONEMORE=1094\nRNGP_PAT_START_TEXT=1095\nRNGP_PAT_START_VALUE=1096\nRNGP_PREFIX_UNDEFINED=1097\nRNGP_REF_CREATE_FAILED=1098\nRNGP_REF_CYCLE=1099\nRNGP_REF_NAME_INVALID=1100\nRNGP_REF_NO_DEF=1101\nRNGP_REF_NO_NAME=1102\nRNGP_REF_NOT_EMPTY=1103\nRNGP_START_CHOICE_AND_INTERLEAVE=1104\nRNGP_START_CONTENT=1105\nRNGP_START_EMPTY=1106\nRNGP_START_MISSING=1107\nRNGP_TEXT_EXPECTED=1108\nRNGP_TEXT_HAS_CHILD=1109\nRNGP_TYPE_MISSING=1110\nRNGP_TYPE_NOT_FOUND=1111\nRNGP_TYPE_VALUE=1112\nRNGP_UNKNOWN_ATTRIBUTE=1113\nRNGP_UNKNOWN_COMBINE=1114\nRNGP_UNKNOWN_CONSTRUCT=1115\nRNGP_UNKNOWN_TYPE_LIB=1116\nRNGP_URI_FRAGMENT=1117\nRNGP_URI_NOT_ABSOLUTE=1118\nRNGP_VALUE_EMPTY=1119\nRNGP_VALUE_NO_CONTENT=1120\nRNGP_XMLNS_NAME=1121\nRNGP_XML_NS=1122\nXPATH_EXPRESSION_OK=1200\nXPATH_NUMBER_ERROR=1201\nXPATH_UNFINISHED_LITERAL_ERROR=1202\nXPATH_START_LITERAL_ERROR=1203\nXPATH_VARIABLE_REF_ERROR=1204\nXPATH_UNDEF_VARIABLE_ERROR=1205\nXPATH_INVALID_PREDICATE_ERROR=1206\nXPATH_EXPR_ERROR=1207\nXPATH_UNCLOSED_ERROR=1208\nXPATH_UNKNOWN_FUNC_ERROR=1209\nXPATH_INVALID_OPERAND=1210\nXPATH_INVALID_TYPE=1211\nXPATH_INVALID_ARITY=1212\nXPATH_INVALID_CTXT_SIZE=1213\nXPATH_INVALID_CTXT_POSITION=1214\nXPATH_MEMORY_ERROR=1215\nXPTR_SYNTAX_ERROR=1216\nXPTR_RESOURCE_ERROR=1217\nXPTR_SUB_RESOURCE_ERROR=1218\nXPATH_UNDEF_PREFIX_ERROR=1219\nXPATH_ENCODING_ERROR=1220\nXPATH_INVALID_CHAR_ERROR=1221\nTREE_INVALID_HEX=1300\nTREE_INVALID_DEC=1301\nTREE""_UNTERMINATED_ENTITY=1302\n";
static char __pyx_k_Registered_functions_must_be_cal[] = "Registered functions must be callable.";
static char __pyx_k_RelaxNG_instance_not_initialised[] = "RelaxNG instance not initialised";
static char __pyx_k_Return_an_ElementTree_with_profi[] = "Return an ElementTree with profiling data for the stylesheet run.\n        ";
static char __pyx_k_Returns_a_DOCTYPE_declaration_st[] = "Returns a DOCTYPE declaration string for the document.";
static char __pyx_k_Returns_a_DTD_validator_based_on[] = "Returns a DTD validator based on the internal subset of the document.";
static char __pyx_k_Returns_a_dict_containing_all_ps[] = "Returns a dict containing all pseudo-attributes that can be\n        parsed from the text content of this processing instruction.\n        Note that modifying the dict currently has no effect on the\n        XML node, although this is not guaranteed to stay this way.\n        ";
static char __pyx_k_Returns_the_XML_version_as_decla[] = "Returns the XML version as declared by the document.";
static char __pyx_k_Returns_the_encoding_name_as_dec[] = "Returns the encoding name as declared by the document.";
static char __pyx_k_Returns_the_name_of_the_root_nod[] = "Returns the name of the root node as defined by the DOCTYPE.";
static char __pyx_k_Returns_the_public_ID_of_the_DOC[] = "Returns the public ID of the DOCTYPE.";
static char __pyx_k_Returns_the_standalone_flag_as_d[] = "Returns the standalone flag as declared by the document.  The possible\n        values are True (``standalone='yes'``), False\n        (``standalone='no'`` or flag not provided in the declaration),\n        and None (unknown or no declaration found).  Note that a\n        normal truth test on this value will always tell if the\n        ``standalone`` flag was set to ``'yes'`` or not.\n        ";
static char __pyx_k_Returns_the_system_ID_of_the_DOC[] = "Returns the system ID of the DOCTYPE.";
static char __pyx_k_SCHEMAP_CVC_SIMPLE_TYPE_3062_SCH[] = "SCHEMAP_CVC_SIMPLE_TYPE=3062\nSCHEMAP_COS_CT_EXTENDS_1_1=3063\nSCHEMAP_SRC_IMPORT_1_1=3064\nSCHEMAP_SRC_IMPORT_1_2=3065\nSCHEMAP_SRC_IMPORT_2=3066\nSCHEMAP_SRC_IMPORT_2_1=3067\nSCHEMAP_SRC_IMPORT_2_2=3068\nSCHEMAP_INTERNAL=3069\nSCHEMAP_NOT_DETERMINISTIC=3070\nSCHEMAP_SRC_ATTRIBUTE_GROUP_1=3071\nSCHEMAP_SRC_ATTRIBUTE_GROUP_2=3072\nSCHEMAP_SRC_ATTRIBUTE_GROUP_3=3073\nSCHEMAP_MG_PROPS_CORRECT_1=3074\nSCHEMAP_MG_PROPS_CORRECT_2=3075\nSCHEMAP_SRC_CT_1=3076\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3=3077\nSCHEMAP_AU_PROPS_CORRECT_2=3078\nSCHEMAP_A_PROPS_CORRECT_2=3079\nSCHEMAP_C_PROPS_CORRECT=3080\nSCHEMAP_SRC_REDEFINE=3081\nSCHEMAP_SRC_IMPORT=3082\nSCHEMAP_WARN_SKIP_SCHEMA=3083\nSCHEMAP_WARN_UNLOCATED_SCHEMA=3084\nSCHEMAP_WARN_ATTR_REDECL_PROH=3085\nSCHEMAP_WARN_ATTR_POINTLESS_PROH=3086\nSCHEMAP_AG_PROPS_CORRECT=3087\nSCHEMAP_COS_CT_EXTENDS_1_2=3088\nSCHEMAP_AU_PROPS_CORRECT=3089\nSCHEMAP_A_PROPS_CORRECT_3=3090\nSCHEMAP_COS_ALL_LIMITED=3091\nSCHEMATRONV_ASSERT=4000\nSCHEMATRONV_REPORT=4001\nMODULE_OPEN=4900\nMODULE_CLOSE=4901\nCHECK_FOUND_ELEMENT=5000\nCHECK_FOUND_ATTRIBUTE=5001\nCHECK_FOUND_TEXT=5002\nCHECK_FOUND_CDATA=5003\nCHECK_FOUND_ENTITYREF=5004\nCHECK_FOUND_ENTITY=5005\nCHECK_FOUND_PI=5006\nCHECK_FOUND_COMMENT=5007\nCHECK_FOUND_DOCTYPE=5008\nCHECK_FOUND_FRAGMENT=5009\nCHECK_FOUND_NOTATION=5010\nCHECK_UNKNOWN_NODE=5011\nCHECK_ENTITY_TYPE=5012\nCHECK_NO_PARENT=5013\nCHECK_NO_DOC=5014\nCHECK_NO_NAME=5015\nCHECK_NO_ELEM=5016\nCHECK_WRONG_DOC=5017\nCHECK_NO_PREV=5018\nCHECK_WRONG_PREV=5019\nCHECK_NO_NEXT=5020\nCHECK_WRONG_NEXT=5021\nCHECK_NOT_DTD=5022\nCHECK_NOT_ATTR=5023\nCHECK_NOT_ATTR_DECL=5024\nCHECK_NOT_ELEM_DECL=5025\nCHECK_NOT_ENTITY_DECL=5026\nCHECK_NOT_NS_DECL=5027\nCHECK_NO_HREF=5028\nCHECK_WRONG_PARENT=5029\nCHECK_NS_SCOPE=5030\nCHECK_NS_ANCESTOR=5031\nCHECK_NOT_UTF8=5032\nCHECK_NO_DICT=5033\nCHECK_NOT_NCNAME=5034\nCHECK_OUTSIDE_DICT=5035\nCHECK_WRONG_NAME=5036\nCHECK_NAME_NOT_NULL=5037\nI18N_NO_NAME=6000\nI18N_NO_HANDLER=6001\nI18N_EXCESS_HANDLER=6002\nI18N""_CONV_FAILED=6003\n";
static char __pyx_k_SCHEMAP_DEF_AND_PREFIX_1768_SCHE[] = "SCHEMAP_DEF_AND_PREFIX=1768\nSCHEMAP_UNKNOWN_INCLUDE_CHILD=1769\nSCHEMAP_INCLUDE_SCHEMA_NOT_URI=1770\nSCHEMAP_INCLUDE_SCHEMA_NO_URI=1771\nSCHEMAP_NOT_SCHEMA=1772\nSCHEMAP_UNKNOWN_MEMBER_TYPE=1773\nSCHEMAP_INVALID_ATTR_USE=1774\nSCHEMAP_RECURSIVE=1775\nSCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE=1776\nSCHEMAP_INVALID_ATTR_COMBINATION=1777\nSCHEMAP_INVALID_ATTR_INLINE_COMBINATION=1778\nSCHEMAP_MISSING_SIMPLETYPE_CHILD=1779\nSCHEMAP_INVALID_ATTR_NAME=1780\nSCHEMAP_REF_AND_CONTENT=1781\nSCHEMAP_CT_PROPS_CORRECT_1=1782\nSCHEMAP_CT_PROPS_CORRECT_2=1783\nSCHEMAP_CT_PROPS_CORRECT_3=1784\nSCHEMAP_CT_PROPS_CORRECT_4=1785\nSCHEMAP_CT_PROPS_CORRECT_5=1786\nSCHEMAP_DERIVATION_OK_RESTRICTION_1=1787\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1=1788\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2=1789\nSCHEMAP_DERIVATION_OK_RESTRICTION_2_2=1790\nSCHEMAP_DERIVATION_OK_RESTRICTION_3=1791\nSCHEMAP_WILDCARD_INVALID_NS_MEMBER=1792\nSCHEMAP_INTERSECTION_NOT_EXPRESSIBLE=1793\nSCHEMAP_UNION_NOT_EXPRESSIBLE=1794\nSCHEMAP_SRC_IMPORT_3_1=1795\nSCHEMAP_SRC_IMPORT_3_2=1796\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_1=1797\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_2=1798\nSCHEMAP_DERIVATION_OK_RESTRICTION_4_3=1799\nSCHEMAP_COS_CT_EXTENDS_1_3=1800\nSCHEMAV_NOROOT=1801\nSCHEMAV_UNDECLAREDELEM=1802\nSCHEMAV_NOTTOPLEVEL=1803\nSCHEMAV_MISSING=1804\nSCHEMAV_WRONGELEM=1805\nSCHEMAV_NOTYPE=1806\nSCHEMAV_NOROLLBACK=1807\nSCHEMAV_ISABSTRACT=1808\nSCHEMAV_NOTEMPTY=1809\nSCHEMAV_ELEMCONT=1810\nSCHEMAV_HAVEDEFAULT=1811\nSCHEMAV_NOTNILLABLE=1812\nSCHEMAV_EXTRACONTENT=1813\nSCHEMAV_INVALIDATTR=1814\nSCHEMAV_INVALIDELEM=1815\nSCHEMAV_NOTDETERMINIST=1816\nSCHEMAV_CONSTRUCT=1817\nSCHEMAV_INTERNAL=1818\nSCHEMAV_NOTSIMPLE=1819\nSCHEMAV_ATTRUNKNOWN=1820\nSCHEMAV_ATTRINVALID=1821\nSCHEMAV_VALUE=1822\nSCHEMAV_FACET=1823\nSCHEMAV_CVC_DATATYPE_VALID_1_2_1=1824\nSCHEMAV_CVC_DATATYPE_VALID_1_2_2=1825\nSCHEMAV_CVC_DATATYPE_VALID_1_2_3=1826\nSCHEMAV_CVC_TYPE_3_1_1=1827\nSCHEMAV_CVC_TYPE_3_1_2=1828\nSCHEMAV_CVC_FACET_VALID=1829\nSCHEMAV_CVC_LENGTH_VALID""=1830\n";
static char __pyx_k_SCHEMAP_EXTENSION_NO_BASE_1707_S[] = "SCHEMAP_EXTENSION_NO_BASE=1707\nSCHEMAP_FACET_NO_VALUE=1708\nSCHEMAP_FAILED_BUILD_IMPORT=1709\nSCHEMAP_GROUP_NONAME_NOREF=1710\nSCHEMAP_IMPORT_NAMESPACE_NOT_URI=1711\nSCHEMAP_IMPORT_REDEFINE_NSNAME=1712\nSCHEMAP_IMPORT_SCHEMA_NOT_URI=1713\nSCHEMAP_INVALID_BOOLEAN=1714\nSCHEMAP_INVALID_ENUM=1715\nSCHEMAP_INVALID_FACET=1716\nSCHEMAP_INVALID_FACET_VALUE=1717\nSCHEMAP_INVALID_MAXOCCURS=1718\nSCHEMAP_INVALID_MINOCCURS=1719\nSCHEMAP_INVALID_REF_AND_SUBTYPE=1720\nSCHEMAP_INVALID_WHITE_SPACE=1721\nSCHEMAP_NOATTR_NOREF=1722\nSCHEMAP_NOTATION_NO_NAME=1723\nSCHEMAP_NOTYPE_NOREF=1724\nSCHEMAP_REF_AND_SUBTYPE=1725\nSCHEMAP_RESTRICTION_NONAME_NOREF=1726\nSCHEMAP_SIMPLETYPE_NONAME=1727\nSCHEMAP_TYPE_AND_SUBTYPE=1728\nSCHEMAP_UNKNOWN_ALL_CHILD=1729\nSCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD=1730\nSCHEMAP_UNKNOWN_ATTR_CHILD=1731\nSCHEMAP_UNKNOWN_ATTRGRP_CHILD=1732\nSCHEMAP_UNKNOWN_ATTRIBUTE_GROUP=1733\nSCHEMAP_UNKNOWN_BASE_TYPE=1734\nSCHEMAP_UNKNOWN_CHOICE_CHILD=1735\nSCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD=1736\nSCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD=1737\nSCHEMAP_UNKNOWN_ELEM_CHILD=1738\nSCHEMAP_UNKNOWN_EXTENSION_CHILD=1739\nSCHEMAP_UNKNOWN_FACET_CHILD=1740\nSCHEMAP_UNKNOWN_FACET_TYPE=1741\nSCHEMAP_UNKNOWN_GROUP_CHILD=1742\nSCHEMAP_UNKNOWN_IMPORT_CHILD=1743\nSCHEMAP_UNKNOWN_LIST_CHILD=1744\nSCHEMAP_UNKNOWN_NOTATION_CHILD=1745\nSCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD=1746\nSCHEMAP_UNKNOWN_REF=1747\nSCHEMAP_UNKNOWN_RESTRICTION_CHILD=1748\nSCHEMAP_UNKNOWN_SCHEMAS_CHILD=1749\nSCHEMAP_UNKNOWN_SEQUENCE_CHILD=1750\nSCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD=1751\nSCHEMAP_UNKNOWN_SIMPLETYPE_CHILD=1752\nSCHEMAP_UNKNOWN_TYPE=1753\nSCHEMAP_UNKNOWN_UNION_CHILD=1754\nSCHEMAP_ELEM_DEFAULT_FIXED=1755\nSCHEMAP_REGEXP_INVALID=1756\nSCHEMAP_FAILED_LOAD=1757\nSCHEMAP_NOTHING_TO_PARSE=1758\nSCHEMAP_NOROOT=1759\nSCHEMAP_REDEFINED_GROUP=1760\nSCHEMAP_REDEFINED_TYPE=1761\nSCHEMAP_REDEFINED_ELEMENT=1762\nSCHEMAP_REDEFINED_ATTRGROUP=1763\nSCHEMAP_REDEFINED_ATTR=1764\nSCHEMAP_REDEFINED_NOTATION=1765\nSCHEMAP_FAILED_PARSE=1766\nSCH""EMAP_UNKNOWN_PREFIX=1767\n";
static char __pyx_k_SCHEMAP_SRC_RESOLVE_3004_SCHEMAP[] = "SCHEMAP_SRC_RESOLVE=3004\nSCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE=3005\nSCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE=3006\nSCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES=3007\nSCHEMAP_ST_PROPS_CORRECT_1=3008\nSCHEMAP_ST_PROPS_CORRECT_2=3009\nSCHEMAP_ST_PROPS_CORRECT_3=3010\nSCHEMAP_COS_ST_RESTRICTS_1_1=3011\nSCHEMAP_COS_ST_RESTRICTS_1_2=3012\nSCHEMAP_COS_ST_RESTRICTS_1_3_1=3013\nSCHEMAP_COS_ST_RESTRICTS_1_3_2=3014\nSCHEMAP_COS_ST_RESTRICTS_2_1=3015\nSCHEMAP_COS_ST_RESTRICTS_2_3_1_1=3016\nSCHEMAP_COS_ST_RESTRICTS_2_3_1_2=3017\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_1=3018\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_2=3019\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_3=3020\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_4=3021\nSCHEMAP_COS_ST_RESTRICTS_2_3_2_5=3022\nSCHEMAP_COS_ST_RESTRICTS_3_1=3023\nSCHEMAP_COS_ST_RESTRICTS_3_3_1=3024\nSCHEMAP_COS_ST_RESTRICTS_3_3_1_2=3025\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_2=3026\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_1=3027\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_3=3028\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_4=3029\nSCHEMAP_COS_ST_RESTRICTS_3_3_2_5=3030\nSCHEMAP_COS_ST_DERIVED_OK_2_1=3031\nSCHEMAP_COS_ST_DERIVED_OK_2_2=3032\nSCHEMAP_S4S_ELEM_NOT_ALLOWED=3033\nSCHEMAP_S4S_ELEM_MISSING=3034\nSCHEMAP_S4S_ATTR_NOT_ALLOWED=3035\nSCHEMAP_S4S_ATTR_MISSING=3036\nSCHEMAP_S4S_ATTR_INVALID_VALUE=3037\nSCHEMAP_SRC_ELEMENT_1=3038\nSCHEMAP_SRC_ELEMENT_2_1=3039\nSCHEMAP_SRC_ELEMENT_2_2=3040\nSCHEMAP_SRC_ELEMENT_3=3041\nSCHEMAP_P_PROPS_CORRECT_1=3042\nSCHEMAP_P_PROPS_CORRECT_2_1=3043\nSCHEMAP_P_PROPS_CORRECT_2_2=3044\nSCHEMAP_E_PROPS_CORRECT_2=3045\nSCHEMAP_E_PROPS_CORRECT_3=3046\nSCHEMAP_E_PROPS_CORRECT_4=3047\nSCHEMAP_E_PROPS_CORRECT_5=3048\nSCHEMAP_E_PROPS_CORRECT_6=3049\nSCHEMAP_SRC_INCLUDE=3050\nSCHEMAP_SRC_ATTRIBUTE_1=3051\nSCHEMAP_SRC_ATTRIBUTE_2=3052\nSCHEMAP_SRC_ATTRIBUTE_3_1=3053\nSCHEMAP_SRC_ATTRIBUTE_3_2=3054\nSCHEMAP_SRC_ATTRIBUTE_4=3055\nSCHEMAP_NO_XMLNS=3056\nSCHEMAP_NO_XSI=3057\nSCHEMAP_COS_VALID_DEFAULT_1=3058\nSCHEMAP_COS_VALID_DEFAULT_2_1=3059\nSCHEMAP_COS_VALID_DEFAULT_2_2_1=3060\nSCHEMAP_COS_VALID_DEFA""ULT_2_2_2=3061\n";
static char __pyx_k_SCHEMAV_CVC_MINLENGTH_VALID_1831[] = "SCHEMAV_CVC_MINLENGTH_VALID=1831\nSCHEMAV_CVC_MAXLENGTH_VALID=1832\nSCHEMAV_CVC_MININCLUSIVE_VALID=1833\nSCHEMAV_CVC_MAXINCLUSIVE_VALID=1834\nSCHEMAV_CVC_MINEXCLUSIVE_VALID=1835\nSCHEMAV_CVC_MAXEXCLUSIVE_VALID=1836\nSCHEMAV_CVC_TOTALDIGITS_VALID=1837\nSCHEMAV_CVC_FRACTIONDIGITS_VALID=1838\nSCHEMAV_CVC_PATTERN_VALID=1839\nSCHEMAV_CVC_ENUMERATION_VALID=1840\nSCHEMAV_CVC_COMPLEX_TYPE_2_1=1841\nSCHEMAV_CVC_COMPLEX_TYPE_2_2=1842\nSCHEMAV_CVC_COMPLEX_TYPE_2_3=1843\nSCHEMAV_CVC_COMPLEX_TYPE_2_4=1844\nSCHEMAV_CVC_ELT_1=1845\nSCHEMAV_CVC_ELT_2=1846\nSCHEMAV_CVC_ELT_3_1=1847\nSCHEMAV_CVC_ELT_3_2_1=1848\nSCHEMAV_CVC_ELT_3_2_2=1849\nSCHEMAV_CVC_ELT_4_1=1850\nSCHEMAV_CVC_ELT_4_2=1851\nSCHEMAV_CVC_ELT_4_3=1852\nSCHEMAV_CVC_ELT_5_1_1=1853\nSCHEMAV_CVC_ELT_5_1_2=1854\nSCHEMAV_CVC_ELT_5_2_1=1855\nSCHEMAV_CVC_ELT_5_2_2_1=1856\nSCHEMAV_CVC_ELT_5_2_2_2_1=1857\nSCHEMAV_CVC_ELT_5_2_2_2_2=1858\nSCHEMAV_CVC_ELT_6=1859\nSCHEMAV_CVC_ELT_7=1860\nSCHEMAV_CVC_ATTRIBUTE_1=1861\nSCHEMAV_CVC_ATTRIBUTE_2=1862\nSCHEMAV_CVC_ATTRIBUTE_3=1863\nSCHEMAV_CVC_ATTRIBUTE_4=1864\nSCHEMAV_CVC_COMPLEX_TYPE_3_1=1865\nSCHEMAV_CVC_COMPLEX_TYPE_3_2_1=1866\nSCHEMAV_CVC_COMPLEX_TYPE_3_2_2=1867\nSCHEMAV_CVC_COMPLEX_TYPE_4=1868\nSCHEMAV_CVC_COMPLEX_TYPE_5_1=1869\nSCHEMAV_CVC_COMPLEX_TYPE_5_2=1870\nSCHEMAV_ELEMENT_CONTENT=1871\nSCHEMAV_DOCUMENT_ELEMENT_MISSING=1872\nSCHEMAV_CVC_COMPLEX_TYPE_1=1873\nSCHEMAV_CVC_AU=1874\nSCHEMAV_CVC_TYPE_1=1875\nSCHEMAV_CVC_TYPE_2=1876\nSCHEMAV_CVC_IDC=1877\nSCHEMAV_CVC_WILDCARD=1878\nSCHEMAV_MISC=1879\nXPTR_UNKNOWN_SCHEME=1900\nXPTR_CHILDSEQ_START=1901\nXPTR_EVAL_FAILED=1902\nXPTR_EXTRA_OBJECTS=1903\nC14N_CREATE_CTXT=1950\nC14N_REQUIRES_UTF8=1951\nC14N_CREATE_STACK=1952\nC14N_INVALID_NODE=1953\nC14N_UNKNOW_NODE=1954\nC14N_RELATIVE_NAMESPACE=1955\nFTP_PASV_ANSWER=2000\nFTP_EPSV_ANSWER=2001\nFTP_ACCNT=2002\nFTP_URL_SYNTAX=2003\nHTTP_URL_SYNTAX=2020\nHTTP_USE_IP=2021\nHTTP_UNKNOWN_HOST=2022\nSCHEMAP_SRC_SIMPLE_TYPE_1=3000\nSCHEMAP_SRC_SIMPLE_TYPE_2=3001\nSCHEMAP_SRC_SIMPLE_TYPE_3=3002\nSCHE""MAP_SRC_SIMPLE_TYPE_4=3003\n";
static char __pyx_k_Schematron_instance_not_initiali[] = "Schematron instance not initialised";
static char __pyx_k_Serialisation_to_unicode_must_no[] = "Serialisation to unicode must not request an XML declaration";
static char __pyx_k_Syntax_error_while_parsing_an_XM[] = "Syntax error while parsing an XML document.\n\n    For compatibility with ElementTree 1.3 and later.\n    ";
static char __pyx_k_TREE_NOT_UTF8_1303_SAVE_NOT_UTF8[] = "TREE_NOT_UTF8=1303\nSAVE_NOT_UTF8=1400\nSAVE_CHAR_INVALID=1401\nSAVE_NO_DOCTYPE=1402\nSAVE_UNKNOWN_ENCODING=1403\nREGEXP_COMPILE_ERROR=1450\nIO_UNKNOWN=1500\nIO_EACCES=1501\nIO_EAGAIN=1502\nIO_EBADF=1503\nIO_EBADMSG=1504\nIO_EBUSY=1505\nIO_ECANCELED=1506\nIO_ECHILD=1507\nIO_EDEADLK=1508\nIO_EDOM=1509\nIO_EEXIST=1510\nIO_EFAULT=1511\nIO_EFBIG=1512\nIO_EINPROGRESS=1513\nIO_EINTR=1514\nIO_EINVAL=1515\nIO_EIO=1516\nIO_EISDIR=1517\nIO_EMFILE=1518\nIO_EMLINK=1519\nIO_EMSGSIZE=1520\nIO_ENAMETOOLONG=1521\nIO_ENFILE=1522\nIO_ENODEV=1523\nIO_ENOENT=1524\nIO_ENOEXEC=1525\nIO_ENOLCK=1526\nIO_ENOMEM=1527\nIO_ENOSPC=1528\nIO_ENOSYS=1529\nIO_ENOTDIR=1530\nIO_ENOTEMPTY=1531\nIO_ENOTSUP=1532\nIO_ENOTTY=1533\nIO_ENXIO=1534\nIO_EPERM=1535\nIO_EPIPE=1536\nIO_ERANGE=1537\nIO_EROFS=1538\nIO_ESPIPE=1539\nIO_ESRCH=1540\nIO_ETIMEDOUT=1541\nIO_EXDEV=1542\nIO_NETWORK_ATTEMPT=1543\nIO_ENCODER=1544\nIO_FLUSH=1545\nIO_WRITE=1546\nIO_NO_INPUT=1547\nIO_BUFFER_FULL=1548\nIO_LOAD_ERROR=1549\nIO_ENOTSOCK=1550\nIO_EISCONN=1551\nIO_ECONNREFUSED=1552\nIO_ENETUNREACH=1553\nIO_EADDRINUSE=1554\nIO_EALREADY=1555\nIO_EAFNOSUPPORT=1556\nXINCLUDE_RECURSION=1600\nXINCLUDE_PARSE_VALUE=1601\nXINCLUDE_ENTITY_DEF_MISMATCH=1602\nXINCLUDE_NO_HREF=1603\nXINCLUDE_NO_FALLBACK=1604\nXINCLUDE_HREF_URI=1605\nXINCLUDE_TEXT_FRAGMENT=1606\nXINCLUDE_TEXT_DOCUMENT=1607\nXINCLUDE_INVALID_CHAR=1608\nXINCLUDE_BUILD_FAILED=1609\nXINCLUDE_UNKNOWN_ENCODING=1610\nXINCLUDE_MULTIPLE_ROOT=1611\nXINCLUDE_XPTR_FAILED=1612\nXINCLUDE_XPTR_RESULT=1613\nXINCLUDE_INCLUDE_IN_INCLUDE=1614\nXINCLUDE_FALLBACKS_IN_INCLUDE=1615\nXINCLUDE_FALLBACK_NOT_IN_INCLUDE=1616\nXINCLUDE_DEPRECATED_NS=1617\nXINCLUDE_FRAGMENT_ID=1618\nCATALOG_MISSING_ATTR=1650\nCATALOG_ENTRY_BROKEN=1651\nCATALOG_PREFER_VALUE=1652\nCATALOG_NOT_CATALOG=1653\nCATALOG_RECURSION=1654\nSCHEMAP_PREFIX_UNDEFINED=1700\nSCHEMAP_ATTRFORMDEFAULT_VALUE=1701\nSCHEMAP_ATTRGRP_NONAME_NOREF=1702\nSCHEMAP_ATTR_NONAME_NOREF=1703\nSCHEMAP_COMPLEXTYPE_NONAME_NOREF=1704\nSCHEMAP_ELEMFORMDEFAULT_VALUE=""1705\nSCHEMAP_ELEM_NONAME_NOREF=1706\n";
static char __pyx_k_Text_after_this_element_s_end_ta[] = "Text after this element's end tag, but before the next sibling\n        element's start tag. This is either a string or the value None, if\n        there was no text.\n        ";
static char __pyx_k_Text_before_the_first_subelement[] = "Text before the first subelement. This is either a string or \n        the value None, if there was no text.\n        ";
static char __pyx_k_The_access_control_configuration[] = "The access control configuration as a map of options.";
static char __pyx_k_The_behavior_of_this_method_will[] = "The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.";
static char __pyx_k_The_error_log_of_the_last_or_cur[] = "The error log of the last (or current) run of the feed parser.\n\n        Note that this is local to the feed parser and thus is\n        different from what the ``error_log`` property returns.\n        ";
static char __pyx_k_The_error_log_of_the_last_parser[] = "The error log of the last parser run.\n        ";
static char __pyx_k_The_log_of_errors_and_warnings_o[] = "The log of errors and warnings of an XSLT execution.";
static char __pyx_k_The_log_of_validation_errors_and[] = "The log of validation errors and warnings.";
static char __pyx_k_The_lxml_etree_module_implements[] = "The ``lxml.etree`` module implements the extended ElementTree API\nfor XML.\n";
static char __pyx_k_The_name_of_the_error_domain_See[] = "The name of the error domain.  See lxml.etree.ErrorDomains\n        ";
static char __pyx_k_The_name_of_the_error_type_See_l[] = "The name of the error type.  See lxml.etree.ErrorTypes\n        ";
static char __pyx_k_The_parser_that_was_used_to_pars[] = "The parser that was used to parse the document in this ElementTree.\n        ";
static char __pyx_k_The_source_URL_of_the_document_o[] = "The source URL of the document (or None if unknown).";
static char __pyx_k_The_version_of_the_underlying_XM[] = "The version of the underlying XML parser.";
static char __pyx_k_This_class_cannot_be_instantiate[] = "This class cannot be instantiated";
static char __pyx_k_This_is_not_a_supported_node_set[] = "This is not a supported node-set result: %r";
static char __pyx_k_This_type_cannot_be_instantiated[] = "This type cannot be instantiated from Python";
static char __pyx_k_This_version_of_libxml2_has_a_kn[] = "This version of libxml2 has a known XPath bug. Use it at your own risk.";
static char __pyx_k_Tried_to_unregister_unknown_prox[] = "Tried to unregister unknown proxy";
static char __pyx_k_Unicode_parsing_is_not_supported[] = "Unicode parsing is not supported on this platform";
static char __pyx_k_Unicode_strings_with_encoding_de[] = "Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.";
static char __pyx_k_Validation_error_Raised_by_all_d[] = "Validation error.\n\n    Raised by all document validators when their ``assertValid(tree)``\n    method fails.\n    ";
static char __pyx_k_XInclude_instance_not_initialise[] = "XInclude instance not initialised";
static char __pyx_k_XML_text_parser_None_base_url_No[] = "XML(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string constant.\n    Returns the root node (or the result returned by a parser target).\n    This function can be used to embed \"XML literals\" in Python code,\n    like in\n\n       >>> root = XML(\"<root><test/></root>\")\n       >>> print(root.tag)\n       root\n\n    To override the parser with a different ``XMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static char __pyx_k_XPath_context_is_only_usable_dur[] = "XPath context is only usable during the evaluation";
static char __pyx_k_argument_must_be_a_byte_string_o[] = "argument must be a byte string or unicode string";
static char __pyx_k_attempt_to_assign_sequence_of_si[] = "attempt to assign sequence of size %d to extended slice of size %d";
static char __pyx_k_cannot_append_document_already_h[] = "cannot append, document already has a root element";
static char __pyx_k_cannot_append_trailing_element_t[] = "cannot append trailing element to complete XML document";
static char __pyx_k_comment_class_must_be_subclass_o[] = "comment class must be subclass of CommentBase";
static char __pyx_k_either_filename_or_external_ID_r[] = "either filename or external ID required";
static char __pyx_k_element_class_must_be_subclass_o[] = "element class must be subclass of ElementBase";
static char __pyx_k_empty_namespace_prefix_is_not_su[] = "empty namespace prefix is not supported in XPath";
static char __pyx_k_empty_prefix_is_not_supported_in[] = "empty prefix is not supported in XPath";
static char __pyx_k_extensions_must_have_non_empty_n[] = "extensions must have non empty names";
static char __pyx_k_extensions_must_not_have_empty_n[] = "extensions must not have empty namespaces";
static char __pyx_k_home_stefan_source_Python_lxml_2[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_3[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_4[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_5[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_6[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_7[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_8[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_9[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi";
static char __pyx_k_http_codespeak_net_lxml_objectif[] = "http://codespeak.net/lxml/objectify/pytype";
static char __pyx_k_http_exslt_org_regular_expressio[] = "http://exslt.org/regular-expressions";
static char __pyx_k_http_www_w3_org_1999_02_22_rdf_s[] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
static char __pyx_k_http_www_w3_org_1999_XSL_Transfo[] = "http://www.w3.org/1999/XSL/Transform";
static char __pyx_k_http_www_w3_org_2001_XMLSchema_i[] = "http://www.w3.org/2001/XMLSchema-instance";
static char __pyx_k_http_www_w3_org_XML_1998_namespa[] = "http://www.w3.org/XML/1998/namespace";
static char __pyx_k_inconsistent_exit_action_in_cont[] = "inconsistent exit action in context manager";
static char __pyx_k_passing_a_single_string_into_fro[] = "passing a single string into fromstringlist() is not efficient, use fromstring() instead";
static char __pyx_k_pop_expected_at_most_2_arguments[] = "pop expected at most 2 arguments, got %d";
static char __pyx_k_reading_file_objects_must_return[] = "reading file objects must return bytes objects";
static char __pyx_k_reading_from_file_like_objects_m[] = "reading from file-like objects must return byte strings or unicode strings";
static char __pyx_k_reference_to_non_existing_embedd[] = "reference to non-existing embedded stylesheet";
static char __pyx_k_result_of_class_lookup_must_be_s[] = "result of class lookup must be subclass of %s, got %s";
static char __pyx_k_setting_default_namespace_is_not[] = "setting default namespace is not supported in XPath";
static char __pyx_k_this_element_does_not_have_child[] = "this element does not have children or attributes";
static char __pyx_k_unsupported_element_type_for_top[] = "unsupported element type for top-level node: %d";
static char __pyx_k_The_custom_resolver_registry_of_2[] = "The custom resolver registry of the last (or current) parser run.\n        ";
static char __pyx_k_home_stefan_source_Python_lxml_10[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi";
static char __pyx_k_home_stefan_source_Python_lxml_11[] = "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi";
static char __pyx_k_Error_executing_extension_elemen_2[] = "Error executing extension element '%s'";
static char __pyx_k_Error_while_parsing_an_XML_docum_2[] = "Error while parsing an XML document as XML Schema.\n    ";
static char __pyx_k_Error_while_parsing_an_XML_docum_3[] = "Error while parsing an XML document as Schematron schema.\n    ";
static char __pyx_k_Error_while_validating_an_XML_do_2[] = "Error while validating an XML document with a RelaxNG schema.\n    ";
static char __pyx_k_Error_while_validating_an_XML_do_3[] = "Error while validating an XML document with an XML Schema.\n    ";
static char __pyx_k_Error_while_validating_an_XML_do_4[] = "Error while validating an XML document with a Schematron schema.\n    ";
static char __pyx_k_Returns_a_DTD_validator_based_on_2[] = "Returns a DTD validator based on the external subset of the document.";
static char __pyx_k_Syntax_error_while_parsing_an_XM_2[] = "Syntax error while parsing an XML document.\n    ";
static char __pyx_k_Text_before_the_first_subelement_2[] = "Text before the first subelement. This is either a string or the\n        value None, if there was no text.\n        ";
static char __pyx_k_The_error_log_of_the_last_or_cur_2[] = "The error log of the last (or current) parser run.\n        ";
static PyObject *__pyx_kp_u_0_9;
static PyObject *__pyx_n_b_A;
static PyObject *__pyx_n_b_ASCII;
static PyObject *__pyx_n_u_ASCII;
static PyObject *__pyx_kp_s_A_libxml2_error_that_occurred_du;
static PyObject *__pyx_kp_s_All_strings_must_be_XML_compatib;
static PyObject *__pyx_kp_u_Argument_is_not_a_file_like_obje;
static PyObject *__pyx_kp_s_Argument_must_be_bytes_or_unicod;
static PyObject *__pyx_kp_s_Argument_must_be_string_or_unico;
static PyObject *__pyx_n_s_AssertionError;
static PyObject *__pyx_n_s_AttributeBasedElementClassLookup;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_BaseException;
static PyObject *__pyx_kp_s_Base_class_for_DTD_errors;
static PyObject *__pyx_kp_s_Base_class_for_RelaxNG_errors;
static PyObject *__pyx_kp_s_Base_class_for_all_syntax_errors;
static PyObject *__pyx_kp_s_Base_class_of_all_Schematron_err;
static PyObject *__pyx_kp_s_Base_class_of_all_XML_Schema_err;
static PyObject *__pyx_kp_s_Base_class_of_all_XPath_errors;
static PyObject *__pyx_kp_s_Base_class_of_all_XSLT_errors;
static PyObject *__pyx_kp_s_Base_class_of_lxml_registry_erro;
static PyObject *__pyx_n_s_BytesIO;
static PyObject *__pyx_n_s_C14NError;
static PyObject *__pyx_kp_u_C14N_failed;
static PyObject *__pyx_n_s_CDATA;
static PyObject *__pyx_n_s_CRITICAL;
static PyObject *__pyx_kp_s_Can_only_discard_comments_in_C14;
static PyObject *__pyx_kp_s_Cannot_enable_XML_declaration_in;
static PyObject *__pyx_kp_u_Cannot_parse_stylesheet;
static PyObject *__pyx_kp_u_Cannot_resolve_URI_s;
static PyObject *__pyx_kp_s_Cannot_specify_encoding_with_C14;
static PyObject *__pyx_kp_b_Char_out_of_XML_range;
static PyObject *__pyx_n_s_Comment;
static PyObject *__pyx_n_s_CommentBase;
static PyObject *__pyx_kp_u_Could_not_create_I_O_writer_cont;
static PyObject *__pyx_kp_u_Could_not_find_root_node;
static PyObject *__pyx_n_s_CustomElementClassLookup;
static PyObject *__pyx_n_s_DEBUG;
static PyObject *__pyx_n_s_DENY_ALL;
static PyObject *__pyx_n_s_DENY_WRITE;
static PyObject *__pyx_kp_s_DOCTYPE_already_written_or_canno;
static PyObject *__pyx_kp_u_DOCTYPE_s;
static PyObject *__pyx_kp_u_DOCTYPE_s_PUBLIC_s;
static PyObject *__pyx_kp_u_DOCTYPE_s_PUBLIC_s_s;
static PyObject *__pyx_kp_u_DOCTYPE_s_SYSTEM_s;
static PyObject *__pyx_n_s_DTD;
static PyObject *__pyx_n_s_DTDError;
static PyObject *__pyx_n_s_DTDParseError;
static PyObject *__pyx_n_s_DTDValidateError;
static PyObject *__pyx_kp_s_DTD_not_initialised;
static PyObject *__pyx_n_s_DocumentInvalid;
static PyObject *__pyx_kp_u_Document_does_not_comply_with_sc;
static PyObject *__pyx_kp_u_Document_is_not_Relax_NG;
static PyObject *__pyx_kp_u_Document_is_not_XML_Schema;
static PyObject *__pyx_kp_u_Document_is_not_a_valid_Schematr;
static PyObject *__pyx_kp_u_Document_is_not_parsable_as_Rela;
static PyObject *__pyx_kp_u_Document_is_not_valid_Relax_NG;
static PyObject *__pyx_kp_u_Document_is_not_valid_XML_Schema;
static PyObject *__pyx_kp_u_Document_is_not_well_formed;
static PyObject *__pyx_n_s_ERROR;
static PyObject *__pyx_kp_u_ERR_ENCODING_NAME_79_ERR_HYPHEN;
static PyObject *__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER;
static PyObject *__pyx_n_s_ERR_UNDECLARED_ENTITY;
static PyObject *__pyx_n_s_ETCompatXMLParser;
static PyObject *__pyx_n_s_ETXPath;
static PyObject *__pyx_n_s_Element;
static PyObject *__pyx_n_s_ElementBase;
static PyObject *__pyx_n_s_ElementClassLookup;
static PyObject *__pyx_n_s_ElementDefaultClassLookup;
static PyObject *__pyx_n_s_ElementNamespaceClassLookup;
static PyObject *__pyx_n_s_ElementStringResult;
static PyObject *__pyx_n_s_ElementStringResult_getparent;
static PyObject *__pyx_n_s_ElementTree;
static PyObject *__pyx_kp_u_ElementTree_not_initialized_miss;
static PyObject *__pyx_kp_u_Element_is_not_a_child_of_this_n;
static PyObject *__pyx_kp_u_Element_is_not_in_this_tree;
static PyObject *__pyx_kp_u_Element_s_at_0x_x;
static PyObject *__pyx_kp_u_Empty_tag_name;
static PyObject *__pyx_kp_b_Encoding_error;
static PyObject *__pyx_n_s_Entity;
static PyObject *__pyx_n_s_EntityBase;
static PyObject *__pyx_kp_u_Entity_class_must_be_subclass_of;
static PyObject *__pyx_n_s_Error;
static PyObject *__pyx_n_s_ErrorDomains;
static PyObject *__pyx_n_s_ErrorLevels;
static PyObject *__pyx_n_s_ErrorTypes;
static PyObject *__pyx_kp_u_Error_applying_stylesheet;
static PyObject *__pyx_kp_u_Error_applying_stylesheet_line_d;
static PyObject *__pyx_kp_s_Error_during_C14N_serialisation;
static PyObject *__pyx_kp_s_Error_during_XInclude_processing;
static PyObject *__pyx_kp_s_Error_during_XPath_evaluation;
static PyObject *__pyx_kp_u_Error_during_serialisation_out_o;
static PyObject *__pyx_kp_s_Error_handling_an_XPath_result;
static PyObject *__pyx_kp_u_Error_in_xpath_expression;
static PyObject *__pyx_kp_s_Error_parsing_a_stylesheet_docum;
static PyObject *__pyx_kp_u_Error_reading_file_s_s;
static PyObject *__pyx_kp_u_Error_reading_s;
static PyObject *__pyx_kp_s_Error_registering_a_namespace_ex;
static PyObject *__pyx_kp_s_Error_registering_an_XSLT_extens;
static PyObject *__pyx_kp_s_Error_running_an_XSL_transformat;
static PyObject *__pyx_kp_s_Error_serialising_an_XSLT_result;
static PyObject *__pyx_kp_s_Error_while_parsing_a_DTD;
static PyObject *__pyx_kp_s_Error_while_parsing_an_XML_docum;
static PyObject *__pyx_kp_s_Error_while_parsing_an_XML_docum_2;
static PyObject *__pyx_kp_s_Error_while_parsing_an_XML_docum_3;
static PyObject *__pyx_kp_s_Error_while_validating_an_XML_do;
static PyObject *__pyx_kp_s_Error_while_validating_an_XML_do_2;
static PyObject *__pyx_kp_s_Error_while_validating_an_XML_do_3;
static PyObject *__pyx_kp_s_Error_while_validating_an_XML_do_4;
static PyObject *__pyx_n_s_Exception;
static PyObject *__pyx_kp_b_Expected_for_variable_reference;
static PyObject *__pyx_n_s_Extension;
static PyObject *__pyx_n_s_FATAL;
static PyObject *__pyx_kp_s_Failed_to_create_file_s;
static PyObject *__pyx_kp_u_Failed_to_create_validation_cont;
static PyObject *__pyx_n_s_FallbackElementClassLookup;
static PyObject *__pyx_kp_u_File_is_already_closed;
static PyObject *__pyx_kp_u_File_or_filename_expected_got_s;
static PyObject *__pyx_n_s_FunctionNamespace;
static PyObject *__pyx_kp_u_FunctionNamespace_r;
static PyObject *__pyx_n_s_FutureWarning;
static PyObject *__pyx_n_u_GlobalErrorLog;
static PyObject *__pyx_n_s_GzipFile;
static PyObject *__pyx_n_s_HTML;
static PyObject *__pyx_n_s_HTMLParser;
static PyObject *__pyx_kp_u_I18N_NO_OUTPUT_6004_BUF_OVERFLOW;
static PyObject *__pyx_kp_u_ID_attribute_not_found;
static PyObject *__pyx_n_s_IGNORECASE;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_kp_s_Illegal_Unicode_kind_d;
static PyObject *__pyx_n_s_ImmutableMapping;
static PyObject *__pyx_n_s_ImmutableMapping___contains;
static PyObject *__pyx_n_s_ImmutableMapping___delitem;
static PyObject *__pyx_n_s_ImmutableMapping___getitem;
static PyObject *__pyx_n_s_ImmutableMapping___iter;
static PyObject *__pyx_n_s_ImmutableMapping___len;
static PyObject *__pyx_n_s_ImmutableMapping___setitem;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_u_Input_object_has_no_document_s;
static PyObject *__pyx_kp_u_Input_object_has_no_element_s;
static PyObject *__pyx_kp_u_Internal_error_in_DTD_validation;
static PyObject *__pyx_kp_u_Internal_error_in_Relax_NG_valid;
static PyObject *__pyx_kp_u_Internal_error_in_Schematron_val;
static PyObject *__pyx_kp_u_Internal_error_in_XML_Schema_val;
static PyObject *__pyx_kp_s_Internal_error_looking_up_an_XPa;
static PyObject *__pyx_kp_s_Internal_lxml_parser_error;
static PyObject *__pyx_kp_u_Invalid_HTML_tag_name_r;
static PyObject *__pyx_kp_u_Invalid_URL_must_not_contain_or;
static PyObject *__pyx_kp_u_Invalid_attribute_dictionary_s;
static PyObject *__pyx_kp_u_Invalid_attribute_name_r;
static PyObject *__pyx_kp_u_Invalid_character_reference_s;
static PyObject *__pyx_kp_s_Invalid_child_type_r;
static PyObject *__pyx_kp_b_Invalid_context_position;
static PyObject *__pyx_kp_b_Invalid_context_size;
static PyObject *__pyx_kp_u_Invalid_entity_name_s;
static PyObject *__pyx_kp_u_Invalid_entity_reference_s;
static PyObject *__pyx_kp_b_Invalid_expression;
static PyObject *__pyx_kp_u_Invalid_input_object_s;
static PyObject *__pyx_kp_u_Invalid_input_tag_of_type_r;
static PyObject *__pyx_kp_u_Invalid_namespace_URI_r;
static PyObject *__pyx_kp_u_Invalid_namespace_prefix_r;
static PyObject *__pyx_kp_b_Invalid_number_of_arguments;
static PyObject *__pyx_kp_b_Invalid_operand;
static PyObject *__pyx_kp_b_Invalid_or_incomplete_context;
static PyObject *__pyx_kp_b_Invalid_predicate;
static PyObject *__pyx_kp_u_Invalid_tag_name;
static PyObject *__pyx_kp_u_Invalid_tag_name_r;
static PyObject *__pyx_kp_b_Invalid_type;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_LIBXML_COMPILED_VERSION;
static PyObject *__pyx_n_s_LIBXML_VERSION;
static PyObject *__pyx_n_s_LIBXSLT_COMPILED_VERSION;
static PyObject *__pyx_n_s_LIBXSLT_VERSION;
static PyObject *__pyx_n_s_LXML_VERSION;
static PyObject *__pyx_kp_s_Libxml2_RelaxNG_error_types;
static PyObject *__pyx_kp_s_Libxml2_error_domains;
static PyObject *__pyx_kp_s_Libxml2_error_levels;
static PyObject *__pyx_kp_s_Libxml2_error_types;
static PyObject *__pyx_n_s_LookupError;
static PyObject *__pyx_n_s_LxmlError;
static PyObject *__pyx_n_s_LxmlError___init;
static PyObject *__pyx_n_s_LxmlRegistryError;
static PyObject *__pyx_n_s_LxmlSyntaxError;
static PyObject *__pyx_kp_s_Main_exception_base_class_for_lx;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_b_Memory_allocation_error;
static PyObject *__pyx_kp_b_Missing_closing_curly_brace;
static PyObject *__pyx_n_s_MutableMapping;
static PyObject *__pyx_n_s_MutableMapping_keys;
static PyObject *__pyx_n_s_NAMESPACE;
static PyObject *__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE;
static PyObject *__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3;
static PyObject *__pyx_kp_u_Name_not_registered;
static PyObject *__pyx_n_s_NamespaceRegistryError;
static PyObject *__pyx_kp_u_Namespace_r;
static PyObject *__pyx_kp_u_No_ID_dictionary_available;
static PyObject *__pyx_kp_u_No_tree_or_file_given;
static PyObject *__pyx_kp_u_Node_must_not_be_None;
static PyObject *__pyx_kp_u_Non_Element_values_not_supported;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_u_Not_yet_implemented_result_node;
static PyObject *__pyx_kp_b_Number_encoding;
static PyObject *__pyx_n_b_Ok;
static PyObject *__pyx_kp_u_Only_elements_can_be_the_root_of;
static PyObject *__pyx_kp_u_Only_processing_instructions_and;
static PyObject *__pyx_n_s_OrderedDict;
static PyObject *__pyx_n_s_PARSER;
static PyObject *__pyx_n_s_PI;
static PyObject *__pyx_n_u_PI;
static PyObject *__pyx_n_s_PIBase;
static PyObject *__pyx_kp_u_PI_class_must_be_subclass_of_PIB;
static PyObject *__pyx_kp_u_PI_lacks_content;
static PyObject *__pyx_n_s_ParseError;
static PyObject *__pyx_n_s_ParseError___init;
static PyObject *__pyx_n_s_ParserBasedElementClassLookup;
static PyObject *__pyx_n_u_ParserDictionaryContext;
static PyObject *__pyx_n_s_ParserError;
static PyObject *__pyx_kp_s_ParserSchemaValidationContext_n;
static PyObject *__pyx_kp_u_Parsing_requires_string_data;
static PyObject *__pyx_kp_s_Prefix_format_reserved_for_inter;
static PyObject *__pyx_n_s_ProcessingInstruction;
static PyObject *__pyx_kp_s_Proxy_invalidated;
static PyObject *__pyx_kp_u_Proxy_invalidated;
static PyObject *__pyx_n_s_PyErrorLog;
static PyObject *__pyx_n_s_PythonElementClassLookup;
static PyObject *__pyx_n_s_QName;
static PyObject *__pyx_n_s_RELAXNGV;
static PyObject *__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY;
static PyObject *__pyx_kp_u_RNGP_ATTRIBUTE_CONTENT_1003_RNGP;
static PyObject *__pyx_kp_u_RNGP_PAT_DATA_EXCEPT_ONEMORE_107;
static PyObject *__pyx_n_s_ReferenceError;
static PyObject *__pyx_kp_u_Registered_element_classes_must;
static PyObject *__pyx_kp_u_Registered_functions_must_be_cal;
static PyObject *__pyx_n_s_RelaxNG;
static PyObject *__pyx_n_s_RelaxNGError;
static PyObject *__pyx_n_s_RelaxNGErrorTypes;
static PyObject *__pyx_n_s_RelaxNGParseError;
static PyObject *__pyx_n_s_RelaxNGValidateError;
static PyObject *__pyx_kp_s_RelaxNG_instance_not_initialised;
static PyObject *__pyx_n_s_Resolver;
static PyObject *__pyx_kp_b_Resource_error;
static PyObject *__pyx_kp_u_SCHEMAP_CVC_SIMPLE_TYPE_3062_SCH;
static PyObject *__pyx_kp_u_SCHEMAP_DEF_AND_PREFIX_1768_SCHE;
static PyObject *__pyx_kp_u_SCHEMAP_EXTENSION_NO_BASE_1707_S;
static PyObject *__pyx_kp_u_SCHEMAP_SRC_RESOLVE_3004_SCHEMAP;
static PyObject *__pyx_kp_u_SCHEMAV_CVC_MINLENGTH_VALID_1831;
static PyObject *__pyx_kp_s_Schema_instance_not_initialised;
static PyObject *__pyx_n_s_Schematron;
static PyObject *__pyx_n_s_SchematronError;
static PyObject *__pyx_n_s_SchematronParseError;
static PyObject *__pyx_n_s_SchematronValidateError;
static PyObject *__pyx_kp_s_Schematron_instance_not_initiali;
static PyObject *__pyx_n_s_SerialisationError;
static PyObject *__pyx_kp_u_Serialisation_to_unicode_must_no;
static PyObject *__pyx_kp_b_Stack_usage_error;
static PyObject *__pyx_kp_b_Start_of_literal;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_StringIO;
static PyObject *__pyx_n_s_SubElement;
static PyObject *__pyx_kp_b_Sub_resource_error;
static PyObject *__pyx_n_s_SyntaxError;
static PyObject *__pyx_kp_b_Syntax_error;
static PyObject *__pyx_kp_s_Syntax_error_while_parsing_an_XM;
static PyObject *__pyx_kp_s_Syntax_error_while_parsing_an_XM_2;
static PyObject *__pyx_n_s_TAG;
static PyObject *__pyx_kp_u_TREE_NOT_UTF8_1303_SAVE_NOT_UTF8;
static PyObject *__pyx_n_s_TargetParserResult;
static PyObject *__pyx_n_s_TargetParserResult___init;
static PyObject *__pyx_kp_u_The_behavior_of_this_method_will;
static PyObject *__pyx_kp_u_This_class_cannot_be_instantiate;
static PyObject *__pyx_kp_u_This_is_not_a_supported_node_set;
static PyObject *__pyx_kp_u_This_type_cannot_be_instantiated;
static PyObject *__pyx_kp_u_This_version_of_libxml2_has_a_kn;
static PyObject *__pyx_n_s_TreeBuilder;
static PyObject *__pyx_kp_u_Tried_to_unregister_unknown_prox;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_u_Type_s_cannot_be_serialized;
static PyObject *__pyx_n_s_U;
static PyObject *__pyx_n_s_UNICODE;
static PyObject *__pyx_kp_u_US_ASCII;
static PyObject *__pyx_n_u_UTF8;
static PyObject *__pyx_kp_s_UTF_8;
static PyObject *__pyx_kp_u_UTF_8;
static PyObject *__pyx_kp_b_Undefined_namespace_prefix;
static PyObject *__pyx_kp_b_Undefined_variable;
static PyObject *__pyx_kp_u_Undefined_xpath_result;
static PyObject *__pyx_kp_b_Unfinished_literal;
static PyObject *__pyx_n_s_UnicodeDecodeError;
static PyObject *__pyx_n_s_UnicodeEncodeError;
static PyObject *__pyx_kp_u_Unicode_parsing_is_not_supported;
static PyObject *__pyx_kp_u_Unicode_strings_with_encoding_de;
static PyObject *__pyx_kp_u_Unknown_libxml2_version_s;
static PyObject *__pyx_kp_u_Unknown_node_type_s;
static PyObject *__pyx_kp_u_Unknown_return_type_s;
static PyObject *__pyx_kp_u_Unknown_xpath_result_s;
static PyObject *__pyx_kp_b_Unregistered_function;
static PyObject *__pyx_kp_s_Unsupported_element_type_d;
static PyObject *__pyx_kp_s_Unsupported_node_type_d;
static PyObject *__pyx_n_s_UserDict;
static PyObject *__pyx_kp_s_Validation_error_Raised_by_all_d;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_WARNING;
static PyObject *__pyx_n_s_WAR_UNDECLARED_ENTITY;
static PyObject *__pyx_n_s_XInclude;
static PyObject *__pyx_n_s_XIncludeError;
static PyObject *__pyx_kp_s_XInclude_instance_not_initialise;
static PyObject *__pyx_kp_u_XInclude_processing_failed;
static PyObject *__pyx_n_s_XML;
static PyObject *__pyx_n_s_XMLDTDID;
static PyObject *__pyx_n_s_XMLID;
static PyObject *__pyx_n_s_XMLParser;
static PyObject *__pyx_n_s_XMLSchema;
static PyObject *__pyx_n_s_XMLSchemaError;
static PyObject *__pyx_n_s_XMLSchemaParseError;
static PyObject *__pyx_n_s_XMLSchemaValidateError;
static PyObject *__pyx_n_s_XMLSyntaxError;
static PyObject *__pyx_n_s_XMLTreeBuilder;
static PyObject *__pyx_kp_s_XML_declaration_already_written;
static PyObject *__pyx_kp_u_XML_line_2987;
static PyObject *__pyx_kp_u_XML_text_parser_None_base_url_No;
static PyObject *__pyx_n_u_XPATH_LOCATIONSET;
static PyObject *__pyx_n_u_XPATH_POINT;
static PyObject *__pyx_n_u_XPATH_RANGE;
static PyObject *__pyx_n_u_XPATH_USERS;
static PyObject *__pyx_n_s_XPath;
static PyObject *__pyx_n_s_XPathDocumentEvaluator;
static PyObject *__pyx_n_s_XPathError;
static PyObject *__pyx_n_s_XPathEvalError;
static PyObject *__pyx_n_s_XPathEvaluator;
static PyObject *__pyx_n_s_XPathFunctionError;
static PyObject *__pyx_n_s_XPathResultError;
static PyObject *__pyx_n_s_XPathSyntaxError;
static PyObject *__pyx_kp_u_XPath_context_is_only_usable_dur;
static PyObject *__pyx_kp_s_XPath_context_not_initialised;
static PyObject *__pyx_kp_u_XPath_evaluator_locking_failed;
static PyObject *__pyx_kp_s_XPath_evaluator_not_initialised;
static PyObject *__pyx_kp_u_XPath_function_s_not_found;
static PyObject *__pyx_n_s_XSLT;
static PyObject *__pyx_n_s_XSLTAccessControl;
static PyObject *__pyx_n_s_XSLTApplyError;
static PyObject *__pyx_n_s_XSLTError;
static PyObject *__pyx_n_s_XSLTExtension;
static PyObject *__pyx_n_s_XSLTExtensionError;
static PyObject *__pyx_n_s_XSLTParseError;
static PyObject *__pyx_n_s_XSLTSaveError;
static PyObject *__pyx_kp_s_XSLT_context_not_initialised;
static PyObject *__pyx_kp_s_XSLT_stylesheet_not_initialised;
static PyObject *__pyx_kp_u__14;
static PyObject *__pyx_kp_b__15;
static PyObject *__pyx_kp_s__15;
static PyObject *__pyx_kp_u__15;
static PyObject *__pyx_kp_b__201;
static PyObject *__pyx_kp_b__203;
static PyObject *__pyx_kp_s__21;
static PyObject *__pyx_kp_u__21;
static PyObject *__pyx_kp_b__24;
static PyObject *__pyx_kp_u__24;
static PyObject *__pyx_kp_b__25;
static PyObject *__pyx_kp_u__25;
static PyObject *__pyx_kp_u__3;
static PyObject *__pyx_kp_s__30;
static PyObject *__pyx_kp_b__34;
static PyObject *__pyx_kp_s__34;
static PyObject *__pyx_kp_s__35;
static PyObject *__pyx_kp_b__4;
static PyObject *__pyx_kp_s__4;
static PyObject *__pyx_kp_u__4;
static PyObject *__pyx_n_s__46;
static PyObject *__pyx_n_u__46;
static PyObject *__pyx_kp_u__53;
static PyObject *__pyx_kp_b__60;
static PyObject *__pyx_kp_u__63;
static PyObject *__pyx_kp_u__92;
static PyObject *__pyx_n_s_abspath;
static PyObject *__pyx_n_s_accepted_domains;
static PyObject *__pyx_n_s_access_control;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_u_alpha;
static PyObject *__pyx_kp_u_ambiguous_reference_to_embedded;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_append_log_message;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_kp_s_argument_must_be_a_byte_string_o;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_u_ascii;
static PyObject *__pyx_kp_u_attempt_to_assign_sequence_of_si;
static PyObject *__pyx_n_s_attrib;
static PyObject *__pyx_n_s_attribute_defaults;
static PyObject *__pyx_n_s_attribute_name;
static PyObject *__pyx_n_s_attribute_names;
static PyObject *__pyx_n_s_attrname;
static PyObject *__pyx_n_s_attrs;
static PyObject *__pyx_n_s_base_url;
static PyObject *__pyx_n_u_beta;
static PyObject *__pyx_n_s_block_count;
static PyObject *__pyx_kp_u_boolean_xs_attribute_default_or;
static PyObject *__pyx_n_s_build_smart_strings;
static PyObject *__pyx_n_s_builtin;
static PyObject *__pyx_n_s_builtins;
static PyObject *__pyx_n_s_byte_count;
static PyObject *__pyx_n_s_c14n;
static PyObject *__pyx_n_s_c_doc;
static PyObject *__pyx_n_s_c_name;
static PyObject *__pyx_n_s_c_next;
static PyObject *__pyx_n_s_c_node;
static PyObject *__pyx_n_s_c_node_copy;
static PyObject *__pyx_n_s_c_ns_tags;
static PyObject *__pyx_n_s_c_tag_count;
static PyObject *__pyx_kp_u_can_only_parse_strings;
static PyObject *__pyx_kp_u_cannot_append_document_already_h;
static PyObject *__pyx_kp_s_cannot_append_parent_to_itself;
static PyObject *__pyx_kp_s_cannot_append_trailing_element_t;
static PyObject *__pyx_kp_u_cannot_assign_None;
static PyObject *__pyx_kp_u_cannot_parse_from_s;
static PyObject *__pyx_kp_s_cannot_set_a_maximum_stylesheet;
static PyObject *__pyx_n_s_cdata;
static PyObject *__pyx_n_s_child;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_class_mapping;
static PyObject *__pyx_n_s_cleanup_namespaces;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_clear_error_log;
static PyObject *__pyx_n_s_clear_error_log_2;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_close_file;
static PyObject *__pyx_n_s_code;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_collections_abc;
static PyObject *__pyx_n_s_column;
static PyObject *__pyx_n_s_comment;
static PyObject *__pyx_n_u_comment;
static PyObject *__pyx_kp_u_comment_class_must_be_subclass_o;
static PyObject *__pyx_n_s_compact;
static PyObject *__pyx_n_s_compile;
static PyObject *__pyx_n_s_compression;
static PyObject *__pyx_n_s_compresslevel;
static PyObject *__pyx_n_s_contains;
static PyObject *__pyx_n_s_context;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_copy_2;
static PyObject *__pyx_n_s_create_dir;
static PyObject *__pyx_n_u_create_dir;
static PyObject *__pyx_n_s_ctxt;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_b_dc;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_default_resolver;
static PyObject *__pyx_n_s_default_value;
static PyObject *__pyx_n_s_delitem;
static PyObject *__pyx_n_u_dev;
static PyObject *__pyx_n_s_dic;
static PyObject *__pyx_n_u_dict;
static PyObject *__pyx_n_s_discard;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_doc_2;
static PyObject *__pyx_n_s_doc_3;
static PyObject *__pyx_n_s_docformat;
static PyObject *__pyx_n_s_docstring;
static PyObject *__pyx_n_s_doctype;
static PyObject *__pyx_kp_u_document_context_is_missing;
static PyObject *__pyx_kp_u_document_external_context_nodes;
static PyObject *__pyx_n_s_domain;
static PyObject *__pyx_n_s_domain_name;
static PyObject *__pyx_n_s_domains;
static PyObject *__pyx_kp_u_double_registering_proxy;
static PyObject *__pyx_n_s_dtd_validation;
static PyObject *__pyx_n_s_dump;
static PyObject *__pyx_kp_u_either_filename_or_external_ID_r;
static PyObject *__pyx_n_s_elem;
static PyObject *__pyx_n_s_element;
static PyObject *__pyx_n_u_element;
static PyObject *__pyx_kp_u_element_class_must_be_subclass_o;
static PyObject *__pyx_n_s_element_config;
static PyObject *__pyx_n_s_element_factory;
static PyObject *__pyx_n_s_element_or_tree;
static PyObject *__pyx_n_s_elementpath;
static PyObject *__pyx_n_s_elements_only;
static PyObject *__pyx_n_s_elemname;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_kp_u_empty_namespace_prefix_is_not_su;
static PyObject *__pyx_kp_u_empty_prefix_is_not_supported_in;
static PyObject *__pyx_n_s_enable_regexp;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encoding;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_u_end;
static PyObject *__pyx_kp_s_end_ns;
static PyObject *__pyx_kp_u_end_ns;
static PyObject *__pyx_kp_u_end_tag_mismatch_expected_s_got;
static PyObject *__pyx_n_s_entities;
static PyObject *__pyx_n_s_entity;
static PyObject *__pyx_n_u_entity;
static PyObject *__pyx_n_s_entries;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_enumeration;
static PyObject *__pyx_n_s_error_log;
static PyObject *__pyx_kp_u_error_parsing_DTD;
static PyObject *__pyx_n_s_etree;
static PyObject *__pyx_n_s_etree_or_element;
static PyObject *__pyx_n_s_etree_or_element_2;
static PyObject *__pyx_n_s_eval_arg;
static PyObject *__pyx_n_s_events;
static PyObject *__pyx_n_s_exc_context;
static PyObject *__pyx_n_s_exc_info;
static PyObject *__pyx_n_s_exc_tb;
static PyObject *__pyx_n_s_exc_type;
static PyObject *__pyx_n_s_exc_val;
static PyObject *__pyx_n_s_exclusive;
static PyObject *__pyx_n_s_execute;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_kp_u_extension_element_s_not_found;
static PyObject *__pyx_n_s_extensions;
static PyObject *__pyx_kp_u_extensions_must_have_non_empty_n;
static PyObject *__pyx_kp_u_extensions_must_not_have_empty_n;
static PyObject *__pyx_n_s_external_id;
static PyObject *__pyx_n_s_extra;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_fallback;
static PyObject *__pyx_n_s_feed;
static PyObject *__pyx_n_s_feed_error_log;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_kp_u_file_must_be_a_filename_or_file;
static PyObject *__pyx_n_s_filelike;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_fileobj;
static PyObject *__pyx_n_s_filter_from_errors;
static PyObject *__pyx_n_s_filter_from_level;
static PyObject *__pyx_n_s_filter_types;
static PyObject *__pyx_n_s_find;
static PyObject *__pyx_n_s_findall;
static PyObject *__pyx_n_s_findtext;
static PyObject *__pyx_n_s_first_error;
static PyObject *__pyx_n_s_fixed;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_for_html;
static PyObject *__pyx_n_s_fromstring;
static PyObject *__pyx_n_s_fromstringlist;
static PyObject *__pyx_n_s_function_mapping;
static PyObject *__pyx_n_s_function_name;
static PyObject *__pyx_n_s_functions;
static PyObject *__pyx_n_u_g;
static PyObject *__pyx_kp_u_g_1_g_2;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_getName;
static PyObject *__pyx_n_s_get_default_parser;
static PyObject *__pyx_n_s_getargspec;
static PyObject *__pyx_n_s_getattribute;
static PyObject *__pyx_n_s_getchildren;
static PyObject *__pyx_n_s_getdefaultencoding;
static PyObject *__pyx_n_s_getfilesystemencoding;
static PyObject *__pyx_n_s_getitem;
static PyObject *__pyx_n_s_getiterator;
static PyObject *__pyx_n_s_getnext;
static PyObject *__pyx_n_s_getparent;
static PyObject *__pyx_n_s_getroot;
static PyObject *__pyx_n_s_geturl;
static PyObject *__pyx_n_s_getvalue;
static PyObject *__pyx_n_u_getvalue;
static PyObject *__pyx_kp_s_got_invalid_input_value_of_type;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_s_groups;
static PyObject *__pyx_n_s_gzip;
static PyObject *__pyx_n_s_has_raised;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_10;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_11;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_2;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_3;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_4;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_5;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_6;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_7;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_8;
static PyObject *__pyx_kp_s_home_stefan_source_Python_lxml_9;
static PyObject *__pyx_n_u_href;
static PyObject *__pyx_kp_u_href_s;
static PyObject *__pyx_n_b_html;
static PyObject *__pyx_n_s_html;
static PyObject *__pyx_kp_b_http_codespeak_net_lxml_objectif;
static PyObject *__pyx_kp_b_http_exslt_org_regular_expressio;
static PyObject *__pyx_kp_b_http_purl_org_dc_elements_1_1;
static PyObject *__pyx_kp_b_http_schemas_xmlsoap_org_wsdl;
static PyObject *__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s;
static PyObject *__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo;
static PyObject *__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo;
static PyObject *__pyx_kp_b_http_www_w3_org_1999_xhtml;
static PyObject *__pyx_kp_b_http_www_w3_org_2001_XMLSchema;
static PyObject *__pyx_kp_u_http_www_w3_org_2001_XMLSchema;
static PyObject *__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i;
static PyObject *__pyx_kp_b_http_www_w3_org_XML_1998_namespa;
static PyObject *__pyx_n_s_huge_tree;
static PyObject *__pyx_n_u_i;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_u_id;
static PyObject *__pyx_n_s_idref;
static PyObject *__pyx_n_s_idrefs;
static PyObject *__pyx_n_s_implied;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_inclusive;
static PyObject *__pyx_n_s_inclusive_ns_prefixes;
static PyObject *__pyx_kp_s_inconsistent_exit_action_in_cont;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_kp_u_index_out_of_range_d;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init_2;
static PyObject *__pyx_n_s_input;
static PyObject *__pyx_n_s_input_node;
static PyObject *__pyx_n_s_inspect;
static PyObject *__pyx_kp_u_internal_error_tail;
static PyObject *__pyx_kp_u_internal_error_text;
static PyObject *__pyx_kp_u_invalid_DTD_proxy_at_s;
static PyObject *__pyx_kp_u_invalid_Document_proxy_at_s;
static PyObject *__pyx_kp_u_invalid_Element_proxy_at_s;
static PyObject *__pyx_kp_u_invalid_argument_type_s;
static PyObject *__pyx_kp_u_invalid_element;
static PyObject *__pyx_kp_u_invalid_event_name_s;
static PyObject *__pyx_kp_u_invalid_node_type_d_expected_d;
static PyObject *__pyx_n_s_io;
static PyObject *__pyx_n_s_is_attribute;
static PyObject *__pyx_n_s_is_standalone;
static PyObject *__pyx_n_s_is_tail;
static PyObject *__pyx_n_s_is_text;
static PyObject *__pyx_n_s_iselement;
static PyObject *__pyx_n_s_islice;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_u_items;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_iter_2;
static PyObject *__pyx_n_s_iterattributes;
static PyObject *__pyx_n_s_iterelements;
static PyObject *__pyx_n_s_iterentities;
static PyObject *__pyx_n_s_iterfind;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_iterkeys;
static PyObject *__pyx_n_s_iterparse;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_itervalues;
static PyObject *__pyx_n_s_iterwalk;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_kp_u_key_not_found;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_last_error;
static PyObject *__pyx_n_s_len;
static PyObject *__pyx_n_s_level;
static PyObject *__pyx_n_s_level_name;
static PyObject *__pyx_kp_u_libxml2_d_d_d;
static PyObject *__pyx_n_s_line;
static PyObject *__pyx_kp_u_line_d_s;
static PyObject *__pyx_kp_u_list_index_out_of_range;
static PyObject *__pyx_kp_u_list_index_x_x_not_in_list;
static PyObject *__pyx_kp_u_list_index_x_x_not_in_slice;
static PyObject *__pyx_n_s_load_dtd;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_log_entry;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_logger_name;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_lookup;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_lxml;
static PyObject *__pyx_n_s_lxml_etree;
static PyObject *__pyx_kp_u_lxml_etree_was_compiled_without;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_makeelement;
static PyObject *__pyx_kp_u_malformed_PI_attributes;
static PyObject *__pyx_n_b_match;
static PyObject *__pyx_n_s_match;
static PyObject *__pyx_n_u_match;
static PyObject *__pyx_n_s_matcher;
static PyObject *__pyx_n_u_matches;
static PyObject *__pyx_n_s_max_depth;
static PyObject *__pyx_n_s_max_len;
static PyObject *__pyx_n_s_memory_debugger;
static PyObject *__pyx_kp_b_memorydump;
static PyObject *__pyx_kp_b_memorylist;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_method;
static PyObject *__pyx_kp_u_missing_end_tags;
static PyObject *__pyx_kp_u_missing_toplevel_element;
static PyObject *__pyx_n_s_mixed;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_module_2;
static PyObject *__pyx_n_s_mult;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_name_utf;
static PyObject *__pyx_n_s_names;
static PyObject *__pyx_n_s_namespace;
static PyObject *__pyx_n_s_namespaces;
static PyObject *__pyx_n_s_new_element;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_nmtoken;
static PyObject *__pyx_n_s_nmtokens;
static PyObject *__pyx_kp_s_no_content_written;
static PyObject *__pyx_kp_u_no_context_node;
static PyObject *__pyx_kp_u_no_element_found;
static PyObject *__pyx_n_s_no_network;
static PyObject *__pyx_n_s_node;
static PyObject *__pyx_n_s_none;
static PyObject *__pyx_kp_s_not_in_an_element;
static PyObject *__pyx_n_s_notation;
static PyObject *__pyx_n_s_ns;
static PyObject *__pyx_n_s_ns_clean;
static PyObject *__pyx_kp_s_ns_d;
static PyObject *__pyx_kp_b_ns_d_2;
static PyObject *__pyx_n_s_ns_tags;
static PyObject *__pyx_n_s_ns_uri;
static PyObject *__pyx_n_s_ns_utf;
static PyObject *__pyx_n_s_nsmap;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_occur;
static PyObject *__pyx_n_s_old_element;
static PyObject *__pyx_n_s_once;
static PyObject *__pyx_kp_u_only_setting_the_href_attribute;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_opt;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_or;
static PyObject *__pyx_n_s_os_path;
static PyObject *__pyx_n_s_outfile;
static PyObject *__pyx_n_s_output_file;
static PyObject *__pyx_n_s_output_parent;
static PyObject *__pyx_n_s_parent;
static PyObject *__pyx_n_s_parse;
static PyObject *__pyx_n_s_parse_options;
static PyObject *__pyx_n_s_parseid;
static PyObject *__pyx_n_s_parser;
static PyObject *__pyx_kp_u_parser_locking_failed;
static PyObject *__pyx_kp_s_passing_a_single_string_into_fro;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_path_2;
static PyObject *__pyx_n_s_pcdata;
static PyObject *__pyx_kp_s_pending_open_tags_on_close;
static PyObject *__pyx_n_s_pi;
static PyObject *__pyx_n_s_plus;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_kp_u_pop_expected_at_most_2_arguments;
static PyObject *__pyx_n_s_position;
static PyObject *__pyx_n_s_preceding;
static PyObject *__pyx_n_s_prefix;
static PyObject *__pyx_n_s_prefix_utf;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_pretty_print;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_profile_run;
static PyObject *__pyx_n_s_public_id;
static PyObject *__pyx_n_b_py;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_rb;
static PyObject *__pyx_n_b_rdf;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_read;
static PyObject *__pyx_n_u_read;
static PyObject *__pyx_n_s_read_events;
static PyObject *__pyx_n_s_read_file;
static PyObject *__pyx_n_u_read_file;
static PyObject *__pyx_n_s_read_network;
static PyObject *__pyx_n_u_read_network;
static PyObject *__pyx_kp_s_reading_file_objects_must_return;
static PyObject *__pyx_kp_u_reading_from_file_like_objects_m;
static PyObject *__pyx_n_s_receive;
static PyObject *__pyx_n_s_recover;
static PyObject *__pyx_kp_u_reference_to_non_existing_embedd;
static PyObject *__pyx_n_s_regexp;
static PyObject *__pyx_n_s_register_namespace;
static PyObject *__pyx_n_s_registry;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_remove_blank_text;
static PyObject *__pyx_n_s_remove_comments;
static PyObject *__pyx_n_s_remove_pis;
static PyObject *__pyx_n_b_replace;
static PyObject *__pyx_n_s_replace;
static PyObject *__pyx_n_s_replacement;
static PyObject *__pyx_n_s_required;
static PyObject *__pyx_n_s_resolve;
static PyObject *__pyx_n_s_resolve_entities;
static PyObject *__pyx_n_s_resolvers;
static PyObject *__pyx_kp_u_restructuredtext_en;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_result_container;
static PyObject *__pyx_kp_s_result_of_class_lookup_must_be_s;
static PyObject *__pyx_n_s_reversed;
static PyObject *__pyx_n_s_rexp;
static PyObject *__pyx_n_s_root;
static PyObject *__pyx_kp_u_s;
static PyObject *__pyx_kp_u_s_2;
static PyObject *__pyx_kp_u_s_3;
static PyObject *__pyx_n_s_s_4;
static PyObject *__pyx_kp_u_s_a_zA_Z0_9__s_s_0_9;
static PyObject *__pyx_kp_u_s_d_d_s_s_s_s;
static PyObject *__pyx_kp_u_s_href_s_s;
static PyObject *__pyx_kp_u_s_line_d;
static PyObject *__pyx_kp_u_s_line_d_column_d;
static PyObject *__pyx_kp_u_s_r;
static PyObject *__pyx_kp_u_s_s_2;
static PyObject *__pyx_kp_u_s_s_3;
static PyObject *__pyx_kp_u_s_s_4;
static PyObject *__pyx_kp_s_s_s_object_name_r_at_0x_x;
static PyObject *__pyx_kp_s_s_s_object_name_r_elemname_r_pr;
static PyObject *__pyx_kp_s_s_s_object_name_r_prefix_r_type;
static PyObject *__pyx_kp_s_s_s_object_name_r_type_r_occur;
static PyObject *__pyx_kp_u_s_w_s_s;
static PyObject *__pyx_n_s_schema;
static PyObject *__pyx_n_s_search;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_self_node;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_seq;
static PyObject *__pyx_n_s_set_default_parser;
static PyObject *__pyx_n_s_set_element_class_lookup;
static PyObject *__pyx_n_s_set_global_max_depth;
static PyObject *__pyx_n_s_setitem;
static PyObject *__pyx_kp_u_setting_default_namespace_is_not;
static PyObject *__pyx_n_s_smart_strings;
static PyObject *__pyx_n_s_sorted;
static PyObject *__pyx_n_s_source;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_standalone;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_u_start;
static PyObject *__pyx_kp_s_start_ns;
static PyObject *__pyx_kp_u_start_ns;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_stdout;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_store_exception;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_kp_u_string;
static PyObject *__pyx_n_s_string_2;
static PyObject *__pyx_kp_u_string___STRING__XSLT___d_xslt;
static PyObject *__pyx_kp_u_string_id;
static PyObject *__pyx_n_s_strings;
static PyObject *__pyx_n_s_strip;
static PyObject *__pyx_n_s_strip_attributes;
static PyObject *__pyx_n_s_strip_cdata;
static PyObject *__pyx_n_s_strip_comments;
static PyObject *__pyx_n_s_strip_elements;
static PyObject *__pyx_n_s_strip_entities;
static PyObject *__pyx_n_s_strip_pis;
static PyObject *__pyx_n_s_strip_tags;
static PyObject *__pyx_n_s_strparam;
static PyObject *__pyx_n_s_strval;
static PyObject *__pyx_n_s_sub;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_system_url;
static PyObject *__pyx_n_s_tag;
static PyObject *__pyx_n_s_tag_2;
static PyObject *__pyx_n_s_tag_names;
static PyObject *__pyx_n_s_tags;
static PyObject *__pyx_n_s_tail;
static PyObject *__pyx_n_s_target;
static PyObject *__pyx_n_s_tell;
static PyObject *__pyx_n_u_tell;
static PyObject *__pyx_n_b_test;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_test_2;
static PyObject *__pyx_n_s_text;
static PyObject *__pyx_n_s_text_or_uri_or_element;
static PyObject *__pyx_kp_s_text_root;
static PyObject *__pyx_kp_u_this_element_does_not_have_child;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_tostring;
static PyObject *__pyx_n_s_tostringlist;
static PyObject *__pyx_n_s_tounicode;
static PyObject *__pyx_n_s_tree;
static PyObject *__pyx_n_s_tree_or_element;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_n_s_type_name;
static PyObject *__pyx_kp_u_undecodable_error_message;
static PyObject *__pyx_n_s_undefined;
static PyObject *__pyx_n_s_unicode;
static PyObject *__pyx_n_u_unicode;
static PyObject *__pyx_n_s_unicode_2;
static PyObject *__pyx_n_u_unknown;
static PyObject *__pyx_kp_u_unknown_encoding_s;
static PyObject *__pyx_kp_u_unknown_error;
static PyObject *__pyx_kp_u_unknown_error_d;
static PyObject *__pyx_kp_u_unknown_output_method_r;
static PyObject *__pyx_kp_u_unsupported_XSLT_result_type_d;
static PyObject *__pyx_kp_u_unsupported_element_type_for_top;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_uri;
static PyObject *__pyx_n_s_uri_utf;
static PyObject *__pyx_n_s_url;
static PyObject *__pyx_n_s_use_global_python_log;
static PyObject *__pyx_n_s_utf8;
static PyObject *__pyx_n_u_utf8;
static PyObject *__pyx_kp_u_utf_8;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_validate;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_variables;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_version_2;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_wb;
static PyObject *__pyx_n_s_with_comments;
static PyObject *__pyx_n_s_with_tail;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_write_declaration;
static PyObject *__pyx_n_s_write_file;
static PyObject *__pyx_n_u_write_file;
static PyObject *__pyx_n_s_write_network;
static PyObject *__pyx_n_u_write_network;
static PyObject *__pyx_n_s_writer;
static PyObject *__pyx_n_b_wsdl;
static PyObject *__pyx_n_b_xml;
static PyObject *__pyx_n_s_xml;
static PyObject *__pyx_n_u_xml;
static PyObject *__pyx_n_s_xml_declaration;
static PyObject *__pyx_kp_u_xml_s_encoding_s_s_s;
static PyObject *__pyx_n_b_xmlns;
static PyObject *__pyx_n_s_xpath_name;
static PyObject *__pyx_n_s_xrange;
static PyObject *__pyx_n_b_xs;
static PyObject *__pyx_n_u_xs;
static PyObject *__pyx_n_b_xsi;
static PyObject *__pyx_n_b_xsl;
static PyObject *__pyx_n_u_xsl;
static PyObject *__pyx_kp_u_xsl_stylesheet_xml_id_id;
static PyObject *__pyx_n_s_xslt_2;
static PyObject *__pyx_n_s_xslt_input;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_32768;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_neg_100;
static PyObject *__pyx_int_neg_200;
static PyObject *__pyx_int_neg_300;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__7;
static PyObject *__pyx_slice__9;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_slice__11;
static PyObject *__pyx_slice__13;
static PyObject *__pyx_slice__29;
static PyObject *__pyx_slice__31;
static PyObject *__pyx_slice__32;
static PyObject *__pyx_slice__33;
static PyObject *__pyx_slice__43;
static PyObject *__pyx_slice__45;
static PyObject *__pyx_slice__66;
static PyObject *__pyx_slice__67;
static PyObject *__pyx_slice__69;
static PyObject *__pyx_slice__84;
static PyObject *__pyx_slice__85;
static PyObject *__pyx_slice__90;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__100;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__132;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_tuple__148;
static PyObject *__pyx_tuple__150;
static PyObject *__pyx_tuple__152;
static PyObject *__pyx_tuple__154;
static PyObject *__pyx_tuple__156;
static PyObject *__pyx_tuple__158;
static PyObject *__pyx_tuple__160;
static PyObject *__pyx_tuple__162;
static PyObject *__pyx_tuple__164;
static PyObject *__pyx_tuple__166;
static PyObject *__pyx_tuple__168;
static PyObject *__pyx_tuple__170;
static PyObject *__pyx_tuple__172;
static PyObject *__pyx_tuple__174;
static PyObject *__pyx_tuple__177;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__182;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__192;
static PyObject *__pyx_tuple__194;
static PyObject *__pyx_tuple__195;
static PyObject *__pyx_tuple__197;
static PyObject *__pyx_tuple__199;
static PyObject *__pyx_tuple__202;
static PyObject *__pyx_tuple__204;
static PyObject *__pyx_tuple__205;
static PyObject *__pyx_tuple__207;
static PyObject *__pyx_tuple__209;
static PyObject *__pyx_tuple__210;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__131;
static PyObject *__pyx_codeobj__137;
static PyObject *__pyx_codeobj__139;
static PyObject *__pyx_codeobj__141;
static PyObject *__pyx_codeobj__143;
static PyObject *__pyx_codeobj__145;
static PyObject *__pyx_codeobj__147;
static PyObject *__pyx_codeobj__149;
static PyObject *__pyx_codeobj__151;
static PyObject *__pyx_codeobj__153;
static PyObject *__pyx_codeobj__155;
static PyObject *__pyx_codeobj__157;
static PyObject *__pyx_codeobj__159;
static PyObject *__pyx_codeobj__161;
static PyObject *__pyx_codeobj__163;
static PyObject *__pyx_codeobj__165;
static PyObject *__pyx_codeobj__167;
static PyObject *__pyx_codeobj__169;
static PyObject *__pyx_codeobj__171;
static PyObject *__pyx_codeobj__173;
static PyObject *__pyx_codeobj__175;
static PyObject *__pyx_codeobj__176;
static PyObject *__pyx_codeobj__179;
static PyObject *__pyx_codeobj__181;
static PyObject *__pyx_codeobj__183;
static PyObject *__pyx_codeobj__185;
static PyObject *__pyx_codeobj__187;
static PyObject *__pyx_codeobj__189;
static PyObject *__pyx_codeobj__191;
static PyObject *__pyx_codeobj__193;
static PyObject *__pyx_codeobj__196;
static PyObject *__pyx_codeobj__198;
static PyObject *__pyx_codeobj__200;
static PyObject *__pyx_codeobj__206;
static PyObject *__pyx_codeobj__208;

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":105
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):
 *             def keys(self):             # <<<<<<<<<<<<<<
 *                 return []
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14MutableMapping_1keys(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_14MutableMapping_1keys = {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_4lxml_5etree_14MutableMapping_1keys, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_14MutableMapping_1keys(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14MutableMapping_keys(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":106
 *         class MutableMapping(MutableMapping):
 *             def keys(self):
 *                 return []             # <<<<<<<<<<<<<<
 * 
 * class _ImmutableMapping(MutableMapping):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":105
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):
 *             def keys(self):             # <<<<<<<<<<<<<<
 *                 return []
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.MutableMapping.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":109
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_1__getitem__ = {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_1__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getitem__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping___getitem__(__pyx_self, __pyx_v_self, __pyx_v_key);

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":110
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
 */
  __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":109
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":112
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_3__setitem__ = {__Pyx_NAMESTR("__setitem__"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_3__setitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,&__pyx_n_s_value,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__setitem__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_2__setitem__(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_value);

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

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_2__setitem__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":113
 * 
 *     def __setitem__(self, key, value):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
 */
  __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":112
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":115
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_5__delitem__ = {__Pyx_NAMESTR("__delitem__"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_5__delitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__delitem__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_4__delitem__(__pyx_self, __pyx_v_self, __pyx_v_key);

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":116
 * 
 *     def __delitem__(self, key):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
 */
  __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":115
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":118
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_7__contains__ = {__Pyx_NAMESTR("__contains__"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_7__contains__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__contains__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__contains__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_key = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__contains__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ImmutableMapping.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_6__contains__(__pyx_self, __pyx_v_self, __pyx_v_key);

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

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_6__contains__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":119
 * 
 *     def __contains__(self, key):
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":118
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":121
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_9__len__ = {__Pyx_NAMESTR("__len__"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_9__len__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_8__len__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":122
 * 
 *     def __len__(self):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_0);
  __pyx_r = __pyx_int_0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":121
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":124
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_17_ImmutableMapping_11__iter__ = {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_17_ImmutableMapping_11__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_ImmutableMapping_10__iter__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":125
 * 
 *     def __iter__(self):
 *         return ITER_EMPTY             # <<<<<<<<<<<<<<
 *     iterkeys = itervalues = iteritems = __iter__
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":124
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     u"""Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_1register_namespace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_register_namespace[] = "Registers a namespace prefix that newly created Elements in that\n    namespace will use.  The registry is global, and any existing\n    mapping for either the given prefix or the namespace URI will be\n    removed.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_1register_namespace = {__Pyx_NAMESTR("register_namespace"), (PyCFunction)__pyx_pw_4lxml_5etree_1register_namespace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_register_namespace)};
static PyObject *__pyx_pw_4lxml_5etree_1register_namespace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "register_namespace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_register_namespace(__pyx_self, __pyx_v_prefix, __pyx_v_uri);

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

static PyObject *__pyx_pf_4lxml_5etree_register_namespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_uri_utf = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":194
 *     removed.
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)             # <<<<<<<<<<<<<<
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); 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_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_uri_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":195
 *     """
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_prefix_utf);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_prefix_utf);
  __Pyx_GIVEREF(__pyx_v_prefix_utf);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__check_internal_prefix, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":196
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":197
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *     _uriValidOrRaise(uri_utf)
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_prefix_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":198
 *         raise ValueError("Prefix format reserved for internal use")
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)             # <<<<<<<<<<<<<<
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_uri_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":199
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):             # <<<<<<<<<<<<<<
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 */
  if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __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 = 199; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":200
 *     _uriValidOrRaise(uri_utf)
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:             # <<<<<<<<<<<<<<
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 */
    __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_v_k, __pyx_v_uri_utf, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_3) {
      __pyx_t_10 = (__Pyx_PyBytes_Equals(__pyx_v_v, __pyx_v_prefix_utf, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = __pyx_t_10;
    } else {
      __pyx_t_11 = __pyx_t_3;
    }
    if (__pyx_t_11) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":201
 *     for k, v in list(_DEFAULT_NAMESPACE_PREFIXES.items()):
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]             # <<<<<<<<<<<<<<
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf
 * 
 */
      if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (PyDict_DelItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_k) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":202
 *         if k == uri_utf or v == prefix_utf:
 *             del _DEFAULT_NAMESPACE_PREFIXES[k]
 *     _DEFAULT_NAMESPACE_PREFIXES[uri_utf] = prefix_utf             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(PyDict_SetItem(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, __pyx_v_uri_utf, __pyx_v_prefix_utf) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     u"""Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_uri_utf);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":214
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9LxmlError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_9LxmlError_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_4lxml_5etree_9LxmlError_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_9LxmlError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_error_log = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,&__pyx_n_s_error_log,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_log);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_error_log = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9LxmlError___init__(__pyx_self, __pyx_v_self, __pyx_v_message, __pyx_v_error_log);

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":215
 *     """
 *     def __init__(self, message, error_log=None):
 *         if python.PY_VERSION_HEX >= 0x02050000:             # <<<<<<<<<<<<<<
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_Error, self).__init__(message)
 */
  __pyx_t_1 = ((PY_VERSION_HEX >= 0x02050000) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":217
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_Error, self).__init__(message)             # <<<<<<<<<<<<<<
 *         else:
 *             error_super_init(self, message)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_4lxml_5etree__Error);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__Error);
    __Pyx_GIVEREF(__pyx_v_4lxml_5etree__Error);
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":219
 *             super(_Error, self).__init__(message)
 *         else:
 *             error_super_init(self, message)             # <<<<<<<<<<<<<<
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_error_super_init, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":220
 *         else:
 *             error_super_init(self, message)
 *         if error_log is None:             # <<<<<<<<<<<<<<
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_error_log == Py_None);
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":221
 *             error_super_init(self, message)
 *         if error_log is None:
 *             self.error_log = __copyGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         else:
 *             self.error_log = error_log.copy()
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree___copyGlobalErrorLog(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_error_log, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":223
 *             self.error_log = __copyGlobalErrorLog()
 *         else:
 *             self.error_log = error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * cdef object _Error = Error if python.PY_VERSION_HEX >= 0x02050000 else None
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_error_log, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_error_log, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":214
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.LxmlError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":241
 * 
 * # version information
 * cdef __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     version_list = []
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 */

static PyObject *__pyx_f_4lxml_5etree___unpackDottedVersion(PyObject *__pyx_v_version) {
  PyObject *__pyx_v_version_list = NULL;
  PyObject *__pyx_v_l = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_count = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unpackDottedVersion", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":242
 * # version information
 * cdef __unpackDottedVersion(version):
 *     version_list = []             # <<<<<<<<<<<<<<
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 *     for item in l:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_version_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":243
 * cdef __unpackDottedVersion(version):
 *     version_list = []
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_version, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(1 * 4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < 4; __pyx_temp++) {
      __Pyx_INCREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
    }
  }
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); 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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 4, NULL, NULL, &__pyx_slice__7, 0, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_l = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":244
 *     version_list = []
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 *     for item in l:             # <<<<<<<<<<<<<<
 *         try:
 *             item = int(item)
 */
  if (PyList_CheckExact(__pyx_v_l) || PyTuple_CheckExact(__pyx_v_l)) {
    __pyx_t_1 = __pyx_v_l; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":245
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 *     for item in l:
 *         try:             # <<<<<<<<<<<<<<
 *             item = int(item)
 *         except ValueError:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":246
 *     for item in l:
 *         try:
 *             item = int(item)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             if item.startswith(u'dev'):
 */
        __pyx_t_3 = PyNumber_Int(__pyx_v_item); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":247
 *         try:
 *             item = int(item)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             if item.startswith(u'dev'):
 *                 count = item[3:]
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_10);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":248
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith(u'dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_13) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":249
 *         except ValueError:
 *             if item.startswith(u'dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith(u'alpha'):
 */
          __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_item, 3, 0, NULL, NULL, &__pyx_slice__9, 1, 0, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":250
 *             if item.startswith(u'dev'):
 *                 count = item[3:]
 *                 item = -300             # <<<<<<<<<<<<<<
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]
 */
          __Pyx_INCREF(__pyx_int_neg_300);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_int_neg_300);
          goto __pyx_L15;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":251
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith(u'alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_startswith); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_13) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":252
 *                 item = -300
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith(u'beta'):
 */
          __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_item, 5, 0, NULL, NULL, &__pyx_slice__11, 1, 0, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":253
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]
 *                 item = -200             # <<<<<<<<<<<<<<
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]
 */
          __Pyx_INCREF(__pyx_int_neg_200);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_int_neg_200);
          goto __pyx_L15;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":254
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith(u'beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_13) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":255
 *                 item = -200
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
 */
          __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_item, 4, 0, NULL, NULL, &__pyx_slice__13, 1, 0, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":256
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]
 *                 item = -100             # <<<<<<<<<<<<<<
 *             else:
 *                 count = 0
 */
          __Pyx_INCREF(__pyx_int_neg_100);
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_int_neg_100);
          goto __pyx_L15;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":258
 *                 item = -100
 *             else:
 *                 count = 0             # <<<<<<<<<<<<<<
 *             if count:
 *                 item += int(count)
 */
          __Pyx_INCREF(__pyx_int_0);
          __Pyx_XDECREF_SET(__pyx_v_count, __pyx_int_0);
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":259
 *             else:
 *                 count = 0
 *             if count:             # <<<<<<<<<<<<<<
 *                 item += int(count)
 *         version_list.append(item)
 */
        __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_count); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        if (__pyx_t_13) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":260
 *                 count = 0
 *             if count:
 *                 item += int(count)             # <<<<<<<<<<<<<<
 *         version_list.append(item)
 *     return tuple(version_list)
 */
          __pyx_t_12 = PyNumber_Int(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_item, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_11);
          __pyx_t_11 = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L12_try_end:;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":261
 *             if count:
 *                 item += int(count)
 *         version_list.append(item)             # <<<<<<<<<<<<<<
 *     return tuple(version_list)
 * 
 */
    __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_version_list, __pyx_v_item); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":262
 *                 item += int(count)
 *         version_list.append(item)
 *     return tuple(version_list)             # <<<<<<<<<<<<<<
 * 
 * cdef __unpackIntVersion(int c_version):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_AsTuple(__pyx_v_version_list); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":241
 * 
 * # version information
 * cdef __unpackDottedVersion(version):             # <<<<<<<<<<<<<<
 *     version_list = []
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree.__unpackDottedVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version_list);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":264
 *     return tuple(version_list)
 * 
 * cdef __unpackIntVersion(int c_version):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version / (100*100)) % 100),
 */

static PyObject *__pyx_f_4lxml_5etree___unpackIntVersion(int __pyx_v_c_version) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unpackIntVersion", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":265
 * 
 * cdef __unpackIntVersion(int c_version):
 *     return (             # <<<<<<<<<<<<<<
 *         ((c_version / (100*100)) % 100),
 *         ((c_version / 100)       % 100),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":266
 * cdef __unpackIntVersion(int c_version):
 *     return (
 *         ((c_version / (100*100)) % 100),             # <<<<<<<<<<<<<<
 *         ((c_version / 100)       % 100),
 *         (c_version               % 100)
 */
  __pyx_t_1 = __Pyx_PyInt_From_long(__Pyx_mod_long(__Pyx_div_long(__pyx_v_c_version, 10000), 100)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":267
 *     return (
 *         ((c_version / (100*100)) % 100),
 *         ((c_version / 100)       % 100),             # <<<<<<<<<<<<<<
 *         (c_version               % 100)
 *         )
 */
  __pyx_t_2 = __Pyx_PyInt_From_long(__Pyx_mod_long(__Pyx_div_long(__pyx_v_c_version, 100), 100)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":268
 *         ((c_version / (100*100)) % 100),
 *         ((c_version / 100)       % 100),
 *         (c_version               % 100)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_3 = __Pyx_PyInt_From_long(__Pyx_mod_long(__pyx_v_c_version, 100)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":266
 * cdef __unpackIntVersion(int c_version):
 *     return (
 *         ((c_version / (100*100)) % 100),             # <<<<<<<<<<<<<<
 *         ((c_version / 100)       % 100),
 *         (c_version               % 100)
 */
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  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_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":264
 *     return tuple(version_list)
 * 
 * cdef __unpackIntVersion(int c_version):             # <<<<<<<<<<<<<<
 *     return (
 *         ((c_version / (100*100)) % 100),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.__unpackIntVersion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":292
 * cdef class _TempStore:
 *     cdef list _storage
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._storage = []
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10_TempStore_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10_TempStore_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_4lxml_5etree_10_TempStore___init__(((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_10_TempStore___init__(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":293
 *     cdef list _storage
 *     def __init__(self):
 *         self._storage = []             # <<<<<<<<<<<<<<
 * 
 *     cdef int add(self, obj) except -1:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_storage);
  __Pyx_DECREF(__pyx_v_self->_storage);
  __pyx_v_self->_storage = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":292
 * cdef class _TempStore:
 *     cdef list _storage
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._storage = []
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._TempStore.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":295
 *         self._storage = []
 * 
 *     cdef int add(self, obj) except -1:             # <<<<<<<<<<<<<<
 *         self._storage.append(obj)
 *         return 0
 */

static int __pyx_f_4lxml_5etree_10_TempStore_add(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self, PyObject *__pyx_v_obj) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":296
 * 
 *     cdef int add(self, obj) except -1:
 *         self._storage.append(obj)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->_storage == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_storage, __pyx_v_obj); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":297
 *     cdef int add(self, obj) except -1:
 *         self._storage.append(obj)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int clear(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":295
 *         self._storage = []
 * 
 *     cdef int add(self, obj) except -1:             # <<<<<<<<<<<<<<
 *         self._storage.append(obj)
 *         return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TempStore.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":299
 *         return 0
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         del self._storage[:]
 *         return 0
 */

static int __pyx_f_4lxml_5etree_10_TempStore_clear(struct __pyx_obj_4lxml_5etree__TempStore *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":300
 * 
 *     cdef int clear(self) except -1:
 *         del self._storage[:]             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->_storage == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_storage, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":301
 *     cdef int clear(self) except -1:
 *         del self._storage[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * # class for temporarily storing exceptions raised in extensions
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":299
 *         return 0
 * 
 *     cdef int clear(self) except -1:             # <<<<<<<<<<<<<<
 *         del self._storage[:]
 *         return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TempStore.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":307
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
 *     cdef void clear(self):             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 * 
 */

static void __pyx_f_4lxml_5etree_17_ExceptionContext_clear(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":308
 *     cdef object _exc_info
 *     cdef void clear(self):
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 * 
 *     cdef void _store_raised(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":307
 * cdef class _ExceptionContext:
 *     cdef object _exc_info
 *     cdef void clear(self):             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":310
 *         self._exc_info = None
 * 
 *     cdef void _store_raised(self):             # <<<<<<<<<<<<<<
 *         self._exc_info = sys.exc_info()
 * 
 */

static void __pyx_f_4lxml_5etree_17_ExceptionContext__store_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_store_raised", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":311
 * 
 *     cdef void _store_raised(self):
 *         self._exc_info = sys.exc_info()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _store_exception(self, exception):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":310
 *         self._exc_info = None
 * 
 *     cdef void _store_raised(self):             # <<<<<<<<<<<<<<
 *         self._exc_info = sys.exc_info()
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._ExceptionContext._store_raised", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":313
 *         self._exc_info = sys.exc_info()
 * 
 *     cdef void _store_exception(self, exception):             # <<<<<<<<<<<<<<
 *         self._exc_info = (exception, None, None)
 * 
 */

static void __pyx_f_4lxml_5etree_17_ExceptionContext__store_exception(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self, PyObject *__pyx_v_exception) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_store_exception", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":314
 * 
 *     cdef void _store_exception(self, exception):
 *         self._exc_info = (exception, None, None)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _has_raised(self):
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_exception);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception);
  __Pyx_GIVEREF(__pyx_v_exception);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":313
 *         self._exc_info = sys.exc_info()
 * 
 *     cdef void _store_exception(self, exception):             # <<<<<<<<<<<<<<
 *         self._exc_info = (exception, None, None)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ExceptionContext._store_exception", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":316
 *         self._exc_info = (exception, None, None)
 * 
 *     cdef bint _has_raised(self):             # <<<<<<<<<<<<<<
 *         return self._exc_info is not None
 * 
 */

static int __pyx_f_4lxml_5etree_17_ExceptionContext__has_raised(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_has_raised", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":317
 * 
 *     cdef bint _has_raised(self):
 *         return self._exc_info is not None             # <<<<<<<<<<<<<<
 * 
 *     cdef int _raise_if_stored(self) except -1:
 */
  __pyx_t_1 = (__pyx_v_self->_exc_info != Py_None);
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":316
 *         self._exc_info = (exception, None, None)
 * 
 *     cdef bint _has_raised(self):             # <<<<<<<<<<<<<<
 *         return self._exc_info is not None
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":319
 *         return self._exc_info is not None
 * 
 *     cdef int _raise_if_stored(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._exc_info is None:
 *             return 0
 */

static int __pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored(struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_self) {
  PyObject *__pyx_v_type = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_traceback = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_if_stored", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":320
 * 
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:             # <<<<<<<<<<<<<<
 *             return 0
 *         type, value, traceback = self._exc_info
 */
  __pyx_t_1 = (__pyx_v_self->_exc_info == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":321
 *     cdef int _raise_if_stored(self) except -1:
 *         if self._exc_info is None:
 *             return 0             # <<<<<<<<<<<<<<
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":322
 *         if self._exc_info is None:
 *             return 0
 *         type, value, traceback = self._exc_info             # <<<<<<<<<<<<<<
 *         self._exc_info = None
 *         if value is None and traceback is None:
 */
  __pyx_t_3 = __pyx_v_self->_exc_info;
  __Pyx_INCREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_type = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_value = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_traceback = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":323
 *             return 0
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None             # <<<<<<<<<<<<<<
 *         if value is None and traceback is None:
 *             raise type
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_exc_info);
  __Pyx_DECREF(__pyx_v_self->_exc_info);
  __pyx_v_self->_exc_info = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":324
 *         type, value, traceback = self._exc_info
 *         self._exc_info = None
 *         if value is None and traceback is None:             # <<<<<<<<<<<<<<
 *             raise type
 *         else:
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_1 = (__pyx_v_traceback == Py_None);
    __pyx_t_9 = (__pyx_t_1 != 0);
  } else {
    __pyx_t_9 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_9) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":325
 *         self._exc_info = None
 *         if value is None and traceback is None:
 *             raise type             # <<<<<<<<<<<<<<
 *         else:
 *             raise type, value, traceback
 */
    __Pyx_Raise(__pyx_v_type, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":327
 *             raise type
 *         else:
 *             raise type, value, traceback             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_v_type, __pyx_v_value, __pyx_v_traceback, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":319
 *         return self._exc_info is not None
 * 
 *     cdef int _raise_if_stored(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._exc_info is None:
 *             return 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ExceptionContext._raise_if_stored", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_type);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_traceback);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":14
 * # weak-ref if it isn't.
 * 
 * cdef inline _Element getProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Get a proxy for a given node.
 *     """
 */

static CYTHON_INLINE struct LxmlElement *__pyx_f_4lxml_5etree_getProxy(xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":18
 *     """
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         if python.IS_PYPY:
 *             return <_Element>python.PyWeakref_LockObject(<python.PyObject*>c_node._private)
 */
  __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_node->_private != NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":19
 *     #print "getProxy for:", <int>c_node
 *     if c_node is not NULL and c_node._private is not NULL:
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             return <_Element>python.PyWeakref_LockObject(<python.PyObject*>c_node._private)
 *         else:
 */
    __pyx_t_3 = (IS_PYPY != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":20
 *     if c_node is not NULL and c_node._private is not NULL:
 *         if python.IS_PYPY:
 *             return <_Element>python.PyWeakref_LockObject(<python.PyObject*>c_node._private)             # <<<<<<<<<<<<<<
 *         else:
 *             return <_Element>c_node._private
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_4 = PyWeakref_LockObject(((PyObject *)__pyx_v_c_node->_private)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_t_4)));
      __pyx_r = ((struct LxmlElement *)__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":22
 *             return <_Element>python.PyWeakref_LockObject(<python.PyObject*>c_node._private)
 *         else:
 *             return <_Element>c_node._private             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)((struct LxmlElement *)__pyx_v_c_node->_private)));
      __pyx_r = ((struct LxmlElement *)__pyx_v_c_node->_private);
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":24
 *             return <_Element>c_node._private
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint hasProxy(xmlNode* c_node):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct LxmlElement *)Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":14
 * # weak-ref if it isn't.
 * 
 * cdef inline _Element getProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Get a proxy for a given node.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.getProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":26
 *         return None
 * 
 * cdef inline bint hasProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node._private is NULL:
 *         return False
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_hasProxy(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("hasProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":27
 * 
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:             # <<<<<<<<<<<<<<
 *         return False
 *     if python.IS_PYPY:
 */
  __pyx_t_1 = ((__pyx_v_c_node->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":28
 * cdef inline bint hasProxy(xmlNode* c_node):
 *     if c_node._private is NULL:
 *         return False             # <<<<<<<<<<<<<<
 *     if python.IS_PYPY:
 *         return _isProxyAliveInPypy(c_node)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":29
 *     if c_node._private is NULL:
 *         return False
 *     if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *         return _isProxyAliveInPypy(c_node)
 *     return True
 */
  __pyx_t_1 = (IS_PYPY != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":30
 *         return False
 *     if python.IS_PYPY:
 *         return _isProxyAliveInPypy(c_node)             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
    __pyx_r = __pyx_f_4lxml_5etree__isProxyAliveInPypy(__pyx_v_c_node);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":31
 *     if python.IS_PYPY:
 *         return _isProxyAliveInPypy(c_node)
 *     return True             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isProxyAliveInPypy(xmlNode* c_node):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":26
 *         return None
 * 
 * cdef inline bint hasProxy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node._private is NULL:
 *         return False
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":33
 *     return True
 * 
 * cdef bint _isProxyAliveInPypy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     retval = True
 *     if python.PyWeakref_LockObject(<python.PyObject*>c_node._private) is None:
 */

static int __pyx_f_4lxml_5etree__isProxyAliveInPypy(xmlNode *__pyx_v_c_node) {
  int __pyx_v_retval;
  PyObject *__pyx_v_weakref_ptr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_isProxyAliveInPypy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":34
 * 
 * cdef bint _isProxyAliveInPypy(xmlNode* c_node):
 *     retval = True             # <<<<<<<<<<<<<<
 *     if python.PyWeakref_LockObject(<python.PyObject*>c_node._private) is None:
 *         # proxy has already died => remove weak reference
 */
  __pyx_v_retval = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":35
 * cdef bint _isProxyAliveInPypy(xmlNode* c_node):
 *     retval = True
 *     if python.PyWeakref_LockObject(<python.PyObject*>c_node._private) is None:             # <<<<<<<<<<<<<<
 *         # proxy has already died => remove weak reference
 *         weakref_ptr = <python.PyObject*>c_node._private
 */
  __pyx_t_1 = PyWeakref_LockObject(((PyObject *)__pyx_v_c_node->_private)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":37
 *     if python.PyWeakref_LockObject(<python.PyObject*>c_node._private) is None:
 *         # proxy has already died => remove weak reference
 *         weakref_ptr = <python.PyObject*>c_node._private             # <<<<<<<<<<<<<<
 *         c_node._private = NULL
 *         python.Py_XDECREF(weakref_ptr)
 */
    __pyx_v_weakref_ptr = ((PyObject *)__pyx_v_c_node->_private);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":38
 *         # proxy has already died => remove weak reference
 *         weakref_ptr = <python.PyObject*>c_node._private
 *         c_node._private = NULL             # <<<<<<<<<<<<<<
 *         python.Py_XDECREF(weakref_ptr)
 *         retval = False
 */
    __pyx_v_c_node->_private = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":39
 *         weakref_ptr = <python.PyObject*>c_node._private
 *         c_node._private = NULL
 *         python.Py_XDECREF(weakref_ptr)             # <<<<<<<<<<<<<<
 *         retval = False
 *     return retval
 */
    Py_XDECREF(__pyx_v_weakref_ptr);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":40
 *         c_node._private = NULL
 *         python.Py_XDECREF(weakref_ptr)
 *         retval = False             # <<<<<<<<<<<<<<
 *     return retval
 * 
 */
    __pyx_v_retval = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":41
 *         python.Py_XDECREF(weakref_ptr)
 *         retval = False
 *     return retval             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _registerProxy(_Element proxy, _Document doc,
 */
  __pyx_r = __pyx_v_retval;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":33
 *     return True
 * 
 * cdef bint _isProxyAliveInPypy(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     retval = True
 *     if python.PyWeakref_LockObject(<python.PyObject*>c_node._private) is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._isProxyAliveInPypy", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":43
 *     return retval
 * 
 * cdef inline int _registerProxy(_Element proxy, _Document doc,             # <<<<<<<<<<<<<<
 *                                xmlNode* c_node) except -1:
 *     u"""Register a proxy and type for the node it's proxying for.
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__registerProxy(struct LxmlElement *__pyx_v_proxy, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_registerProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":48
 *     """
 *     #print "registering for:", <int>proxy._c_node
 *     assert not hasProxy(c_node), u"double registering proxy!"             # <<<<<<<<<<<<<<
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((!(__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node) != 0)) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_double_registering_proxy);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":49
 *     #print "registering for:", <int>proxy._c_node
 *     assert not hasProxy(c_node), u"double registering proxy!"
 *     proxy._doc = doc             # <<<<<<<<<<<<<<
 *     proxy._c_node = c_node
 *     if python.IS_PYPY:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(__pyx_v_proxy->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_proxy->_doc));
  __pyx_v_proxy->_doc = __pyx_v_doc;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":50
 *     assert not hasProxy(c_node), u"double registering proxy!"
 *     proxy._doc = doc
 *     proxy._c_node = c_node             # <<<<<<<<<<<<<<
 *     if python.IS_PYPY:
 *         c_node._private = <void*>python.PyWeakref_NewRef(proxy, NULL)
 */
  __pyx_v_proxy->_c_node = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":51
 *     proxy._doc = doc
 *     proxy._c_node = c_node
 *     if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *         c_node._private = <void*>python.PyWeakref_NewRef(proxy, NULL)
 *     else:
 */
  __pyx_t_1 = (IS_PYPY != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":52
 *     proxy._c_node = c_node
 *     if python.IS_PYPY:
 *         c_node._private = <void*>python.PyWeakref_NewRef(proxy, NULL)             # <<<<<<<<<<<<<<
 *     else:
 *         c_node._private = <void*>proxy
 */
    __pyx_t_2 = PyWeakref_NewRef(((PyObject *)__pyx_v_proxy), NULL); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node->_private = ((void *)__pyx_t_2);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":54
 *         c_node._private = <void*>python.PyWeakref_NewRef(proxy, NULL)
 *     else:
 *         c_node._private = <void*>proxy             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node->_private = ((void *)__pyx_v_proxy);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":55
 *     else:
 *         c_node._private = <void*>proxy
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _unregisterProxy(_Element proxy) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":43
 *     return retval
 * 
 * cdef inline int _registerProxy(_Element proxy, _Document doc,             # <<<<<<<<<<<<<<
 *                                xmlNode* c_node) except -1:
 *     u"""Register a proxy and type for the node it's proxying for.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._registerProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":57
 *     return 0
 * 
 * cdef inline int _unregisterProxy(_Element proxy) except -1:             # <<<<<<<<<<<<<<
 *     u"""Unregister a proxy for the node it's proxying for.
 *     """
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__unregisterProxy(struct LxmlElement *__pyx_v_proxy) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_weakref_ptr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unregisterProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":60
 *     u"""Unregister a proxy for the node it's proxying for.
 *     """
 *     cdef xmlNode* c_node = proxy._c_node             # <<<<<<<<<<<<<<
 *     if python.IS_PYPY:
 *         weakref_ptr = <python.PyObject*>c_node._private
 */
  __pyx_t_1 = __pyx_v_proxy->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":61
 *     """
 *     cdef xmlNode* c_node = proxy._c_node
 *     if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *         weakref_ptr = <python.PyObject*>c_node._private
 *         c_node._private = NULL
 */
  __pyx_t_2 = (IS_PYPY != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":62
 *     cdef xmlNode* c_node = proxy._c_node
 *     if python.IS_PYPY:
 *         weakref_ptr = <python.PyObject*>c_node._private             # <<<<<<<<<<<<<<
 *         c_node._private = NULL
 *         python.Py_XDECREF(weakref_ptr)
 */
    __pyx_v_weakref_ptr = ((PyObject *)__pyx_v_c_node->_private);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":63
 *     if python.IS_PYPY:
 *         weakref_ptr = <python.PyObject*>c_node._private
 *         c_node._private = NULL             # <<<<<<<<<<<<<<
 *         python.Py_XDECREF(weakref_ptr)
 *     else:
 */
    __pyx_v_c_node->_private = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":64
 *         weakref_ptr = <python.PyObject*>c_node._private
 *         c_node._private = NULL
 *         python.Py_XDECREF(weakref_ptr)             # <<<<<<<<<<<<<<
 *     else:
 *         assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"
 */
    Py_XDECREF(__pyx_v_weakref_ptr);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":66
 *         python.Py_XDECREF(weakref_ptr)
 *     else:
 *         assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"             # <<<<<<<<<<<<<<
 *         c_node._private = NULL
 *     return 0
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_c_node->_private == ((void *)__pyx_v_proxy)) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Tried_to_unregister_unknown_prox);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    #endif

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":67
 *     else:
 *         assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"
 *         c_node._private = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node->_private = NULL;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":68
 *         assert c_node._private is <void*>proxy, u"Tried to unregister unknown proxy"
 *         c_node._private = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":57
 *     return 0
 * 
 * cdef inline int _unregisterProxy(_Element proxy) except -1:             # <<<<<<<<<<<<<<
 *     u"""Unregister a proxy for the node it's proxying for.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._unregisterProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":73
 * # temporarily make a node the root node of its document
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:             # <<<<<<<<<<<<<<
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 */

static xmlDoc *__pyx_f_4lxml_5etree__fakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node) {
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fakeRootDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":74
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_c_base_doc, __pyx_v_c_node, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":73
 * # temporarily make a node the root node of its document
 * 
 * cdef xmlDoc* _fakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node) except NULL:             # <<<<<<<<<<<<<<
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._fakeRootDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":76
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                bint with_siblings) except NULL:
 *     # build a temporary document that has the given node as root node
 */

static xmlDoc *__pyx_f_4lxml_5etree__plainFakeRootDoc(xmlDoc *__pyx_v_c_base_doc, xmlNode *__pyx_v_c_node, int __pyx_v_with_siblings) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_root;
  xmlNode *__pyx_v_c_new_root;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  xmlNode *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_plainFakeRootDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":85
 *     cdef xmlNode* c_new_root
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):             # <<<<<<<<<<<<<<
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:
 */
  if (!(__pyx_v_with_siblings != 0)) {
    __pyx_t_1 = ((__pyx_v_c_node->prev == NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_c_node->next == NULL) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = (__pyx_v_with_siblings != 0);
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":86
 *     cdef xmlDoc*  c_doc
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)             # <<<<<<<<<<<<<<
 *         if c_root is c_node:
 *             # already the root node, no siblings
 */
    __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_base_doc);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":87
 *     if with_siblings or (c_node.prev is NULL and c_node.next is NULL):
 *         c_root = tree.xmlDocGetRootElement(c_base_doc)
 *         if c_root is c_node:             # <<<<<<<<<<<<<<
 *             # already the root node, no siblings
 *             return c_base_doc
 */
    __pyx_t_1 = ((__pyx_v_c_root == __pyx_v_c_node) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":89
 *         if c_root is c_node:
 *             # already the root node, no siblings
 *             return c_base_doc             # <<<<<<<<<<<<<<
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 */
      __pyx_r = __pyx_v_c_base_doc;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":91
 *             return c_base_doc
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!             # <<<<<<<<<<<<<<
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_base_doc, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":92
 * 
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 *     _copyParentNamespaces(c_node, c_new_root)
 */
  __pyx_v_c_new_root = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_c_doc, 2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":93
 *     c_doc  = _copyDoc(c_base_doc, 0)                   # non recursive!
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)             # <<<<<<<<<<<<<<
 *     _copyParentNamespaces(c_node, c_new_root)
 * 
 */
  xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_new_root);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":94
 *     c_new_root = tree.xmlDocCopyNode(c_node, c_doc, 2) # non recursive!
 *     tree.xmlDocSetRootElement(c_doc, c_new_root)
 *     _copyParentNamespaces(c_node, c_new_root)             # <<<<<<<<<<<<<<
 * 
 *     c_new_root.children = c_node.children
 */
  __pyx_f_4lxml_5etree__copyParentNamespaces(__pyx_v_c_node, __pyx_v_c_new_root);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":96
 *     _copyParentNamespaces(c_node, c_new_root)
 * 
 *     c_new_root.children = c_node.children             # <<<<<<<<<<<<<<
 *     c_new_root.last = c_node.last
 *     c_new_root.next = c_new_root.prev = NULL
 */
  __pyx_t_5 = __pyx_v_c_node->children;
  __pyx_v_c_new_root->children = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":97
 * 
 *     c_new_root.children = c_node.children
 *     c_new_root.last = c_node.last             # <<<<<<<<<<<<<<
 *     c_new_root.next = c_new_root.prev = NULL
 * 
 */
  __pyx_t_5 = __pyx_v_c_node->last;
  __pyx_v_c_new_root->last = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":98
 *     c_new_root.children = c_node.children
 *     c_new_root.last = c_node.last
 *     c_new_root.next = c_new_root.prev = NULL             # <<<<<<<<<<<<<<
 * 
 *     # store original node
 */
  __pyx_v_c_new_root->next = NULL;
  __pyx_v_c_new_root->prev = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":101
 * 
 *     # store original node
 *     c_doc._private = c_node             # <<<<<<<<<<<<<<
 * 
 *     # divert parent pointers of children
 */
  __pyx_v_c_doc->_private = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":104
 * 
 *     # divert parent pointers of children
 *     c_child = c_new_root.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root
 */
  __pyx_t_5 = __pyx_v_c_new_root->children;
  __pyx_v_c_child = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":105
 *     # divert parent pointers of children
 *     c_child = c_new_root.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_new_root
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":106
 *     c_child = c_new_root.children
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_v_c_child->parent = __pyx_v_c_new_root;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":107
 *     while c_child is not NULL:
 *         c_child.parent = c_new_root
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     c_doc.children = c_new_root
 */
    __pyx_t_5 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_5;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":109
 *         c_child = c_child.next
 * 
 *     c_doc.children = c_new_root             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
 */
  __pyx_v_c_doc->children = __pyx_v_c_new_root;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":110
 * 
 *     c_doc.children = c_new_root
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc):
 */
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":76
 *     return _plainFakeRootDoc(c_base_doc, c_node, 1)
 * 
 * cdef xmlDoc* _plainFakeRootDoc(xmlDoc* c_base_doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                bint with_siblings) except NULL:
 *     # build a temporary document that has the given node as root node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._plainFakeRootDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":112
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc):             # <<<<<<<<<<<<<<
 *     # delete a temporary document
 *     cdef xmlNode* c_child
 */

static void __pyx_f_4lxml_5etree__destroyFakeDoc(xmlDoc *__pyx_v_c_base_doc, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_root;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  __Pyx_RefNannySetupContext("_destroyFakeDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":117
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:             # <<<<<<<<<<<<<<
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 */
  __pyx_t_1 = ((__pyx_v_c_doc == __pyx_v_c_base_doc) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":118
 *     cdef xmlNode* c_root
 *     if c_doc is c_base_doc:
 *         return             # <<<<<<<<<<<<<<
 *     c_root = tree.xmlDocGetRootElement(c_doc)
 * 
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":119
 *     if c_doc is c_base_doc:
 *         return
 *     c_root = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 * 
 *     # restore parent pointers of children
 */
  __pyx_v_c_root = xmlDocGetRootElement(__pyx_v_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":122
 * 
 *     # restore parent pointers of children
 *     c_parent = <xmlNode*>c_doc._private             # <<<<<<<<<<<<<<
 *     c_child = c_root.children
 *     while c_child is not NULL:
 */
  __pyx_v_c_parent = ((xmlNode *)__pyx_v_c_doc->_private);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":123
 *     # restore parent pointers of children
 *     c_parent = <xmlNode*>c_doc._private
 *     c_child = c_root.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 */
  __pyx_t_2 = __pyx_v_c_root->children;
  __pyx_v_c_child = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":124
 *     c_parent = <xmlNode*>c_doc._private
 *     c_child = c_root.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_parent
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":125
 *     c_child = c_root.children
 *     while c_child is not NULL:
 *         c_child.parent = c_parent             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_v_c_child->parent = __pyx_v_c_parent;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":126
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # prevent recursive removal of children
 */
    __pyx_t_2 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":129
 * 
 *     # prevent recursive removal of children
 *     c_root.children = c_root.last = NULL             # <<<<<<<<<<<<<<
 *     tree.xmlFreeDoc(c_doc)
 * 
 */
  __pyx_v_c_root->children = NULL;
  __pyx_v_c_root->last = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":130
 *     # prevent recursive removal of children
 *     c_root.children = c_root.last = NULL
 *     tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):
 */
  xmlFreeDoc(__pyx_v_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":112
 *     return c_doc
 * 
 * cdef void _destroyFakeDoc(xmlDoc* c_base_doc, xmlDoc* c_doc):             # <<<<<<<<<<<<<<
 *     # delete a temporary document
 *     cdef xmlNode* c_child
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":132
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     u"""Special element factory for cases where we need to create a fake
 *     root document, but still need to instantiate arbitrary nodes from
 */

static struct LxmlElement *__pyx_f_4lxml_5etree__fakeDocElementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_element) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fakeDocElementFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":141
 *     instantiate the original node instead.
 *     """
 *     if c_element.doc is not doc._c_doc:             # <<<<<<<<<<<<<<
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
 */
  __pyx_t_1 = ((__pyx_v_c_element->doc != __pyx_v_doc->_c_doc) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":142
 *     """
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:             # <<<<<<<<<<<<<<
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private
 */
    __pyx_t_1 = ((__pyx_v_c_element->doc->_private != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":143
 *     if c_element.doc is not doc._c_doc:
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:             # <<<<<<<<<<<<<<
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 */
      __pyx_t_1 = ((__pyx_v_c_element == __pyx_v_c_element->doc->children) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":144
 *         if c_element.doc._private is not NULL:
 *             if c_element is c_element.doc.children:
 *                 c_element = <xmlNode*>c_element.doc._private             # <<<<<<<<<<<<<<
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 *     return _elementFactory(doc, c_element)
 */
        __pyx_v_c_element = ((xmlNode *)__pyx_v_c_element->doc->_private);
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":146
 *                 c_element = <xmlNode*>c_element.doc._private
 *                 #assert c_element.type == tree.XML_ELEMENT_NODE
 *     return _elementFactory(doc, c_element)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_element)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":132
 *     tree.xmlFreeDoc(c_doc)
 * 
 * cdef _Element _fakeDocElementFactory(_Document doc, xmlNode* c_element):             # <<<<<<<<<<<<<<
 *     u"""Special element factory for cases where we need to create a fake
 *     root document, but still need to instantiate arbitrary nodes from
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._fakeDocElementFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":151
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Attempt deallocation of c_node (or higher up in tree).
 *     """
 */

static int __pyx_f_4lxml_5etree_attemptDeallocation(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_top;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("attemptDeallocation", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":156
 *     cdef xmlNode* c_top
 *     # could be we actually aren't referring to the tree at all
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         #print "not freeing, node is NULL"
 *         return 0
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":158
 *     if c_node is NULL:
 *         #print "not freeing, node is NULL"
 *         return 0             # <<<<<<<<<<<<<<
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":159
 *         #print "not freeing, node is NULL"
 *         return 0
 *     c_top = getDeallocationTop(c_node)             # <<<<<<<<<<<<<<
 *     if c_top is not NULL:
 *         #print "freeing:", c_top.name
 */
  __pyx_v_c_top = __pyx_f_4lxml_5etree_getDeallocationTop(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":160
 *         return 0
 *     c_top = getDeallocationTop(c_node)
 *     if c_top is not NULL:             # <<<<<<<<<<<<<<
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 */
  __pyx_t_1 = ((__pyx_v_c_top != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":162
 *     if c_top is not NULL:
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_top)
 *         return 1
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_top->next);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":163
 *         #print "freeing:", c_top.name
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)             # <<<<<<<<<<<<<<
 *         return 1
 *     return 0
 */
    xmlFreeNode(__pyx_v_c_top);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":164
 *         _removeText(c_top.next) # tail
 *         tree.xmlFreeNode(c_top)
 *         return 1             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":165
 *         tree.xmlFreeNode(c_top)
 *         return 1
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":151
 * # support for freeing tree elements when proxy objects are destroyed
 * 
 * cdef int attemptDeallocation(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Attempt deallocation of c_node (or higher up in tree).
 *     """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":167
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Return the top of the tree that can be deallocated, or NULL.
 *     """
 */

static xmlNode *__pyx_f_4lxml_5etree_getDeallocationTop(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  __Pyx_RefNannySetupContext("getDeallocationTop", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":171
 *     """
 *     #print "trying to do deallocating:", c_node.type
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         #print "Not freeing: proxies still exist"
 *         return NULL
 */
  __pyx_t_1 = (__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":173
 *     if hasProxy(c_node):
 *         #print "Not freeing: proxies still exist"
 *         return NULL             # <<<<<<<<<<<<<<
 *     while c_node.parent is not NULL:
 *         c_node = c_node.parent
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":174
 *         #print "Not freeing: proxies still exist"
 *         return NULL
 *     while c_node.parent is not NULL:             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *         #print "checking:", c_current.type
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node->parent != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":175
 *         return NULL
 *     while c_node.parent is not NULL:
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *         #print "checking:", c_current.type
 *         if c_node.type == tree.XML_DOCUMENT_NODE or \
 */
    __pyx_t_2 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":177
 *         c_node = c_node.parent
 *         #print "checking:", c_current.type
 *         if c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
 */
    switch (__pyx_v_c_node->type) {
      case XML_DOCUMENT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":178
 *         #print "checking:", c_current.type
 *         if c_node.type == tree.XML_DOCUMENT_NODE or \
 *                c_node.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *             #print "not freeing: still in doc"
 *             return NULL
 */
      case XML_HTML_DOCUMENT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":180
 *                c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *             #print "not freeing: still in doc"
 *             return NULL             # <<<<<<<<<<<<<<
 *         # if we're still attached to the document, don't deallocate
 *         if hasProxy(c_node):
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      break;
      default: break;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":182
 *             return NULL
 *         # if we're still attached to the document, don't deallocate
 *         if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *             #print "Not freeing: proxies still exist"
 *             return NULL
 */
    __pyx_t_1 = (__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":184
 *         if hasProxy(c_node):
 *             #print "Not freeing: proxies still exist"
 *             return NULL             # <<<<<<<<<<<<<<
 *     # see whether we have children to deallocate
 *     if canDeallocateChildNodes(c_node):
 */
      __pyx_r = NULL;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":186
 *             return NULL
 *     # see whether we have children to deallocate
 *     if canDeallocateChildNodes(c_node):             # <<<<<<<<<<<<<<
 *         return c_node
 *     else:
 */
  __pyx_t_1 = (__pyx_f_4lxml_5etree_canDeallocateChildNodes(__pyx_v_c_node) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":187
 *     # see whether we have children to deallocate
 *     if canDeallocateChildNodes(c_node):
 *         return c_node             # <<<<<<<<<<<<<<
 *     else:
 *         return NULL
 */
    __pyx_r = __pyx_v_c_node;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":189
 *         return c_node
 *     else:
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":167
 *     return 0
 * 
 * cdef xmlNode* getDeallocationTop(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Return the top of the tree that can be deallocated, or NULL.
 *     """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":191
 *         return NULL
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 */

static int __pyx_f_4lxml_5etree_canDeallocateChildNodes(xmlNode *__pyx_v_c_parent) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("canDeallocateChildNodes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":193
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):
 */
  __pyx_t_1 = __pyx_v_c_parent->children;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":194
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         return 0
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_parent, __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":195
 *     c_node = c_parent.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
  __pyx_t_2 = (__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":196
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_parent, c_node, 1)
 *     if hasProxy(c_node):
 *         return 0             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":197
 *     if hasProxy(c_node):
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":198
 *         return 0
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":191
 *         return NULL
 * 
 * cdef int canDeallocateChildNodes(xmlNode* c_parent):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = c_parent.children
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":203
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) nogil:             # <<<<<<<<<<<<<<
 *     u"""Copy the namespaces of all ancestors of c_from_node to c_to_node.
 *     """
 */

static void __pyx_f_4lxml_5etree__copyParentNamespaces(xmlNode *__pyx_v_c_from_node, xmlNode *__pyx_v_c_to_node) {
  xmlNode *__pyx_v_c_parent;
  xmlNs *__pyx_v_c_new_ns;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlNs *__pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":210
 *     cdef xmlNs* c_new_ns
 *     cdef int prefix_known
 *     c_parent = c_from_node.parent             # <<<<<<<<<<<<<<
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 */
  __pyx_t_1 = __pyx_v_c_from_node->parent;
  __pyx_v_c_parent = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":211
 *     cdef int prefix_known
 *     c_parent = c_from_node.parent
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or             # <<<<<<<<<<<<<<
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef
 */
  while (1) {
    if ((__pyx_v_c_parent != 0)) {
      __pyx_t_2 = (_isElementOrXInclude(__pyx_v_c_parent) != 0);
      if (!__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":212
 *     c_parent = c_from_node.parent
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_new_ns = c_parent.nsDef
 *         while c_new_ns:
 */
        __pyx_t_3 = ((__pyx_v_c_parent->type == XML_DOCUMENT_NODE) != 0);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = (__pyx_v_c_parent != 0);
    }
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":213
 *     while c_parent and (tree._isElementOrXInclude(c_parent) or
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef             # <<<<<<<<<<<<<<
 *         while c_new_ns:
 *             # libxml2 will check if the prefix is already defined
 */
    __pyx_t_5 = __pyx_v_c_parent->nsDef;
    __pyx_v_c_new_ns = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":214
 *                         c_parent.type == tree.XML_DOCUMENT_NODE):
 *         c_new_ns = c_parent.nsDef
 *         while c_new_ns:             # <<<<<<<<<<<<<<
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_c_new_ns != 0);
      if (!__pyx_t_2) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":216
 *         while c_new_ns:
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)             # <<<<<<<<<<<<<<
 *             c_new_ns = c_new_ns.next
 *         c_parent = c_parent.parent
 */
      xmlNewNs(__pyx_v_c_to_node, __pyx_v_c_new_ns->href, __pyx_v_c_new_ns->prefix);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":217
 *             # libxml2 will check if the prefix is already defined
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 *             c_new_ns = c_new_ns.next             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 * 
 */
      __pyx_t_5 = __pyx_v_c_new_ns->next;
      __pyx_v_c_new_ns = __pyx_t_5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":218
 *             tree.xmlNewNs(c_to_node, c_new_ns.href, c_new_ns.prefix)
 *             c_new_ns = c_new_ns.next
 *         c_parent = c_parent.parent             # <<<<<<<<<<<<<<
 * 
 * ctypedef struct _nscache:
 */
    __pyx_t_1 = __pyx_v_c_parent->parent;
    __pyx_v_c_parent = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":203
 * # fix _Document references and namespaces when a node changes documents
 * 
 * cdef void _copyParentNamespaces(xmlNode* c_from_node, xmlNode* c_to_node) nogil:             # <<<<<<<<<<<<<<
 *     u"""Copy the namespaces of all ancestors of c_from_node to c_to_node.
 *     """
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":226
 *     size_t last
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:
 */

static int __pyx_f_4lxml_5etree__growNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache) {
  xmlNs **__pyx_v_c_ns_ptr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_growNsCache", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":228
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:             # <<<<<<<<<<<<<<
 *         c_ns_cache.size = 20
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_ns_cache->size == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":229
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:
 *         c_ns_cache.size = 20             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns_cache.size *= 2
 */
    __pyx_v_c_ns_cache->size = 20;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":231
 *         c_ns_cache.size = 20
 *     else:
 *         c_ns_cache.size *= 2             # <<<<<<<<<<<<<<
 *     c_ns_ptr = <xmlNs**> stdlib.realloc(
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 */
    __pyx_v_c_ns_cache->size = (__pyx_v_c_ns_cache->size * 2);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":232
 *     else:
 *         c_ns_cache.size *= 2
 *     c_ns_ptr = <xmlNs**> stdlib.realloc(             # <<<<<<<<<<<<<<
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:
 */
  __pyx_v_c_ns_ptr = ((xmlNs **)realloc(__pyx_v_c_ns_cache->new, (__pyx_v_c_ns_cache->size * (sizeof(xmlNs *)))));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":234
 *     c_ns_ptr = <xmlNs**> stdlib.realloc(
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns_cache.new = c_ns_ptr
 *         c_ns_ptr = <xmlNs**> stdlib.realloc(
 */
  __pyx_t_1 = ((__pyx_v_c_ns_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":235
 *         c_ns_cache.new, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.new = c_ns_ptr             # <<<<<<<<<<<<<<
 *         c_ns_ptr = <xmlNs**> stdlib.realloc(
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 */
    __pyx_v_c_ns_cache->new = __pyx_v_c_ns_ptr;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":236
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.new = c_ns_ptr
 *         c_ns_ptr = <xmlNs**> stdlib.realloc(             # <<<<<<<<<<<<<<
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:
 */
    __pyx_v_c_ns_ptr = ((xmlNs **)realloc(__pyx_v_c_ns_cache->old, (__pyx_v_c_ns_cache->size * (sizeof(xmlNs *)))));
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":238
 *         c_ns_ptr = <xmlNs**> stdlib.realloc(
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns_cache.old = c_ns_ptr
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_ns_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":239
 *             c_ns_cache.old, c_ns_cache.size * sizeof(xmlNs*))
 *     if c_ns_ptr is not NULL:
 *         c_ns_cache.old = c_ns_ptr             # <<<<<<<<<<<<<<
 *     else:
 *         stdlib.free(c_ns_cache.new)
 */
    __pyx_v_c_ns_cache->old = __pyx_v_c_ns_ptr;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":241
 *         c_ns_cache.old = c_ns_ptr
 *     else:
 *         stdlib.free(c_ns_cache.new)             # <<<<<<<<<<<<<<
 *         stdlib.free(c_ns_cache.old)
 *         raise MemoryError()
 */
    free(__pyx_v_c_ns_cache->new);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":242
 *     else:
 *         stdlib.free(c_ns_cache.new)
 *         stdlib.free(c_ns_cache.old)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     return 0
 */
    free(__pyx_v_c_ns_cache->old);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":243
 *         stdlib.free(c_ns_cache.new)
 *         stdlib.free(c_ns_cache.old)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":244
 *         stdlib.free(c_ns_cache.old)
 *         raise MemoryError()
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":226
 *     size_t last
 * 
 * cdef int _growNsCache(_nscache* c_ns_cache) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs** c_ns_ptr
 *     if c_ns_cache.size == 0:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._growNsCache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":246
 *     return 0
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__appendToNsCache(__pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs *__pyx_v_c_old_ns, xmlNs *__pyx_v_c_new_ns) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendToNsCache", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":248
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:             # <<<<<<<<<<<<<<
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 */
  __pyx_t_1 = ((__pyx_v_c_ns_cache->last >= __pyx_v_c_ns_cache->size) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":249
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)             # <<<<<<<<<<<<<<
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__growNsCache(__pyx_v_c_ns_cache); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":250
 *     if c_ns_cache.last >= c_ns_cache.size:
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns             # <<<<<<<<<<<<<<
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns
 *     c_ns_cache.last += 1
 */
  (__pyx_v_c_ns_cache->old[__pyx_v_c_ns_cache->last]) = __pyx_v_c_old_ns;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":251
 *         _growNsCache(c_ns_cache)
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns             # <<<<<<<<<<<<<<
 *     c_ns_cache.last += 1
 * 
 */
  (__pyx_v_c_ns_cache->new[__pyx_v_c_ns_cache->last]) = __pyx_v_c_new_ns;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":252
 *     c_ns_cache.old[c_ns_cache.last] = c_old_ns
 *     c_ns_cache.new[c_ns_cache.last] = c_new_ns
 *     c_ns_cache.last += 1             # <<<<<<<<<<<<<<
 * 
 * cdef int _stripRedundantNamespaceDeclarations(
 */
  __pyx_v_c_ns_cache->last = (__pyx_v_c_ns_cache->last + 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":246
 *     return 0
 * 
 * cdef inline int _appendToNsCache(_nscache* c_ns_cache,             # <<<<<<<<<<<<<<
 *                                  xmlNs* c_old_ns, xmlNs* c_new_ns) except -1:
 *     if c_ns_cache.last >= c_ns_cache.size:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._appendToNsCache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":254
 *     c_ns_cache.last += 1
 * 
 * cdef int _stripRedundantNamespaceDeclarations(             # <<<<<<<<<<<<<<
 *     xmlNode* c_element, _nscache* c_ns_cache, xmlNs** c_del_ns_list) except -1:
 *     u"""Removes namespace declarations from an element that are already
 */

static int __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(xmlNode *__pyx_v_c_element, __pyx_t_4lxml_5etree__nscache *__pyx_v_c_ns_cache, xmlNs **__pyx_v_c_del_ns_list) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_ns_next;
  xmlNs **__pyx_v_c_nsdef;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNs *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stripRedundantNamespaceDeclarations", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":264
 *     cdef xmlNs** c_nsdef
 *     # use a xmlNs** to handle assignments to "c_element.nsDef" correctly
 *     c_nsdef = &c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef[0] is not NULL:
 *         c_ns = tree.xmlSearchNsByHref(
 */
  __pyx_v_c_nsdef = (&__pyx_v_c_element->nsDef);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":265
 *     # use a xmlNs** to handle assignments to "c_element.nsDef" correctly
 *     c_nsdef = &c_element.nsDef
 *     while c_nsdef[0] is not NULL:             # <<<<<<<<<<<<<<
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_c_nsdef[0]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":266
 *     c_nsdef = &c_element.nsDef
 *     while c_nsdef[0] is not NULL:
 *         c_ns = tree.xmlSearchNsByHref(             # <<<<<<<<<<<<<<
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 *         if c_ns is NULL:
 */
    __pyx_v_c_ns = xmlSearchNsByHref(__pyx_v_c_element->doc, __pyx_v_c_element->parent, (__pyx_v_c_nsdef[0])->href);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":268
 *         c_ns = tree.xmlSearchNsByHref(
 *             c_element.doc, c_element.parent, c_nsdef[0].href)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
 */
    __pyx_t_1 = ((__pyx_v_c_ns == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":270
 *         if c_ns is NULL:
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])             # <<<<<<<<<<<<<<
 *             c_nsdef = &c_nsdef[0].next
 *         else:
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, (__pyx_v_c_nsdef[0]), (__pyx_v_c_nsdef[0])); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":271
 *             # new namespace href => keep and cache the ns declaration
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_nsdef[0])
 *             c_nsdef = &c_nsdef[0].next             # <<<<<<<<<<<<<<
 *         else:
 *             # known namespace href => cache mapping and strip old ns
 */
      __pyx_v_c_nsdef = (&(__pyx_v_c_nsdef[0])->next);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":274
 *         else:
 *             # known namespace href => cache mapping and strip old ns
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns)             # <<<<<<<<<<<<<<
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache(__pyx_v_c_ns_cache, (__pyx_v_c_nsdef[0]), __pyx_v_c_ns); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":276
 *             _appendToNsCache(c_ns_cache, c_nsdef[0], c_ns)
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next             # <<<<<<<<<<<<<<
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]
 */
      __pyx_t_3 = (__pyx_v_c_nsdef[0])->next;
      __pyx_v_c_ns_next = __pyx_t_3;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":277
 *             # cut out c_nsdef.next and prepend it to garbage chain
 *             c_ns_next = c_nsdef[0].next
 *             c_nsdef[0].next = c_del_ns_list[0]             # <<<<<<<<<<<<<<
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
 */
      (__pyx_v_c_nsdef[0])->next = (__pyx_v_c_del_ns_list[0]);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":278
 *             c_ns_next = c_nsdef[0].next
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]             # <<<<<<<<<<<<<<
 *             c_nsdef[0] = c_ns_next
 *     return 0
 */
      (__pyx_v_c_del_ns_list[0]) = (__pyx_v_c_nsdef[0]);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":279
 *             c_nsdef[0].next = c_del_ns_list[0]
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      (__pyx_v_c_nsdef[0]) = __pyx_v_c_ns_next;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":280
 *             c_del_ns_list[0] = c_nsdef[0]
 *             c_nsdef[0] = c_ns_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":254
 *     c_ns_cache.last += 1
 * 
 * cdef int _stripRedundantNamespaceDeclarations(             # <<<<<<<<<<<<<<
 *     xmlNode* c_element, _nscache* c_ns_cache, xmlNs** c_del_ns_list) except -1:
 *     u"""Removes namespace declarations from an element that are already
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._stripRedundantNamespaceDeclarations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":282
 *     return 0
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     u"""Fix the xmlNs pointers of a node and its subtree that were moved.
 */

static int __pyx_f_4lxml_5etree_moveNodeToDocument(struct LxmlDocument *__pyx_v_doc, xmlDoc *__pyx_v_c_source_doc, xmlNode *__pyx_v_c_element) {
  xmlNode *__pyx_v_c_start_node;
  xmlNode *__pyx_v_c_node;
  __pyx_t_4lxml_5etree__nscache __pyx_v_c_ns_cache;
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_del_ns_list;
  size_t __pyx_v_i;
  size_t __pyx_v_proxy_count;
  struct LxmlElement *__pyx_v_proxy = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlNs *__pyx_t_7;
  xmlNode *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("moveNodeToDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":321
 *     cdef xmlNs* c_nsdef
 *     cdef xmlNs* c_del_ns_list
 *     cdef size_t i, proxy_count = 0             # <<<<<<<<<<<<<<
 * 
 *     if not tree._isElementOrXInclude(c_element):
 */
  __pyx_v_proxy_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":323
 *     cdef size_t i, proxy_count = 0
 * 
 *     if not tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = ((!(_isElementOrXInclude(__pyx_v_c_element) != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":324
 * 
 *     if not tree._isElementOrXInclude(c_element):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_start_node = c_element
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":326
 *         return 0
 * 
 *     c_start_node = c_element             # <<<<<<<<<<<<<<
 *     c_del_ns_list = NULL
 * 
 */
  __pyx_v_c_start_node = __pyx_v_c_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":327
 * 
 *     c_start_node = c_element
 *     c_del_ns_list = NULL             # <<<<<<<<<<<<<<
 * 
 *     c_ns_cache.new = NULL
 */
  __pyx_v_c_del_ns_list = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":329
 *     c_del_ns_list = NULL
 * 
 *     c_ns_cache.new = NULL             # <<<<<<<<<<<<<<
 *     c_ns_cache.old = NULL
 *     c_ns_cache.size = 0
 */
  __pyx_v_c_ns_cache.new = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":330
 * 
 *     c_ns_cache.new = NULL
 *     c_ns_cache.old = NULL             # <<<<<<<<<<<<<<
 *     c_ns_cache.size = 0
 *     c_ns_cache.last = 0
 */
  __pyx_v_c_ns_cache.old = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":331
 *     c_ns_cache.new = NULL
 *     c_ns_cache.old = NULL
 *     c_ns_cache.size = 0             # <<<<<<<<<<<<<<
 *     c_ns_cache.last = 0
 * 
 */
  __pyx_v_c_ns_cache.size = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":332
 *     c_ns_cache.old = NULL
 *     c_ns_cache.size = 0
 *     c_ns_cache.last = 0             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 */
  __pyx_v_c_ns_cache.last = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":334
 *     c_ns_cache.last = 0
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":335
 * 
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         if hasProxy(c_element):
 *             proxy_count += 1
 */
  __pyx_t_1 = (_isElementOrXInclude(__pyx_v_c_element) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":336
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_element, 1)
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):             # <<<<<<<<<<<<<<
 *             proxy_count += 1
 * 
 */
    __pyx_t_1 = (__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_element) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":337
 *     if tree._isElementOrXInclude(c_element):
 *         if hasProxy(c_element):
 *             proxy_count += 1             # <<<<<<<<<<<<<<
 * 
 *         # 1) cut out namespaces defined here that are already known by
 */
      __pyx_v_proxy_count = (__pyx_v_proxy_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":341
 *         # 1) cut out namespaces defined here that are already known by
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *             _stripRedundantNamespaceDeclarations(
 *                 c_element, &c_ns_cache, &c_del_ns_list)
 */
    __pyx_t_1 = ((__pyx_v_c_element->nsDef != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":342
 *         #    the ancestors
 *         if c_element.nsDef is not NULL:
 *             _stripRedundantNamespaceDeclarations(             # <<<<<<<<<<<<<<
 *                 c_element, &c_ns_cache, &c_del_ns_list)
 * 
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree__stripRedundantNamespaceDeclarations(__pyx_v_c_element, (&__pyx_v_c_ns_cache), (&__pyx_v_c_del_ns_list)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":347
 *         # 2) make sure the namespaces of an element and its attributes
 *         #    are declared in this document (i.e. on the node or its parents)
 *         c_node = c_element             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_element;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":348
 *         #    are declared in this document (i.e. on the node or its parents)
 *         c_node = c_element
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.ns is not NULL:
 *                 c_ns = NULL
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":349
 *         c_node = c_element
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 c_ns = NULL
 *                 for i in range(c_ns_cache.last):
 */
      __pyx_t_1 = ((__pyx_v_c_node->ns != NULL) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":350
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 *                 c_ns = NULL             # <<<<<<<<<<<<<<
 *                 for i in range(c_ns_cache.last):
 *                     if c_node.ns is c_ns_cache.old[i]:
 */
        __pyx_v_c_ns = NULL;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":351
 *             if c_node.ns is not NULL:
 *                 c_ns = NULL
 *                 for i in range(c_ns_cache.last):             # <<<<<<<<<<<<<<
 *                     if c_node.ns is c_ns_cache.old[i]:
 *                         if (c_node.type == tree.XML_ATTRIBUTE_NODE
 */
        __pyx_t_3 = __pyx_v_c_ns_cache.last;
        for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
          __pyx_v_i = __pyx_t_4;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":352
 *                 c_ns = NULL
 *                 for i in range(c_ns_cache.last):
 *                     if c_node.ns is c_ns_cache.old[i]:             # <<<<<<<<<<<<<<
 *                         if (c_node.type == tree.XML_ATTRIBUTE_NODE
 *                                 and c_node.ns.prefix
 */
          __pyx_t_1 = ((__pyx_v_c_node->ns == (__pyx_v_c_ns_cache.old[__pyx_v_i])) != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":353
 *                 for i in range(c_ns_cache.last):
 *                     if c_node.ns is c_ns_cache.old[i]:
 *                         if (c_node.type == tree.XML_ATTRIBUTE_NODE             # <<<<<<<<<<<<<<
 *                                 and c_node.ns.prefix
 *                                 and not c_ns_cache.new[i].prefix):
 */
            __pyx_t_1 = ((__pyx_v_c_node->type == XML_ATTRIBUTE_NODE) != 0);
            if (__pyx_t_1) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":354
 *                     if c_node.ns is c_ns_cache.old[i]:
 *                         if (c_node.type == tree.XML_ATTRIBUTE_NODE
 *                                 and c_node.ns.prefix             # <<<<<<<<<<<<<<
 *                                 and not c_ns_cache.new[i].prefix):
 *                             # avoid dropping prefix from attributes
 */
              if ((__pyx_v_c_node->ns->prefix != 0)) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":355
 *                         if (c_node.type == tree.XML_ATTRIBUTE_NODE
 *                                 and c_node.ns.prefix
 *                                 and not c_ns_cache.new[i].prefix):             # <<<<<<<<<<<<<<
 *                             # avoid dropping prefix from attributes
 *                             continue
 */
                __pyx_t_5 = ((!((__pyx_v_c_ns_cache.new[__pyx_v_i])->prefix != 0)) != 0);
                __pyx_t_6 = __pyx_t_5;
              } else {
                __pyx_t_6 = (__pyx_v_c_node->ns->prefix != 0);
              }
              __pyx_t_5 = __pyx_t_6;
            } else {
              __pyx_t_5 = __pyx_t_1;
            }
            if (__pyx_t_5) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":357
 *                                 and not c_ns_cache.new[i].prefix):
 *                             # avoid dropping prefix from attributes
 *                             continue             # <<<<<<<<<<<<<<
 *                         c_ns = c_ns_cache.new[i]
 *                         break
 */
              goto __pyx_L10_continue;
            }

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":358
 *                             # avoid dropping prefix from attributes
 *                             continue
 *                         c_ns = c_ns_cache.new[i]             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
            __pyx_v_c_ns = (__pyx_v_c_ns_cache.new[__pyx_v_i]);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":359
 *                             continue
 *                         c_ns = c_ns_cache.new[i]
 *                         break             # <<<<<<<<<<<<<<
 * 
 *                 if not c_ns:
 */
            goto __pyx_L11_break;
          }
          __pyx_L10_continue:;
        }
        __pyx_L11_break:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":361
 *                         break
 * 
 *                 if not c_ns:             # <<<<<<<<<<<<<<
 *                     # not in cache or not acceptable
 *                     # => find a replacement from this document
 */
        __pyx_t_5 = ((!(__pyx_v_c_ns != 0)) != 0);
        if (__pyx_t_5) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":364
 *                     # not in cache or not acceptable
 *                     # => find a replacement from this document
 *                     c_ns = doc._findOrBuildNodeNs(             # <<<<<<<<<<<<<<
 *                         c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                         c_node.type == tree.XML_ATTRIBUTE_NODE)
 */
          __pyx_t_7 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_start_node, __pyx_v_c_node->ns->href, __pyx_v_c_node->ns->prefix, (__pyx_v_c_node->type == XML_ATTRIBUTE_NODE)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_v_c_ns = __pyx_t_7;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":367
 *                         c_start_node, c_node.ns.href, c_node.ns.prefix,
 *                         c_node.type == tree.XML_ATTRIBUTE_NODE)
 *                     _appendToNsCache(&c_ns_cache, c_node.ns, c_ns)             # <<<<<<<<<<<<<<
 *                 c_node.ns = c_ns
 * 
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree__appendToNsCache((&__pyx_v_c_ns_cache), __pyx_v_c_node->ns, __pyx_v_c_ns); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":368
 *                         c_node.type == tree.XML_ATTRIBUTE_NODE)
 *                     _appendToNsCache(&c_ns_cache, c_node.ns, c_ns)
 *                 c_node.ns = c_ns             # <<<<<<<<<<<<<<
 * 
 *             if c_node is c_element:
 */
        __pyx_v_c_node->ns = __pyx_v_c_ns;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":370
 *                 c_node.ns = c_ns
 * 
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # after the element, continue with its attributes
 *                 c_node = <xmlNode*>c_element.properties
 */
      __pyx_t_5 = ((__pyx_v_c_node == __pyx_v_c_element) != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":372
 *             if c_node is c_element:
 *                 # after the element, continue with its attributes
 *                 c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *             else:
 *                 c_node = c_node.next
 */
        __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);
        goto __pyx_L15;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":374
 *                 c_node = <xmlNode*>c_element.properties
 *             else:
 *                 c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_element)
 * 
 */
        __pyx_t_8 = __pyx_v_c_node->next;
        __pyx_v_c_node = __pyx_t_8;
      }
      __pyx_L15:;
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":375
 *             else:
 *                 c_node = c_node.next
 *     tree.END_FOR_EACH_FROM(c_element)             # <<<<<<<<<<<<<<
 * 
 *     # free now unused namespace declarations
 */
  END_FOR_EACH_FROM(__pyx_v_c_element);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":378
 * 
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNsList(c_del_ns_list)
 * 
 */
  __pyx_t_5 = ((__pyx_v_c_del_ns_list != NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":379
 *     # free now unused namespace declarations
 *     if c_del_ns_list is not NULL:
 *         tree.xmlFreeNsList(c_del_ns_list)             # <<<<<<<<<<<<<<
 * 
 *     # cleanup
 */
    xmlFreeNsList(__pyx_v_c_del_ns_list);
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":382
 * 
 *     # cleanup
 *     if c_ns_cache.new is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_ns_cache.new)
 *     if c_ns_cache.old is not NULL:
 */
  __pyx_t_5 = ((__pyx_v_c_ns_cache.new != NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":383
 *     # cleanup
 *     if c_ns_cache.new is not NULL:
 *         stdlib.free(c_ns_cache.new)             # <<<<<<<<<<<<<<
 *     if c_ns_cache.old is not NULL:
 *         stdlib.free(c_ns_cache.old)
 */
    free(__pyx_v_c_ns_cache.new);
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":384
 *     if c_ns_cache.new is not NULL:
 *         stdlib.free(c_ns_cache.new)
 *     if c_ns_cache.old is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_ns_cache.old)
 * 
 */
  __pyx_t_5 = ((__pyx_v_c_ns_cache.old != NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":385
 *         stdlib.free(c_ns_cache.new)
 *     if c_ns_cache.old is not NULL:
 *         stdlib.free(c_ns_cache.old)             # <<<<<<<<<<<<<<
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 */
    free(__pyx_v_c_ns_cache.old);
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":388
 * 
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:             # <<<<<<<<<<<<<<
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)
 * 
 */
  __pyx_t_5 = ((__pyx_v_doc->_c_doc->dict != __pyx_v_c_source_doc->dict) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":389
 *     # 3) fix the names in the tree if we moved it from a different thread
 *     if doc._c_doc.dict is not c_source_doc.dict:
 *         fixThreadDictNames(c_start_node, c_source_doc.dict, doc._c_doc.dict)             # <<<<<<<<<<<<<<
 * 
 *     # 4) fix _Document references
 */
    __pyx_f_4lxml_5etree_fixThreadDictNames(__pyx_v_c_start_node, __pyx_v_c_source_doc->dict, __pyx_v_doc->_c_doc->dict);
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":393
 *     # 4) fix _Document references
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:             # <<<<<<<<<<<<<<
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)
 */
  __pyx_t_5 = ((__pyx_v_proxy_count > 0) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":394
 *     #    (and potentially deallocate the source document)
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:             # <<<<<<<<<<<<<<
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
 */
    __pyx_t_5 = ((__pyx_v_proxy_count == 1) != 0);
    if (__pyx_t_5) {
      __pyx_t_1 = ((__pyx_v_c_start_node->_private != NULL) != 0);
      __pyx_t_6 = __pyx_t_1;
    } else {
      __pyx_t_6 = __pyx_t_5;
    }
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":395
 *     if proxy_count > 0:
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)             # <<<<<<<<<<<<<<
 *             if proxy is not None:
 *                 if proxy._doc is not doc:
 */
      __pyx_t_9 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_start_node)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_v_proxy = ((struct LxmlElement *)__pyx_t_9);
      __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":396
 *         if proxy_count == 1 and c_start_node._private is not NULL:
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:             # <<<<<<<<<<<<<<
 *                 if proxy._doc is not doc:
 *                     proxy._doc = doc
 */
      __pyx_t_6 = (((PyObject *)__pyx_v_proxy) != Py_None);
      __pyx_t_5 = (__pyx_t_6 != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":397
 *             proxy = getProxy(c_start_node)
 *             if proxy is not None:
 *                 if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                     proxy._doc = doc
 *             else:
 */
        __pyx_t_5 = (__pyx_v_proxy->_doc != __pyx_v_doc);
        __pyx_t_6 = (__pyx_t_5 != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":398
 *             if proxy is not None:
 *                 if proxy._doc is not doc:
 *                     proxy._doc = doc             # <<<<<<<<<<<<<<
 *             else:
 *                 fixElementDocument(c_start_node, doc, proxy_count)
 */
          __Pyx_INCREF(((PyObject *)__pyx_v_doc));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
          __Pyx_GOTREF(__pyx_v_proxy->_doc);
          __Pyx_DECREF(((PyObject *)__pyx_v_proxy->_doc));
          __pyx_v_proxy->_doc = __pyx_v_doc;
          goto __pyx_L23;
        }
        __pyx_L23:;
        goto __pyx_L22;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":400
 *                     proxy._doc = doc
 *             else:
 *                 fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)
 */
        __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_v_proxy_count);
      }
      __pyx_L22:;
      goto __pyx_L21;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":402
 *                 fixElementDocument(c_start_node, doc, proxy_count)
 *         else:
 *             fixElementDocument(c_start_node, doc, proxy_count)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_f_4lxml_5etree_fixElementDocument(__pyx_v_c_start_node, __pyx_v_doc, __pyx_v_proxy_count);
    }
    __pyx_L21:;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":404
 *             fixElementDocument(c_start_node, doc, proxy_count)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":282
 *     return 0
 * 
 * cdef int moveNodeToDocument(_Document doc, xmlDoc* c_source_doc,             # <<<<<<<<<<<<<<
 *                             xmlNode* c_element) except -1:
 *     u"""Fix the xmlNs pointers of a node and its subtree that were moved.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.moveNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":407
 * 
 * 
 * cdef void fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element
 */

static void __pyx_f_4lxml_5etree_fixElementDocument(xmlNode *__pyx_v_c_element, struct LxmlDocument *__pyx_v_doc, size_t __pyx_v_proxy_count) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_v_proxy = 0;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fixElementDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":409
 * cdef void fixElementDocument(xmlNode* c_element, _Document doc,
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 */
  __pyx_v_c_node = __pyx_v_c_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":410
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_proxy = ((struct LxmlElement *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":411
 *     cdef xmlNode* c_node = c_element
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":412
 *     cdef _Element proxy = None # init-to-None required due to fake-loop below
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:             # <<<<<<<<<<<<<<
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
 */
  __pyx_t_1 = ((__pyx_v_c_node->_private != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":413
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)             # <<<<<<<<<<<<<<
 *         if proxy is not None:
 *             if proxy._doc is not doc:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_proxy, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":414
 *     if c_node._private is not NULL:
 *         proxy = getProxy(c_node)
 *         if proxy is not None:             # <<<<<<<<<<<<<<
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_proxy) != Py_None);
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":415
 *         proxy = getProxy(c_node)
 *         if proxy is not None:
 *             if proxy._doc is not doc:             # <<<<<<<<<<<<<<
 *                 proxy._doc = doc
 *             proxy_count -= 1
 */
      __pyx_t_3 = (__pyx_v_proxy->_doc != __pyx_v_doc);
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":416
 *         if proxy is not None:
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc             # <<<<<<<<<<<<<<
 *             proxy_count -= 1
 *             if proxy_count == 0:
 */
        __Pyx_INCREF(((PyObject *)__pyx_v_doc));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
        __Pyx_GOTREF(__pyx_v_proxy->_doc);
        __Pyx_DECREF(((PyObject *)__pyx_v_proxy->_doc));
        __pyx_v_proxy->_doc = __pyx_v_doc;
        goto __pyx_L5;
      }
      __pyx_L5:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":417
 *             if proxy._doc is not doc:
 *                 proxy._doc = doc
 *             proxy_count -= 1             # <<<<<<<<<<<<<<
 *             if proxy_count == 0:
 *                 return
 */
      __pyx_v_proxy_count = (__pyx_v_proxy_count - 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":418
 *                 proxy._doc = doc
 *             proxy_count -= 1
 *             if proxy_count == 0:             # <<<<<<<<<<<<<<
 *                 return
 *     tree.END_FOR_EACH_FROM(c_node)
 */
      __pyx_t_1 = ((__pyx_v_proxy_count == 0) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":419
 *             proxy_count -= 1
 *             if proxy_count == 0:
 *                 return             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
        goto __pyx_L0;
      }
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":420
 *             if proxy_count == 0:
 *                 return
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":407
 * 
 * 
 * cdef void fixElementDocument(xmlNode* c_element, _Document doc,             # <<<<<<<<<<<<<<
 *                              size_t proxy_count):
 *     cdef xmlNode* c_node = c_element
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree.fixElementDocument", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":422
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) nogil:
 */

static void __pyx_f_4lxml_5etree_fixThreadDictNames(xmlNode *__pyx_v_c_element, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":429
 *     # this should only be called when the element is based on a
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 */
  switch (__pyx_v_c_element->type) {
    case XML_DOCUMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":430
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 */
    case XML_HTML_DOCUMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":429
 *     # this should only be called when the element is based on a
 *     # different libxml2 tag name dictionary
 *     if c_element.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 */
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":432
 *             c_element.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         c_element = c_element.children
 *         while c_element is not NULL:
 */
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":433
 *         # may define "xml" namespace
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         c_element = c_element.children             # <<<<<<<<<<<<<<
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 */
    __pyx_t_2 = __pyx_v_c_element->children;
    __pyx_v_c_element = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":434
 *         fixThreadDictNsForNode(c_element, c_src_dict, c_dict)
 *         c_element = c_element.children
 *         while c_element is not NULL:             # <<<<<<<<<<<<<<
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_element != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":435
 *         c_element = c_element.children
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
 */
      __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":436
 *         while c_element is not NULL:
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next             # <<<<<<<<<<<<<<
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 */
      __pyx_t_2 = __pyx_v_c_element->next;
      __pyx_v_c_element = __pyx_t_2;
    }
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":437
 *             fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
 */
  __pyx_t_1 = (_isElementOrXInclude(__pyx_v_c_element) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":438
 *             c_element = c_element.next
 *     elif tree._isElementOrXInclude(c_element):
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,
 */
    __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(__pyx_v_c_element, __pyx_v_c_src_dict, __pyx_v_c_dict);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":422
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 * cdef void fixThreadDictNames(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                              tree.xmlDict* c_src_dict,
 *                              tree.xmlDict* c_dict) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":440
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) nogil:
 */

static void __pyx_f_4lxml_5etree_fixThreadDictNamesForNode(xmlNode *__pyx_v_c_element, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":443
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) nogil:
 *     cdef xmlNode* c_node = c_element             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.name is not NULL:
 */
  __pyx_v_c_node = __pyx_v_c_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":444
 *                                     tree.xmlDict* c_dict) nogil:
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.name is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 */
  BEGIN_FOR_EACH_FROM(__pyx_v_c_element, __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":445
 *     cdef xmlNode* c_node = c_element
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 */
  __pyx_t_1 = ((__pyx_v_c_node->name != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":446
 *     tree.BEGIN_FOR_EACH_FROM(c_element, c_node, 1)
 *     if c_node.name is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(
 */
    __pyx_f_4lxml_5etree_fixThreadDictNameForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":451
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 */
  switch (__pyx_v_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":447
 *     if c_node.name is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):             # <<<<<<<<<<<<<<
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 */
    case XML_ELEMENT_NODE:
    case XML_XINCLUDE_START:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":448
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *     if c_node.type in (tree.XML_ELEMENT_NODE, tree.XML_XINCLUDE_START):
 *         fixThreadDictNamesForAttributes(             # <<<<<<<<<<<<<<
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 */
    __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(__pyx_v_c_node->properties, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":450
 *         fixThreadDictNamesForAttributes(
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
 */
    __pyx_f_4lxml_5etree_fixThreadDictNsForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":451
 *             c_node.properties, c_src_dict, c_dict)
 *         fixThreadDictNsForNode(c_node, c_src_dict, c_dict)
 *     elif c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 */
    case XML_TEXT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":453
 *     elif c_node.type == tree.XML_TEXT_NODE:
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 */
    __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);
    break;
    default: break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":454
 *         # libxml2's SAX2 parser interns some indentation space
 *         fixThreadDictContentForNode(c_node, c_src_dict, c_dict)
 *     tree.END_FOR_EACH_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,
 */
  END_FOR_EACH_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":440
 *         fixThreadDictNamesForNode(c_element, c_src_dict, c_dict)
 * 
 * cdef void fixThreadDictNamesForNode(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                     tree.xmlDict* c_src_dict,
 *                                     tree.xmlDict* c_dict) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":456
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNamesForAttributes(xmlAttr *__pyx_v_c_attr, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_node;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":460
 *                                                  tree.xmlDict* c_dict) nogil:
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 */
  __pyx_v_c_node = ((xmlNode *)__pyx_v_c_attr);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":461
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":462
 *     cdef xmlNode* c_node = <xmlNode*>c_attr
 *     while c_node is not NULL:
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
 */
    __pyx_f_4lxml_5etree_fixThreadDictNameForNode(__pyx_v_c_node, __pyx_v_c_src_dict, __pyx_v_c_dict);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":464
 *         fixThreadDictNameForNode(c_node, c_src_dict, c_dict)
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 */
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":465
 *         # libxml2 keeps some (!) attribute values in the dict
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":466
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 *         c_node = c_node.next
 */
      __pyx_f_4lxml_5etree_fixThreadDictContentForNode(__pyx_v_c_child, __pyx_v_c_src_dict, __pyx_v_c_dict);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":467
 *         while c_child is not NULL:
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 * 
 */
      __pyx_t_2 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":468
 *             fixThreadDictContentForNode(c_child, c_src_dict, c_dict)
 *             c_child = c_child.next
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictNameForNode(xmlNode* c_node,
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":456
 *     tree.END_FOR_EACH_FROM(c_node)
 * 
 * cdef inline void fixThreadDictNamesForAttributes(tree.xmlAttr* c_attr,             # <<<<<<<<<<<<<<
 *                                                  tree.xmlDict* c_src_dict,
 *                                                  tree.xmlDict* c_dict) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":470
 *         c_node = c_node.next
 * 
 * cdef inline void fixThreadDictNameForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                           tree.xmlDict* c_src_dict,
 *                                           tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNameForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  const xmlChar *__pyx_v_c_name;
  const xmlChar *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":473
 *                                           tree.xmlDict* c_src_dict,
 *                                           tree.xmlDict* c_dict) nogil:
 *     cdef const_xmlChar* c_name = c_node.name             # <<<<<<<<<<<<<<
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \
 */
  __pyx_t_1 = __pyx_v_c_node->name;
  __pyx_v_c_name = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":474
 *                                           tree.xmlDict* c_dict) nogil:
 *     cdef const_xmlChar* c_name = c_node.name
 *     if c_name is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.type != tree.XML_TEXT_NODE and \
 *            c_node.type != tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = ((__pyx_v_c_name != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":475
 *     cdef const_xmlChar* c_name = c_node.name
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \             # <<<<<<<<<<<<<<
 *            c_node.type != tree.XML_COMMENT_NODE:
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 */
    switch (__pyx_v_c_node->type) {
      case XML_TEXT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":476
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \
 *            c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 *             # c_name can be NULL on memory error, but we don't handle that here
 */
      case XML_COMMENT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":475
 *     cdef const_xmlChar* c_name = c_node.name
 *     if c_name is not NULL and \
 *            c_node.type != tree.XML_TEXT_NODE and \             # <<<<<<<<<<<<<<
 *            c_node.type != tree.XML_COMMENT_NODE:
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 */
      __pyx_t_3 = 0;
      break;
      default:
      __pyx_t_3 = 1;
      break;
    }
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":477
 *            c_node.type != tree.XML_TEXT_NODE and \
 *            c_node.type != tree.XML_COMMENT_NODE:
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):             # <<<<<<<<<<<<<<
 *             # c_name can be NULL on memory error, but we don't handle that here
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)
 */
    __pyx_t_4 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->name) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":479
 *         if tree.xmlDictOwns(c_src_dict, c_node.name):
 *             # c_name can be NULL on memory error, but we don't handle that here
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)             # <<<<<<<<<<<<<<
 *             if c_name is not NULL:
 *                 c_node.name = c_name
 */
      __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_name, -1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":480
 *             # c_name can be NULL on memory error, but we don't handle that here
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)
 *             if c_name is not NULL:             # <<<<<<<<<<<<<<
 *                 c_node.name = c_name
 * 
 */
      __pyx_t_4 = ((__pyx_v_c_name != NULL) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":481
 *             c_name = tree.xmlDictLookup(c_dict, c_name, -1)
 *             if c_name is not NULL:
 *                 c_node.name = c_name             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,
 */
        __pyx_v_c_node->name = __pyx_v_c_name;
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":470
 *         c_node = c_node.next
 * 
 * cdef inline void fixThreadDictNameForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                           tree.xmlDict* c_src_dict,
 *                                           tree.xmlDict* c_dict) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":483
 *                 c_node.name = c_name
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictContentForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":486
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) nogil:
 *     if c_node.content is not NULL and \             # <<<<<<<<<<<<<<
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 */
  __pyx_t_1 = ((__pyx_v_c_node->content != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":487
 *                                              tree.xmlDict* c_dict) nogil:
 *     if c_node.content is not NULL and \
 *            c_node.content is not <xmlChar*>&c_node.properties:             # <<<<<<<<<<<<<<
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 *             # result can be NULL on memory error, but we don't handle that here
 */
    __pyx_t_2 = ((__pyx_v_c_node->content != ((xmlChar *)(&__pyx_v_c_node->properties))) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":488
 *     if c_node.content is not NULL and \
 *            c_node.content is not <xmlChar*>&c_node.properties:
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):             # <<<<<<<<<<<<<<
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)
 */
    __pyx_t_3 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_node->content) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":490
 *         if tree.xmlDictOwns(c_src_dict, c_node.content):
 *             # result can be NULL on memory error, but we don't handle that here
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,
 */
      __pyx_v_c_node->content = ((xmlChar *)xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->content, -1));
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":483
 *                 c_node.name = c_name
 * 
 * cdef inline void fixThreadDictContentForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                              tree.xmlDict* c_src_dict,
 *                                              tree.xmlDict* c_dict) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":492
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) nogil:
 */

static CYTHON_INLINE void __pyx_f_4lxml_5etree_fixThreadDictNsForNode(xmlNode *__pyx_v_c_node, xmlDict *__pyx_v_c_src_dict, xmlDict *__pyx_v_c_dict) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_t_1;
  int __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":495
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         if c_ns.href is not NULL:
 */
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":496
 *                                         tree.xmlDict* c_dict) nogil:
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns.href is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_ns != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":497
 *     cdef xmlNs* c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         if c_ns.href is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 */
    __pyx_t_2 = ((__pyx_v_c_ns->href != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":498
 *     while c_ns is not NULL:
 *         if c_ns.href is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):             # <<<<<<<<<<<<<<
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 *         if c_ns.prefix is not NULL:
 */
      __pyx_t_2 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_ns->href) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":499
 *         if c_ns.href is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)             # <<<<<<<<<<<<<<
 *         if c_ns.prefix is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 */
        __pyx_v_c_ns->href = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_ns->href, -1);
        goto __pyx_L6;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":500
 *             if tree.xmlDictOwns(c_src_dict, c_ns.href):
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 *         if c_ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)
 */
    __pyx_t_2 = ((__pyx_v_c_ns->prefix != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":501
 *                 c_ns.href = tree.xmlDictLookup(c_dict, c_ns.href, -1)
 *         if c_ns.prefix is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):             # <<<<<<<<<<<<<<
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)
 *         c_ns = c_ns.next
 */
      __pyx_t_2 = (xmlDictOwns(__pyx_v_c_src_dict, __pyx_v_c_ns->prefix) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":502
 *         if c_ns.prefix is not NULL:
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 */
        __pyx_v_c_ns->prefix = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_ns->prefix, -1);
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":503
 *             if tree.xmlDictOwns(c_src_dict, c_ns.prefix):
 *                 c_ns.prefix = tree.xmlDictLookup(c_dict, c_ns.prefix, -1)
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 */
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/proxy.pxi":492
 *             c_node.content = <xmlChar*>tree.xmlDictLookup(c_dict, c_node.content, -1)
 * 
 * cdef inline void fixThreadDictNsForNode(xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                         tree.xmlDict* c_src_dict,
 *                                         tree.xmlDict* c_dict) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":11
 *     pass
 * 
 * cdef void displayNode(xmlNode* c_node, indent):             # <<<<<<<<<<<<<<
 *     # to help with debugging
 *     cdef xmlNode* c_child
 */

static void __pyx_f_4lxml_5etree_displayNode(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_indent) {
  xmlNode *__pyx_v_c_child;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("displayNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":14
 *     # to help with debugging
 *     cdef xmlNode* c_child
 *     try:             # <<<<<<<<<<<<<<
 *         print indent * u' ', <long>c_node
 *         c_child = c_node.children
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":15
 *     cdef xmlNode* c_child
 *     try:
 *         print indent * u' ', <long>c_node             # <<<<<<<<<<<<<<
 *         c_child = c_node.children
 *         while c_child is not NULL:
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_indent, __pyx_kp_u__14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_From_long(((long)__pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L4_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_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    if (__Pyx_Print(0, __pyx_t_3, 1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":16
 *     try:
 *         print indent * u' ', <long>c_node
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)
 */
    __pyx_t_4 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_4;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":17
 *         print indent * u' ', <long>c_node
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             displayNode(c_child, indent + 1)
 *             c_child = c_child.next
 */
    while (1) {
      __pyx_t_5 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_5) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":18
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 *     finally:
 */
      __pyx_t_3 = PyNumber_Add(__pyx_v_indent, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_f_4lxml_5etree_displayNode(__pyx_v_c_child, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":19
 *         while c_child is not NULL:
 *             displayNode(c_child, indent + 1)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any exceptions
 */
      __pyx_t_4 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_4;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":21
 *             c_child = c_child.next
 *     finally:
 *         return  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L8_return;
      }
      __pyx_L8_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":11
 *     pass
 * 
 * cdef void displayNode(xmlNode* c_node, indent):             # <<<<<<<<<<<<<<
 *     # to help with debugging
 *     cdef xmlNode* c_child
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":23
 *         return  # swallow any exceptions
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidNode(struct LxmlElement *__pyx_v_element) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertValidNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":24
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_element->_c_node != NULL) != 0))) {
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_element));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_element));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_invalid_Element_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":23
 *         return  # swallow any exceptions
 * 
 * cdef inline int _assertValidNode(_Element element) except -1:             # <<<<<<<<<<<<<<
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._assertValidNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":26
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDoc(struct LxmlDocument *__pyx_v_doc) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertValidDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":27
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentOrRaise(object input):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_doc->_c_doc != NULL) != 0))) {
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_doc));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_doc));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_invalid_Document_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":26
 *     assert element._c_node is not NULL, u"invalid Element proxy at %s" % id(element)
 * 
 * cdef inline int _assertValidDoc(_Document doc) except -1:             # <<<<<<<<<<<<<<
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._assertValidDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":29
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     u"""Call this to get the document of a _Document, _ElementTree or _Element
 *     object, or to raise an exception if it can't be determined.
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__documentOrRaise(PyObject *__pyx_v_input) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  const char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_documentOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":36
 *     """
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":37
 *     cdef _Document doc
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
 */
    __pyx_t_2 = (((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node) != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":38
 *     if isinstance(input, _ElementTree):
 *         if (<_ElementTree>input)._context_node is not None:
 *             doc = (<_ElementTree>input)._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
 */
      __pyx_t_3 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node->_doc);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":40
 *             doc = (<_ElementTree>input)._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_doc = ((struct LxmlDocument *)Py_None);
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":41
 *         else:
 *             doc = None
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":42
 *             doc = None
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input
 */
    __pyx_t_3 = ((PyObject *)((struct LxmlElement *)__pyx_v_input)->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":43
 *     elif isinstance(input, _Element):
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         doc = <_Document>input
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":44
 *         doc = (<_Element>input)._doc
 *     elif isinstance(input, _Document):
 *         doc = <_Document>input             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 */
    __pyx_t_3 = __pyx_v_input;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":47
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input).decode('utf8')             # <<<<<<<<<<<<<<
 *     if doc is None:
 *         raise ValueError, u"Input object has no document: %s" % \
 */
    __pyx_t_4 = _fqtypename(__pyx_v_input);
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":46
 *         doc = <_Document>input
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(input).decode('utf8')
 *     if doc is None:
 */
    __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_Invalid_input_object_s, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":48
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input).decode('utf8')
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Input object has no document: %s" % \
 *             python._fqtypename(input).decode('utf8')
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":50
 *     if doc is None:
 *         raise ValueError, u"Input object has no document: %s" % \
 *             python._fqtypename(input).decode('utf8')             # <<<<<<<<<<<<<<
 *     _assertValidDoc(doc)
 *     return doc
 */
    __pyx_t_4 = _fqtypename(__pyx_v_input);
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":49
 *             python._fqtypename(input).decode('utf8')
 *     if doc is None:
 *         raise ValueError, u"Input object has no document: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(input).decode('utf8')
 *     _assertValidDoc(doc)
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Input_object_has_no_document_s, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":51
 *         raise ValueError, u"Input object has no document: %s" % \
 *             python._fqtypename(input).decode('utf8')
 *     _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *     return doc
 * 
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":52
 *             python._fqtypename(input).decode('utf8')
 *     _assertValidDoc(doc)
 *     return doc             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _rootNodeOrRaise(object input):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __pyx_r = __pyx_v_doc;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":29
 *     assert doc._c_doc is not NULL, u"invalid Document proxy at %s" % id(doc)
 * 
 * cdef _Document _documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     u"""Call this to get the document of a _Document, _ElementTree or _Element
 *     object, or to raise an exception if it can't be determined.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._documentOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":54
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     u"""Call this to get the root node of a _Document, _ElementTree or
 *      _Element object, or to raise an exception if it can't be determined.
 */

static struct LxmlElement *__pyx_f_4lxml_5etree__rootNodeOrRaise(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_v_node = 0;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  const char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rootNodeOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":61
 *      """
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):             # <<<<<<<<<<<<<<
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":62
 *     cdef _Element node
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 */
    __pyx_t_3 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_input)->_context_node);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":63
 *     if isinstance(input, _ElementTree):
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):             # <<<<<<<<<<<<<<
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":64
 *         node = (<_ElementTree>input)._context_node
 *     elif isinstance(input, _Element):
 *         node = <_Element>input             # <<<<<<<<<<<<<<
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()
 */
    __pyx_t_3 = __pyx_v_input;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":65
 *     elif isinstance(input, _Element):
 *         node = <_Element>input
 *     elif isinstance(input, _Document):             # <<<<<<<<<<<<<<
 *         node = (<_Document>input).getroot()
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_input, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":66
 *         node = <_Element>input
 *     elif isinstance(input, _Document):
 *         node = (<_Document>input).getroot()             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(((struct LxmlDocument *)__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":69
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input).decode('utf8')             # <<<<<<<<<<<<<<
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 */
    __pyx_t_4 = _fqtypename(__pyx_v_input);
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":68
 *         node = (<_Document>input).getroot()
 *     else:
 *         raise TypeError, u"Invalid input object: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(input).decode('utf8')
 *     if (node is None or not node._c_node or
 */
    __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_Invalid_input_object_s, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":70
 *         raise TypeError, u"Invalid input object: %s" % \
 *             python._fqtypename(input).decode('utf8')
 *     if (node is None or not node._c_node or             # <<<<<<<<<<<<<<
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, u"Input object has no element: %s" % \
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_node) == Py_None);
  if (!(__pyx_t_2 != 0)) {
    __pyx_t_1 = ((!(__pyx_v_node->_c_node != 0)) != 0);
    if (!__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":71
 *             python._fqtypename(input).decode('utf8')
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Input object has no element: %s" % \
 *             python._fqtypename(input).decode('utf8')
 */
      __pyx_t_6 = ((__pyx_v_node->_c_node->type != XML_ELEMENT_NODE) != 0);
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_7;
  } else {
    __pyx_t_1 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":73
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, u"Input object has no element: %s" % \
 *             python._fqtypename(input).decode('utf8')             # <<<<<<<<<<<<<<
 *     _assertValidNode(node)
 *     return node
 */
    __pyx_t_4 = _fqtypename(__pyx_v_input);
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":72
 *     if (node is None or not node._c_node or
 *             node._c_node.type != tree.XML_ELEMENT_NODE):
 *         raise ValueError, u"Input object has no element: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(input).decode('utf8')
 *     _assertValidNode(node)
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Input_object_has_no_element_s, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":74
 *         raise ValueError, u"Input object has no element: %s" % \
 *             python._fqtypename(input).decode('utf8')
 *     _assertValidNode(node)             # <<<<<<<<<<<<<<
 *     return node
 * 
 */
  __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":75
 *             python._fqtypename(input).decode('utf8')
 *     _assertValidNode(node)
 *     return node             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":54
 *     return doc
 * 
 * cdef _Element _rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     u"""Call this to get the root node of a _Document, _ElementTree or
 *      _Element object, or to raise an exception if it can't be determined.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._rootNodeOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":77
 *     return node
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,             # <<<<<<<<<<<<<<
 *                            _BaseParser parser, text, tail, attrib, nsmap,
 *                            dict extra_attrs):
 */

static struct LxmlElement *__pyx_f_4lxml_5etree__makeElement(PyObject *__pyx_v_tag, xmlDoc *__pyx_v_c_doc, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  xmlNode *__pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_makeElement", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":95
 *     """
 *     cdef xmlNode* c_node
 *     if doc is not None:             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":96
 *     cdef xmlNode* c_node
 *     if doc is not None:
 *         c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:
 */
    __pyx_t_3 = __pyx_v_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_3;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":97
 *     if doc is not None:
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(__pyx_t_4 != Py_None)) {
    PyObject* sequence = __pyx_t_4;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns_utf = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_name_utf = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":98
 *         c_doc = doc._c_doc
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_parser) != Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_1 = (__pyx_v_parser->_for_html != 0);
  } else {
    __pyx_t_1 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":99
 *     ns_utf, name_utf = _getNsTag(tag)
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":100
 *     if parser is not None and parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newHTMLDoc()
 *     else:
 */
    __pyx_t_1 = ((__pyx_v_c_doc == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":101
 *         _htmlTagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_doc = __pyx_t_3;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":103
 *             c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":104
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 */
    __pyx_t_1 = ((__pyx_v_c_doc == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":105
 *         _tagValidOrRaise(name_utf)
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_doc = __pyx_t_3;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":106
 *         if c_doc is NULL:
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:
 */
  __pyx_t_8 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_8;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":107
 *             c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":108
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    if ((__pyx_t_1 != 0)) {
      __pyx_t_2 = ((__pyx_v_c_doc != NULL) != 0);
      __pyx_t_9 = __pyx_t_2;
    } else {
      __pyx_t_9 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":109
 *     if c_node is NULL:
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     try:
 */
      xmlFreeDoc(__pyx_v_c_doc);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":110
 *         if doc is None and c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     try:
 *         if doc is None:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":111
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     try:             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":112
 *         raise MemoryError()
 *     try:
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 */
      __pyx_t_9 = (((PyObject *)__pyx_v_doc) == Py_None);
      __pyx_t_1 = (__pyx_t_9 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":113
 *     try:
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
 */
        xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":114
 *         if doc is None:
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
        __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_4));
        __pyx_t_4 = 0;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":115
 *             tree.xmlDocSetRootElement(c_doc, c_node)
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 */
      __pyx_t_1 = (__pyx_v_text != Py_None);
      __pyx_t_9 = (__pyx_t_1 != 0);
      if (__pyx_t_9) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":116
 *             doc = _documentFactory(c_doc, parser)
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":117
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 */
      __pyx_t_9 = (__pyx_v_tail != Py_None);
      __pyx_t_1 = (__pyx_t_9 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":118
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":120
 *             _setTailText(c_node, tail)
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L9_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":121
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(doc, c_node)
 *     except:
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":122
 *         _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L13_try_return;
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L16_try_end;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":123
 *         _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *         return _elementFactory(doc, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._makeElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":125
 *     except:
 *         # free allocated c_node/c_doc unless Python does it for us
 *         if c_node.doc is not c_doc:             # <<<<<<<<<<<<<<
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
 */
      __pyx_t_1 = ((__pyx_v_c_node->doc != __pyx_v_c_doc) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":127
 *         if c_node.doc is not c_doc:
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
 */
        __pyx_t_1 = (__pyx_v_tail != Py_None);
        __pyx_t_9 = (__pyx_t_1 != 0);
        if (__pyx_t_9) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":128
 *             # node not yet in document => will not be freed by document
 *             if tail is not None:
 *                 _removeText(c_node.next) # tail             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:
 */
          __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);
          goto __pyx_L23;
        }
        __pyx_L23:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":129
 *             if tail is not None:
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             # c_doc will not be freed by doc
 */
        xmlFreeNode(__pyx_v_c_node);
        goto __pyx_L22;
      }
      __pyx_L22:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":130
 *                 _removeText(c_node.next) # tail
 *             tree.xmlFreeNode(c_node)
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
 */
      __pyx_t_9 = (((PyObject *)__pyx_v_doc) == Py_None);
      __pyx_t_1 = (__pyx_t_9 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":132
 *         if doc is None:
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
        xmlFreeDoc(__pyx_v_c_doc);
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":133
 *             # c_doc will not be freed by doc
 *             tree.xmlFreeDoc(c_doc)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_6, __pyx_t_5);
      __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; 
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L10_exception_handled;
    }
    __pyx_L11_except_error:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L1_error;
    __pyx_L13_try_return:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L0;
    __pyx_L10_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    __pyx_L16_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":77
 *     return node
 * 
 * cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,             # <<<<<<<<<<<<<<
 *                            _BaseParser parser, text, tail, attrib, nsmap,
 *                            dict extra_attrs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._makeElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":135
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, dict extra_attrs) except -1:
 *     u"""Initialise a new Element object.
 */

static int __pyx_f_4lxml_5etree__initNewElement(struct LxmlElement *__pyx_v_element, int __pyx_v_is_html, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  xmlNode *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initNewElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":145
 *     cdef xmlNode* c_node
 *     cdef _Document doc
 *     if is_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()
 */
  __pyx_t_1 = (__pyx_v_is_html != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":146
 *     cdef _Document doc
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newHTMLDoc()
 *     else:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":147
 *     if is_html:
 *         _htmlTagValidOrRaise(name_utf)
 *         c_doc = _newHTMLDoc()             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__newHTMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_3;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":149
 *         c_doc = _newHTMLDoc()
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":150
 *     else:
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":151
 *         _tagValidOrRaise(name_utf)
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         if c_doc is not NULL:
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":152
 *         c_doc = _newXMLDoc()
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":153
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         if c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 */
    __pyx_t_1 = ((__pyx_v_c_doc != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":154
 *     if c_node is NULL:
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 */
      xmlFreeDoc(__pyx_v_c_doc);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":155
 *         if c_doc is not NULL:
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":156
 *             tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 */
  xmlDocSetRootElement(__pyx_v_c_doc, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":157
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(c_doc, c_node)
 *     doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 *     # add namespaces to node if necessary
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":159
 *     doc = _documentFactory(c_doc, parser)
 *     # add namespaces to node if necessary
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, __pyx_v_doc, __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":160
 *     # add namespaces to node if necessary
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *     _registerProxy(element, doc, c_node)
 *     element._init()
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, __pyx_v_doc, __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":161
 *     _initNodeNamespaces(c_node, doc, ns_utf, nsmap)
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)             # <<<<<<<<<<<<<<
 *     element._init()
 *     return 0
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_element, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":162
 *     _initNodeAttributes(c_node, doc, attrib, extra_attrs)
 *     _registerProxy(element, doc, c_node)
 *     element._init()             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_element), __pyx_n_s_init_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 162; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":163
 *     _registerProxy(element, doc, c_node)
 *     element._init()
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":135
 *         raise
 * 
 * cdef int _initNewElement(_Element element, bint is_html, name_utf, ns_utf,             # <<<<<<<<<<<<<<
 *                          _BaseParser parser, attrib, nsmap, dict extra_attrs) except -1:
 *     u"""Initialise a new Element object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._initNewElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":165
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, dict extra_attrs):
 *     u"""Create a new child element and initialize text content, namespaces and
 */

static struct LxmlElement *__pyx_f_4lxml_5etree__makeSubElement(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_extra_attrs) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  xmlDoc *__pyx_t_8;
  xmlNode *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_makeSubElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":172
 *     cdef xmlNode* c_node
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(parent)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parent) == Py_None);
  if (!(__pyx_t_1 != 0)) {
    __pyx_t_2 = (((PyObject *)__pyx_v_parent->_doc) == Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":173
 *     cdef xmlDoc* c_doc
 *     if parent is None or parent._doc is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct LxmlElement *)Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":174
 *     if parent is None or parent._doc is None:
 *         return None
 *     _assertValidNode(parent)             # <<<<<<<<<<<<<<
 *     ns_utf, name_utf = _getNsTag(tag)
 *     c_doc = parent._doc._c_doc
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_parent); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":175
 *         return None
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *     c_doc = parent._doc._c_doc
 * 
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (likely(__pyx_t_5 != Py_None)) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns_utf = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_name_utf = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":176
 *     _assertValidNode(parent)
 *     ns_utf, name_utf = _getNsTag(tag)
 *     c_doc = parent._doc._c_doc             # <<<<<<<<<<<<<<
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
 */
  __pyx_t_8 = __pyx_v_parent->_doc->_c_doc;
  __pyx_v_c_doc = __pyx_t_8;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":178
 *     c_doc = parent._doc._c_doc
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_parent->_doc->_parser) != Py_None);
  if ((__pyx_t_3 != 0)) {
    __pyx_t_1 = (__pyx_v_parent->_doc->_parser->_for_html != 0);
  } else {
    __pyx_t_1 = (__pyx_t_3 != 0);
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":179
 * 
 *     if parent._doc._parser is not None and parent._doc._parser._for_html:
 *         _htmlTagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         _tagValidOrRaise(name_utf)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":181
 *         _htmlTagValidOrRaise(name_utf)
 *     else:
 *         _tagValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 * 
 *     c_node = _createElement(c_doc, name_utf)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":183
 *         _tagValidOrRaise(name_utf)
 * 
 *     c_node = _createElement(c_doc, name_utf)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise MemoryError()
 */
  __pyx_t_9 = __pyx_f_4lxml_5etree__createElement(__pyx_v_c_doc, __pyx_v_name_utf); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_9;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":184
 * 
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":185
 *     c_node = _createElement(c_doc, name_utf)
 *     if c_node is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":186
 *     if c_node is NULL:
 *         raise MemoryError()
 *     tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":188
 *     tree.xmlAddChild(parent._c_node, c_node)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if text is not None:
 *             _setNodeText(c_node, text)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":189
 * 
 *     try:
 *         if text is not None:             # <<<<<<<<<<<<<<
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 */
      __pyx_t_1 = (__pyx_v_text != Py_None);
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":190
 *     try:
 *         if text is not None:
 *             _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 *         if tail is not None:
 *             _setTailText(c_node, tail)
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":191
 *         if text is not None:
 *             _setNodeText(c_node, text)
 *         if tail is not None:             # <<<<<<<<<<<<<<
 *             _setTailText(c_node, tail)
 * 
 */
      __pyx_t_3 = (__pyx_v_tail != Py_None);
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":192
 *             _setNodeText(c_node, text)
 *         if tail is not None:
 *             _setTailText(c_node, tail)             # <<<<<<<<<<<<<<
 * 
 *         # add namespaces to node if necessary
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_tail); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":195
 * 
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)             # <<<<<<<<<<<<<<
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = __pyx_f_4lxml_5etree__initNodeNamespaces(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_5), __pyx_v_ns_utf, __pyx_v_nsmap); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":196
 *         # add namespaces to node if necessary
 *         _initNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)             # <<<<<<<<<<<<<<
 *         return _elementFactory(parent._doc, c_node)
 *     except:
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = __pyx_f_4lxml_5etree__initNodeAttributes(__pyx_v_c_node, ((struct LxmlDocument *)__pyx_t_5), __pyx_v_attrib, __pyx_v_extra_attrs); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":197
 *         _initNodeNamespaces(c_node, parent._doc, ns_utf, nsmap)
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         # make sure we clean up in case of an error
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_7 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_7), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = ((struct LxmlElement *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":198
 *         _initNodeAttributes(c_node, parent._doc, attrib, extra_attrs)
 *         return _elementFactory(parent._doc, c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._makeSubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":200
 *     except:
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
      __pyx_t_13 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_4 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_13), __pyx_v_c_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":201
 *         # make sure we clean up in case of an error
 *         _removeNode(parent._doc, c_node)
 *         raise             # <<<<<<<<<<<<<<
 * 
 * cdef int _initNodeNamespaces(xmlNode* c_node, _Document doc,
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_7, __pyx_t_6);
      __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; 
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L1_error;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    __pyx_L13_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":165
 *     return 0
 * 
 * cdef _Element _makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                               attrib, nsmap, dict extra_attrs):
 *     u"""Create a new child element and initialize text content, namespaces and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree._makeSubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":203
 *         raise
 * 
 * cdef int _initNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                              object node_ns_utf, object nsmap) except -1:
 *     u"""Lookup current namespace prefixes, then set namespace structure for
 */

static int __pyx_f_4lxml_5etree__initNodeNamespaces(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_node_ns_utf, PyObject *__pyx_v_nsmap) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_nsdefs = 0;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_href = NULL;
  PyObject *__pyx_v_href_utf = NULL;
  const xmlChar *__pyx_v_c_href;
  PyObject *__pyx_v_prefix_utf = NULL;
  const xmlChar *__pyx_v_c_prefix;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initNodeNamespaces", 0);
  __Pyx_INCREF(__pyx_v_node_ns_utf);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":212
 *     cdef xmlNs* c_ns
 *     cdef list nsdefs
 *     if not nsmap:             # <<<<<<<<<<<<<<
 *         if node_ns_utf is not None:
 *             _uriValidOrRaise(node_ns_utf)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":213
 *     cdef list nsdefs
 *     if not nsmap:
 *         if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *             _uriValidOrRaise(node_ns_utf)
 *             doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 */
    __pyx_t_2 = (__pyx_v_node_ns_utf != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":214
 *     if not nsmap:
 *         if node_ns_utf is not None:
 *             _uriValidOrRaise(node_ns_utf)             # <<<<<<<<<<<<<<
 *             doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *         return 0
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_node_ns_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":215
 *         if node_ns_utf is not None:
 *             _uriValidOrRaise(node_ns_utf)
 *             doc._setNodeNs(c_node, _xcstr(node_ns_utf))             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document__setNodeNs(__pyx_v_doc, __pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":216
 *             _uriValidOrRaise(node_ns_utf)
 *             doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     nsdefs = list(nsmap.items())
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":218
 *         return 0
 * 
 *     nsdefs = list(nsmap.items())             # <<<<<<<<<<<<<<
 *     if None in nsmap and len(nsdefs) > 1:
 *         # Move the default namespace to the end.  This makes sure libxml2
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsmap, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_nsdefs = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":219
 * 
 *     nsdefs = list(nsmap.items())
 *     if None in nsmap and len(nsdefs) > 1:             # <<<<<<<<<<<<<<
 *         # Move the default namespace to the end.  This makes sure libxml2
 *         # prefers a prefix if the ns is defined redundantly on the same
 */
  __pyx_t_1 = (__Pyx_PySequence_Contains(Py_None, __pyx_v_nsmap, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if ((__pyx_t_1 != 0)) {
    __pyx_t_6 = PyList_GET_SIZE(__pyx_v_nsdefs); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = ((__pyx_t_6 > 1) != 0);
    __pyx_t_7 = __pyx_t_2;
  } else {
    __pyx_t_7 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":226
 *         # elements serialise without prefix (i.e. into the non-default
 *         # namespace).
 *         item = (None, nsmap[None])             # <<<<<<<<<<<<<<
 *         nsdefs.remove(item)
 *         nsdefs.append(item)
 */
    __pyx_t_5 = PyObject_GetItem(__pyx_v_nsmap, Py_None); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 0, Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_item = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":227
 *         # namespace).
 *         item = (None, nsmap[None])
 *         nsdefs.remove(item)             # <<<<<<<<<<<<<<
 *         nsdefs.append(item)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsdefs, __pyx_n_s_remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_item);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_item);
    __Pyx_GIVEREF(__pyx_v_item);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":228
 *         item = (None, nsmap[None])
 *         nsdefs.remove(item)
 *         nsdefs.append(item)             # <<<<<<<<<<<<<<
 * 
 *     for prefix, href in nsdefs:
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_nsdefs, __pyx_v_item); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":230
 *         nsdefs.append(item)
 * 
 *     for prefix, href in nsdefs:             # <<<<<<<<<<<<<<
 *         href_utf = _utf8(href)
 *         _uriValidOrRaise(href_utf)
 */
  __pyx_t_8 = __pyx_v_nsdefs; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_href, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":231
 * 
 *     for prefix, href in nsdefs:
 *         href_utf = _utf8(href)             # <<<<<<<<<<<<<<
 *         _uriValidOrRaise(href_utf)
 *         c_href = _xcstr(href_utf)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_v_href); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_href_utf, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":232
 *     for prefix, href in nsdefs:
 *         href_utf = _utf8(href)
 *         _uriValidOrRaise(href_utf)             # <<<<<<<<<<<<<<
 *         c_href = _xcstr(href_utf)
 *         if prefix is not None:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_href_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":233
 *         href_utf = _utf8(href)
 *         _uriValidOrRaise(href_utf)
 *         c_href = _xcstr(href_utf)             # <<<<<<<<<<<<<<
 *         if prefix is not None:
 *             prefix_utf = _utf8(prefix)
 */
    __pyx_v_c_href = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_href_utf);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":234
 *         _uriValidOrRaise(href_utf)
 *         c_href = _xcstr(href_utf)
 *         if prefix is not None:             # <<<<<<<<<<<<<<
 *             prefix_utf = _utf8(prefix)
 *             _prefixValidOrRaise(prefix_utf)
 */
    __pyx_t_7 = (__pyx_v_prefix != Py_None);
    __pyx_t_1 = (__pyx_t_7 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":235
 *         c_href = _xcstr(href_utf)
 *         if prefix is not None:
 *             prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *             _prefixValidOrRaise(prefix_utf)
 *             c_prefix = _xcstr(prefix_utf)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":236
 *         if prefix is not None:
 *             prefix_utf = _utf8(prefix)
 *             _prefixValidOrRaise(prefix_utf)             # <<<<<<<<<<<<<<
 *             c_prefix = _xcstr(prefix_utf)
 *         else:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__prefixValidOrRaise(__pyx_v_prefix_utf); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":237
 *             prefix_utf = _utf8(prefix)
 *             _prefixValidOrRaise(prefix_utf)
 *             c_prefix = _xcstr(prefix_utf)             # <<<<<<<<<<<<<<
 *         else:
 *             c_prefix = <const_xmlChar*>NULL
 */
      __pyx_v_c_prefix = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf);
      goto __pyx_L10;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":239
 *             c_prefix = _xcstr(prefix_utf)
 *         else:
 *             c_prefix = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *         # add namespace with prefix if it is not already known
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 */
      __pyx_v_c_prefix = ((const xmlChar *)NULL);
    }
    __pyx_L10:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":241
 *             c_prefix = <const_xmlChar*>NULL
 *         # add namespace with prefix if it is not already known
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)             # <<<<<<<<<<<<<<
 *         if c_ns is NULL or \
 *                 c_ns.href is NULL or \
 */
    __pyx_v_c_ns = xmlSearchNs(__pyx_v_doc->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":242
 *         # add namespace with prefix if it is not already known
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *         if c_ns is NULL or \             # <<<<<<<<<<<<<<
 *                 c_ns.href is NULL or \
 *                 tree.xmlStrcmp(c_ns.href, c_href) != 0:
 */
    __pyx_t_1 = ((__pyx_v_c_ns == NULL) != 0);
    if (!__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":243
 *         c_ns = tree.xmlSearchNs(doc._c_doc, c_node, c_prefix)
 *         if c_ns is NULL or \
 *                 c_ns.href is NULL or \             # <<<<<<<<<<<<<<
 *                 tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 */
      __pyx_t_7 = ((__pyx_v_c_ns->href == NULL) != 0);
      if (!__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":244
 *         if c_ns is NULL or \
 *                 c_ns.href is NULL or \
 *                 tree.xmlStrcmp(c_ns.href, c_href) != 0:             # <<<<<<<<<<<<<<
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if href_utf == node_ns_utf:
 */
        __pyx_t_2 = ((xmlStrcmp(__pyx_v_c_ns->href, __pyx_v_c_href) != 0) != 0);
        __pyx_t_13 = __pyx_t_2;
      } else {
        __pyx_t_13 = __pyx_t_7;
      }
      __pyx_t_7 = __pyx_t_13;
    } else {
      __pyx_t_7 = __pyx_t_1;
    }
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":245
 *                 c_ns.href is NULL or \
 *                 tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)             # <<<<<<<<<<<<<<
 *         if href_utf == node_ns_utf:
 *             tree.xmlSetNs(c_node, c_ns)
 */
      __pyx_v_c_ns = xmlNewNs(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_prefix);
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":246
 *                 tree.xmlStrcmp(c_ns.href, c_href) != 0:
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if href_utf == node_ns_utf:             # <<<<<<<<<<<<<<
 *             tree.xmlSetNs(c_node, c_ns)
 *             node_ns_utf = None
 */
    __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_v_href_utf, __pyx_v_node_ns_utf, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":247
 *             c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if href_utf == node_ns_utf:
 *             tree.xmlSetNs(c_node, c_ns)             # <<<<<<<<<<<<<<
 *             node_ns_utf = None
 * 
 */
      xmlSetNs(__pyx_v_c_node, __pyx_v_c_ns);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":248
 *         if href_utf == node_ns_utf:
 *             tree.xmlSetNs(c_node, c_ns)
 *             node_ns_utf = None             # <<<<<<<<<<<<<<
 * 
 *     if node_ns_utf is not None:
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_node_ns_utf, Py_None);
      goto __pyx_L12;
    }
    __pyx_L12:;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":250
 *             node_ns_utf = None
 * 
 *     if node_ns_utf is not None:             # <<<<<<<<<<<<<<
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *     return 0
 */
  __pyx_t_7 = (__pyx_v_node_ns_utf != Py_None);
  __pyx_t_1 = (__pyx_t_7 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":251
 * 
 *     if node_ns_utf is not None:
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document__setNodeNs(__pyx_v_doc, __pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_node_ns_utf)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":252
 *     if node_ns_utf is not None:
 *         doc._setNodeNs(c_node, _xcstr(node_ns_utf))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":203
 *         raise
 * 
 * cdef int _initNodeNamespaces(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                              object node_ns_utf, object nsmap) except -1:
 *     u"""Lookup current namespace prefixes, then set namespace structure for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._initNodeNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nsdefs);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_href);
  __Pyx_XDECREF(__pyx_v_href_utf);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_node_ns_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":254
 *     return 0
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):             # <<<<<<<<<<<<<<
 *     u"""Initialise the attributes of an element node.
 *     """
 */

static PyObject *__pyx_f_4lxml_5etree__initNodeAttributes(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_attrib, PyObject *__pyx_v_extra) {
  int __pyx_v_is_html;
  PyObject *__pyx_v_seen = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  const char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initNodeAttributes", 0);
  __Pyx_INCREF(__pyx_v_attrib);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":259
 *     cdef bint is_html
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, u'items'):             # <<<<<<<<<<<<<<
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \
 *             python._fqtypename(attrib).decode('utf8')
 */
  __pyx_t_1 = (__pyx_v_attrib != Py_None);
  if ((__pyx_t_1 != 0)) {
    __pyx_t_2 = PyObject_HasAttr(__pyx_v_attrib, __pyx_n_u_items); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":261
 *     if attrib is not None and not hasattr(attrib, u'items'):
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \
 *             python._fqtypename(attrib).decode('utf8')             # <<<<<<<<<<<<<<
 *     if not attrib and not extra:
 *         return  # nothing to do
 */
    __pyx_t_4 = _fqtypename(__pyx_v_attrib);
    __pyx_t_5 = __Pyx_decode_c_string(__pyx_t_4, 0, strlen(__pyx_t_4), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":260
 *     cdef xmlNs* c_ns
 *     if attrib is not None and not hasattr(attrib, u'items'):
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(attrib).decode('utf8')
 *     if not attrib and not extra:
 */
    __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_Invalid_attribute_dictionary_s, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":262
 *         raise TypeError, u"Invalid attribute dictionary: %s" % \
 *             python._fqtypename(attrib).decode('utf8')
 *     if not attrib and not extra:             # <<<<<<<<<<<<<<
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((!__pyx_t_2) != 0);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":263
 *             python._fqtypename(attrib).decode('utf8')
 *     if not attrib and not extra:
 *         return  # nothing to do             # <<<<<<<<<<<<<<
 *     is_html = doc._parser._for_html
 *     seen = set()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":264
 *     if not attrib and not extra:
 *         return  # nothing to do
 *     is_html = doc._parser._for_html             # <<<<<<<<<<<<<<
 *     seen = set()
 *     if extra:
 */
  __pyx_t_2 = __pyx_v_doc->_parser->_for_html;
  __pyx_v_is_html = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":265
 *         return  # nothing to do
 *     is_html = doc._parser._for_html
 *     seen = set()             # <<<<<<<<<<<<<<
 *     if extra:
 *         for name, value in sorted(extra.items()):
 */
  __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_seen = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":266
 *     is_html = doc._parser._for_html
 *     seen = set()
 *     if extra:             # <<<<<<<<<<<<<<
 *         for name, value in sorted(extra.items()):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extra); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":267
 *     seen = set()
 *     if extra:
 *         for name, value in sorted(extra.items()):             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:
 */
    if (unlikely(__pyx_v_extra == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = __Pyx_PyDict_Items(__pyx_v_extra); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_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 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_5)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_5)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_6 = __pyx_t_8(__pyx_t_5);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
        PyObject* sequence = __pyx_t_6;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":268
 *     if extra:
 *         for name, value in sorted(extra.items()):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)             # <<<<<<<<<<<<<<
 *     if attrib:
 *         # attrib will usually be a plain unordered dict
 */
      __pyx_t_13 = __pyx_f_4lxml_5etree__addAttributeToNode(__pyx_v_c_node, __pyx_v_doc, __pyx_v_is_html, __pyx_v_name, __pyx_v_value, __pyx_v_seen); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":269
 *         for name, value in sorted(extra.items()):
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 *     if attrib:             # <<<<<<<<<<<<<<
 *         # attrib will usually be a plain unordered dict
 *         if type(attrib) is dict:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":271
 *     if attrib:
 *         # attrib will usually be a plain unordered dict
 *         if type(attrib) is dict:             # <<<<<<<<<<<<<<
 *             attrib = sorted(attrib.items())
 *         elif isinstance(attrib, _Attrib) or (
 */
    __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_attrib)) == ((PyObject *)((PyObject*)(&PyDict_Type))));
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":272
 *         # attrib will usually be a plain unordered dict
 *         if type(attrib) is dict:
 *             attrib = sorted(attrib.items())             # <<<<<<<<<<<<<<
 *         elif isinstance(attrib, _Attrib) or (
 *                 OrderedDict is not None and isinstance(attrib, OrderedDict)):
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrib, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_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[4]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_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 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_attrib, __pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L11;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":273
 *         if type(attrib) is dict:
 *             attrib = sorted(attrib.items())
 *         elif isinstance(attrib, _Attrib) or (             # <<<<<<<<<<<<<<
 *                 OrderedDict is not None and isinstance(attrib, OrderedDict)):
 *             attrib = attrib.items()
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_attrib, ((PyObject*)__pyx_ptype_4lxml_5etree__Attrib)); 
    if (!(__pyx_t_1 != 0)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":274
 *             attrib = sorted(attrib.items())
 *         elif isinstance(attrib, _Attrib) or (
 *                 OrderedDict is not None and isinstance(attrib, OrderedDict)):             # <<<<<<<<<<<<<<
 *             attrib = attrib.items()
 *         else:
 */
      __pyx_t_2 = (__pyx_v_4lxml_5etree_OrderedDict != Py_None);
      if ((__pyx_t_2 != 0)) {
        __pyx_t_6 = __pyx_v_4lxml_5etree_OrderedDict;
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_attrib, __pyx_t_6); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_14 = (__pyx_t_3 != 0);
      } else {
        __pyx_t_14 = (__pyx_t_2 != 0);
      }
      __pyx_t_2 = __pyx_t_14;
    } else {
      __pyx_t_2 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":275
 *         elif isinstance(attrib, _Attrib) or (
 *                 OrderedDict is not None and isinstance(attrib, OrderedDict)):
 *             attrib = attrib.items()             # <<<<<<<<<<<<<<
 *         else:
 *             # assume it's an unordered mapping of some kind
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrib, __pyx_n_s_items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_attrib, __pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":278
 *         else:
 *             # assume it's an unordered mapping of some kind
 *             attrib = sorted(attrib.items())             # <<<<<<<<<<<<<<
 *         for name, value in attrib:
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrib, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_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[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_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 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_attrib, __pyx_t_6);
      __pyx_t_6 = 0;
    }
    __pyx_L11:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":279
 *             # assume it's an unordered mapping of some kind
 *             attrib = sorted(attrib.items())
 *         for name, value in attrib:             # <<<<<<<<<<<<<<
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
 */
    if (PyList_CheckExact(__pyx_v_attrib) || PyTuple_CheckExact(__pyx_v_attrib)) {
      __pyx_t_6 = __pyx_v_attrib; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_attrib); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_5 = __pyx_t_8(__pyx_t_6);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L15_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":280
 *             attrib = sorted(attrib.items())
 *         for name, value in attrib:
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)             # <<<<<<<<<<<<<<
 * 
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,
 */
      __pyx_t_13 = __pyx_f_4lxml_5etree__addAttributeToNode(__pyx_v_c_node, __pyx_v_doc, __pyx_v_is_html, __pyx_v_name, __pyx_v_value, __pyx_v_seen); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":254
 *     return 0
 * 
 * cdef _initNodeAttributes(xmlNode* c_node, _Document doc, attrib, dict extra):             # <<<<<<<<<<<<<<
 *     u"""Initialise the attributes of an element node.
 *     """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._initNodeAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_seen);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":282
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,             # <<<<<<<<<<<<<<
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
 */

static int __pyx_f_4lxml_5etree__addAttributeToNode(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, int __pyx_v_is_html, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_seen_tags) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_value_utf = NULL;
  xmlNs *__pyx_v_c_ns;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  xmlNs *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addAttributeToNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":284
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)             # <<<<<<<<<<<<<<
 *     if tag in seen_tags:
 *         return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns_utf = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name_utf = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_tag = ((PyObject*)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":285
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
 *     if tag in seen_tags:             # <<<<<<<<<<<<<<
 *         return 0
 *     seen_tags.add(tag)
 */
  __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_tag, __pyx_v_seen_tags, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":286
 *     ns_utf, name_utf = tag = _getNsTag(name)
 *     if tag in seen_tags:
 *         return 0             # <<<<<<<<<<<<<<
 *     seen_tags.add(tag)
 *     if not is_html:
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":287
 *     if tag in seen_tags:
 *         return 0
 *     seen_tags.add(tag)             # <<<<<<<<<<<<<<
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)
 */
  if (unlikely(__pyx_v_seen_tags == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = PySet_Add(__pyx_v_seen_tags, __pyx_v_tag); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":288
 *         return 0
 *     seen_tags.add(tag)
 *     if not is_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 */
  __pyx_t_5 = ((!(__pyx_v_is_html != 0)) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":289
 *     seen_tags.add(tag)
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)             # <<<<<<<<<<<<<<
 *     value_utf = _utf8(value)
 *     if ns_utf is None:
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_name_utf); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":290
 *     if not is_html:
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":291
 *         _attributeValidOrRaise(name_utf)
 *     value_utf = _utf8(value)
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 *     else:
 */
  __pyx_t_5 = (__pyx_v_ns_utf == Py_None);
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":292
 *     value_utf = _utf8(value)
 *     if ns_utf is None:
 *         tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))             # <<<<<<<<<<<<<<
 *     else:
 *         _uriValidOrRaise(ns_utf)
 */
    xmlNewProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":294
 *         tree.xmlNewProp(c_node, _xcstr(name_utf), _xcstr(value_utf))
 *     else:
 *         _uriValidOrRaise(ns_utf)             # <<<<<<<<<<<<<<
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)
 *         tree.xmlNewNsProp(c_node, c_ns,
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__uriValidOrRaise(__pyx_v_ns_utf); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":295
 *     else:
 *         _uriValidOrRaise(ns_utf)
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)             # <<<<<<<<<<<<<<
 *         tree.xmlNewNsProp(c_node, c_ns,
 *                           _xcstr(name_utf), _xcstr(value_utf))
 */
    __pyx_t_8 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), NULL, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_ns = __pyx_t_8;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":296
 *         _uriValidOrRaise(ns_utf)
 *         c_ns = doc._findOrBuildNodeNs(c_node, _xcstr(ns_utf), NULL, 1)
 *         tree.xmlNewNsProp(c_node, c_ns,             # <<<<<<<<<<<<<<
 *                           _xcstr(name_utf), _xcstr(value_utf))
 *     return 0
 */
    xmlNewNsProp(__pyx_v_c_node, __pyx_v_c_ns, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":298
 *         tree.xmlNewNsProp(c_node, c_ns,
 *                           _xcstr(name_utf), _xcstr(value_utf))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * ctypedef struct _ns_node_ref:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":282
 *             _addAttributeToNode(c_node, doc, is_html, name, value, seen)
 * 
 * cdef int _addAttributeToNode(xmlNode* c_node, _Document doc, bint is_html,             # <<<<<<<<<<<<<<
 *                              name, value, set seen_tags) except -1:
 *     ns_utf, name_utf = tag = _getNsTag(name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._addAttributeToNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":304
 *     xmlNode* node
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element) except -1:             # <<<<<<<<<<<<<<
 *     u"""Remove any namespace declarations from a subtree that are not used by
 *     any of its elements (or attributes).
 */

static int __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(xmlNode *__pyx_v_c_element) {
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_ns_list;
  __pyx_t_4lxml_5etree__ns_node_ref *__pyx_v_c_nsref_ptr;
  xmlNs *__pyx_v_c_nsdef;
  xmlNode *__pyx_v_c_node;
  size_t __pyx_v_c_ns_list_size;
  size_t __pyx_v_c_ns_list_len;
  size_t __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNs *__pyx_t_4;
  xmlNode *__pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_removeUnusedNamespaceDeclarations", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":316
 *     cdef size_t i
 * 
 *     c_ns_list = NULL             # <<<<<<<<<<<<<<
 *     c_ns_list_size = 0
 *     c_ns_list_len  = 0
 */
  __pyx_v_c_ns_list = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":317
 * 
 *     c_ns_list = NULL
 *     c_ns_list_size = 0             # <<<<<<<<<<<<<<
 *     c_ns_list_len  = 0
 * 
 */
  __pyx_v_c_ns_list_size = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":318
 *     c_ns_list = NULL
 *     c_ns_list_size = 0
 *     c_ns_list_len  = 0             # <<<<<<<<<<<<<<
 * 
 *     if c_element.parent is not NULL and \
 */
  __pyx_v_c_ns_list_len = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":320
 *     c_ns_list_len  = 0
 * 
 *     if c_element.parent is not NULL and \             # <<<<<<<<<<<<<<
 *             c_element.parent.type == tree.XML_DOCUMENT_NODE:
 *         # include the document node
 */
  __pyx_t_1 = ((__pyx_v_c_element->parent != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":321
 * 
 *     if c_element.parent is not NULL and \
 *             c_element.parent.type == tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # include the document node
 *         c_nsdef = c_element.parent.nsDef
 */
    __pyx_t_2 = ((__pyx_v_c_element->parent->type == XML_DOCUMENT_NODE) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":323
 *             c_element.parent.type == tree.XML_DOCUMENT_NODE:
 *         # include the document node
 *         c_nsdef = c_element.parent.nsDef             # <<<<<<<<<<<<<<
 *         while c_nsdef is not NULL:
 *             if c_ns_list_len >= c_ns_list_size:
 */
    __pyx_t_4 = __pyx_v_c_element->parent->nsDef;
    __pyx_v_c_nsdef = __pyx_t_4;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":324
 *         # include the document node
 *         c_nsdef = c_element.parent.nsDef
 *         while c_nsdef is not NULL:             # <<<<<<<<<<<<<<
 *             if c_ns_list_len >= c_ns_list_size:
 *                 if c_ns_list is NULL:
 */
    while (1) {
      __pyx_t_3 = ((__pyx_v_c_nsdef != NULL) != 0);
      if (!__pyx_t_3) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":325
 *         c_nsdef = c_element.parent.nsDef
 *         while c_nsdef is not NULL:
 *             if c_ns_list_len >= c_ns_list_size:             # <<<<<<<<<<<<<<
 *                 if c_ns_list is NULL:
 *                     c_ns_list_size = 20
 */
      __pyx_t_3 = ((__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":326
 *         while c_nsdef is not NULL:
 *             if c_ns_list_len >= c_ns_list_size:
 *                 if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *                     c_ns_list_size = 20
 *                 else:
 */
        __pyx_t_3 = ((__pyx_v_c_ns_list == NULL) != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":327
 *             if c_ns_list_len >= c_ns_list_size:
 *                 if c_ns_list is NULL:
 *                     c_ns_list_size = 20             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_ns_list_size *= 2
 */
          __pyx_v_c_ns_list_size = 20;
          goto __pyx_L7;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":329
 *                     c_ns_list_size = 20
 *                 else:
 *                     c_ns_list_size *= 2             # <<<<<<<<<<<<<<
 *                 c_nsref_ptr = <_ns_node_ref*> stdlib.realloc(
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 */
          __pyx_v_c_ns_list_size = (__pyx_v_c_ns_list_size * 2);
        }
        __pyx_L7:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":330
 *                 else:
 *                     c_ns_list_size *= 2
 *                 c_nsref_ptr = <_ns_node_ref*> stdlib.realloc(             # <<<<<<<<<<<<<<
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *                 if c_nsref_ptr is NULL:
 */
        __pyx_v_c_nsref_ptr = ((__pyx_t_4lxml_5etree__ns_node_ref *)realloc(__pyx_v_c_ns_list, (__pyx_v_c_ns_list_size * (sizeof(__pyx_t_4lxml_5etree__ns_node_ref)))));

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":332
 *                 c_nsref_ptr = <_ns_node_ref*> stdlib.realloc(
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *                 if c_nsref_ptr is NULL:             # <<<<<<<<<<<<<<
 *                     if c_ns_list is not NULL:
 *                         stdlib.free(c_ns_list)
 */
        __pyx_t_3 = ((__pyx_v_c_nsref_ptr == NULL) != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":333
 *                     c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *                 if c_nsref_ptr is NULL:
 *                     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                         stdlib.free(c_ns_list)
 *                     raise MemoryError()
 */
          __pyx_t_3 = ((__pyx_v_c_ns_list != NULL) != 0);
          if (__pyx_t_3) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":334
 *                 if c_nsref_ptr is NULL:
 *                     if c_ns_list is not NULL:
 *                         stdlib.free(c_ns_list)             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 c_ns_list = c_nsref_ptr
 */
            free(__pyx_v_c_ns_list);
            goto __pyx_L9;
          }
          __pyx_L9:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":335
 *                     if c_ns_list is not NULL:
 *                         stdlib.free(c_ns_list)
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 c_ns_list = c_nsref_ptr
 * 
 */
          PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":336
 *                         stdlib.free(c_ns_list)
 *                     raise MemoryError()
 *                 c_ns_list = c_nsref_ptr             # <<<<<<<<<<<<<<
 * 
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef
 */
        __pyx_v_c_ns_list = __pyx_v_c_nsref_ptr;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":338
 *                 c_ns_list = c_nsref_ptr
 * 
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef             # <<<<<<<<<<<<<<
 *             c_ns_list[c_ns_list_len].node = c_element.parent
 *             c_ns_list_len += 1
 */
      (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns = __pyx_v_c_nsdef;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":339
 * 
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef
 *             c_ns_list[c_ns_list_len].node = c_element.parent             # <<<<<<<<<<<<<<
 *             c_ns_list_len += 1
 *             c_nsdef = c_nsdef.next
 */
      __pyx_t_5 = __pyx_v_c_element->parent;
      (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node = __pyx_t_5;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":340
 *             c_ns_list[c_ns_list_len].ns   = c_nsdef
 *             c_ns_list[c_ns_list_len].node = c_element.parent
 *             c_ns_list_len += 1             # <<<<<<<<<<<<<<
 *             c_nsdef = c_nsdef.next
 * 
 */
      __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len + 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":341
 *             c_ns_list[c_ns_list_len].node = c_element.parent
 *             c_ns_list_len += 1
 *             c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 */
      __pyx_t_4 = __pyx_v_c_nsdef->next;
      __pyx_v_c_nsdef = __pyx_t_4;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":343
 *             c_nsdef = c_nsdef.next
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)             # <<<<<<<<<<<<<<
 *     # collect all new namespace declarations into the ns list
 *     c_nsdef = c_element.nsDef
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element, __pyx_v_c_element, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":345
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_element, c_element, 1)
 *     # collect all new namespace declarations into the ns list
 *     c_nsdef = c_element.nsDef             # <<<<<<<<<<<<<<
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 */
  __pyx_t_4 = __pyx_v_c_element->nsDef;
  __pyx_v_c_nsdef = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":346
 *     # collect all new namespace declarations into the ns list
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_nsdef != NULL) != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":347
 *     c_nsdef = c_element.nsDef
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:             # <<<<<<<<<<<<<<
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20
 */
    __pyx_t_3 = ((__pyx_v_c_ns_list_len >= __pyx_v_c_ns_list_size) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":348
 *     while c_nsdef is not NULL:
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *                 c_ns_list_size = 20
 *             else:
 */
      __pyx_t_3 = ((__pyx_v_c_ns_list == NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":349
 *         if c_ns_list_len >= c_ns_list_size:
 *             if c_ns_list is NULL:
 *                 c_ns_list_size = 20             # <<<<<<<<<<<<<<
 *             else:
 *                 c_ns_list_size *= 2
 */
        __pyx_v_c_ns_list_size = 20;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":351
 *                 c_ns_list_size = 20
 *             else:
 *                 c_ns_list_size *= 2             # <<<<<<<<<<<<<<
 *             c_nsref_ptr = <_ns_node_ref*> stdlib.realloc(
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 */
        __pyx_v_c_ns_list_size = (__pyx_v_c_ns_list_size * 2);
      }
      __pyx_L13:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":352
 *             else:
 *                 c_ns_list_size *= 2
 *             c_nsref_ptr = <_ns_node_ref*> stdlib.realloc(             # <<<<<<<<<<<<<<
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 */
      __pyx_v_c_nsref_ptr = ((__pyx_t_4lxml_5etree__ns_node_ref *)realloc(__pyx_v_c_ns_list, (__pyx_v_c_ns_list_size * (sizeof(__pyx_t_4lxml_5etree__ns_node_ref)))));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":354
 *             c_nsref_ptr = <_ns_node_ref*> stdlib.realloc(
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns_list is not NULL:
 *                     stdlib.free(c_ns_list)
 */
      __pyx_t_3 = ((__pyx_v_c_nsref_ptr == NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":355
 *                 c_ns_list, c_ns_list_size * sizeof(_ns_node_ref))
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *                     stdlib.free(c_ns_list)
 *                 raise MemoryError()
 */
        __pyx_t_3 = ((__pyx_v_c_ns_list != NULL) != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":356
 *             if c_nsref_ptr is NULL:
 *                 if c_ns_list is not NULL:
 *                     stdlib.free(c_ns_list)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             c_ns_list = c_nsref_ptr
 */
          free(__pyx_v_c_ns_list);
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":357
 *                 if c_ns_list is not NULL:
 *                     stdlib.free(c_ns_list)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             c_ns_list = c_nsref_ptr
 * 
 */
        PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":358
 *                     stdlib.free(c_ns_list)
 *                 raise MemoryError()
 *             c_ns_list = c_nsref_ptr             # <<<<<<<<<<<<<<
 * 
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef
 */
      __pyx_v_c_ns_list = __pyx_v_c_nsref_ptr;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":360
 *             c_ns_list = c_nsref_ptr
 * 
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef             # <<<<<<<<<<<<<<
 *         c_ns_list[c_ns_list_len].node = c_element
 *         c_ns_list_len += 1
 */
    (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns = __pyx_v_c_nsdef;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":361
 * 
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef
 *         c_ns_list[c_ns_list_len].node = c_element             # <<<<<<<<<<<<<<
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next
 */
    (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node = __pyx_v_c_element;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":362
 *         c_ns_list[c_ns_list_len].ns   = c_nsdef
 *         c_ns_list[c_ns_list_len].node = c_element
 *         c_ns_list_len += 1             # <<<<<<<<<<<<<<
 *         c_nsdef = c_nsdef.next
 * 
 */
    __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":363
 *         c_ns_list[c_ns_list_len].node = c_element
 *         c_ns_list_len += 1
 *         c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 * 
 *     # remove all namespace declarations from the list that are referenced
 */
    __pyx_t_4 = __pyx_v_c_nsdef->next;
    __pyx_v_c_nsdef = __pyx_t_4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":366
 * 
 *     # remove all namespace declarations from the list that are referenced
 *     if c_element.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_element
 *         while c_node is not NULL:
 */
  __pyx_t_3 = ((__pyx_v_c_element->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":367
 *     # remove all namespace declarations from the list that are referenced
 *     if c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_element;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":368
 *     if c_element.type == tree.XML_ELEMENT_NODE:
 *         c_node = c_element
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.ns is not NULL:
 *                 for i in range(c_ns_list_len):
 */
    while (1) {
      __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
      if (!__pyx_t_3) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":369
 *         c_node = c_element
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
 */
      __pyx_t_3 = ((__pyx_v_c_node->ns != NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":370
 *         while c_node is not NULL:
 *             if c_node.ns is not NULL:
 *                 for i in range(c_ns_list_len):             # <<<<<<<<<<<<<<
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
 */
        __pyx_t_6 = __pyx_v_c_ns_list_len;
        for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
          __pyx_v_i = __pyx_t_7;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":371
 *             if c_node.ns is not NULL:
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 */
          __pyx_t_3 = ((__pyx_v_c_node->ns == (__pyx_v_c_ns_list[__pyx_v_i]).ns) != 0);
          if (__pyx_t_3) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":372
 *                 for i in range(c_ns_list_len):
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1             # <<<<<<<<<<<<<<
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 */
            __pyx_v_c_ns_list_len = (__pyx_v_c_ns_list_len - 1);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":373
 *                     if c_node.ns is c_ns_list[i].ns:
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns             # <<<<<<<<<<<<<<
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 */
            __pyx_t_4 = (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns;
            (__pyx_v_c_ns_list[__pyx_v_i]).ns = __pyx_t_4;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":374
 *                         c_ns_list_len -= 1
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node             # <<<<<<<<<<<<<<
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 *                         c_ns_list[c_ns_list_len].node = NULL
 */
            __pyx_t_5 = (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node;
            (__pyx_v_c_ns_list[__pyx_v_i]).node = __pyx_t_5;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":375
 *                         c_ns_list[i].ns   = c_ns_list[c_ns_list_len].ns
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 *                         c_ns_list[c_ns_list_len].ns   = NULL             # <<<<<<<<<<<<<<
 *                         c_ns_list[c_ns_list_len].node = NULL
 *                         break
 */
            (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).ns = NULL;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":376
 *                         c_ns_list[i].node = c_ns_list[c_ns_list_len].node
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 *                         c_ns_list[c_ns_list_len].node = NULL             # <<<<<<<<<<<<<<
 *                         break
 *             if c_node is c_element:
 */
            (__pyx_v_c_ns_list[__pyx_v_c_ns_list_len]).node = NULL;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":377
 *                         c_ns_list[c_ns_list_len].ns   = NULL
 *                         c_ns_list[c_ns_list_len].node = NULL
 *                         break             # <<<<<<<<<<<<<<
 *             if c_node is c_element:
 *                 # continue with attributes
 */
            goto __pyx_L21_break;
          }
        }
        __pyx_L21_break:;
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":378
 *                         c_ns_list[c_ns_list_len].node = NULL
 *                         break
 *             if c_node is c_element:             # <<<<<<<<<<<<<<
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties
 */
      __pyx_t_3 = ((__pyx_v_c_node == __pyx_v_c_element) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":380
 *             if c_node is c_element:
 *                 # continue with attributes
 *                 c_node = <xmlNode*>c_element.properties             # <<<<<<<<<<<<<<
 *             else:
 *                 c_node = c_node.next
 */
        __pyx_v_c_node = ((xmlNode *)__pyx_v_c_element->properties);
        goto __pyx_L23;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":382
 *                 c_node = <xmlNode*>c_element.properties
 *             else:
 *                 c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 */
        __pyx_t_5 = __pyx_v_c_node->next;
        __pyx_v_c_node = __pyx_t_5;
      }
      __pyx_L23:;
    }
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":383
 *             else:
 *                 c_node = c_node.next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)             # <<<<<<<<<<<<<<
 * 
 *     if c_ns_list is NULL:
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_element);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":385
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_element)
 * 
 *     if c_ns_list is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_3 = ((__pyx_v_c_ns_list == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":386
 * 
 *     if c_ns_list is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # free all namespace declarations that remained in the list
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":389
 * 
 *     # free all namespace declarations that remained in the list
 *     for i in range(c_ns_list_len):             # <<<<<<<<<<<<<<
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 */
  __pyx_t_6 = __pyx_v_c_ns_list_len;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":390
 *     # free all namespace declarations that remained in the list
 *     for i in range(c_ns_list_len):
 *         c_node = c_ns_list[i].node             # <<<<<<<<<<<<<<
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
 */
    __pyx_t_5 = (__pyx_v_c_ns_list[__pyx_v_i]).node;
    __pyx_v_c_node = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":391
 *     for i in range(c_ns_list_len):
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef             # <<<<<<<<<<<<<<
 *         if c_nsdef is c_ns_list[i].ns:
 *             c_node.nsDef = c_node.nsDef.next
 */
    __pyx_t_4 = __pyx_v_c_node->nsDef;
    __pyx_v_c_nsdef = __pyx_t_4;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":392
 *         c_node = c_ns_list[i].node
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
 */
    __pyx_t_3 = ((__pyx_v_c_nsdef == (__pyx_v_c_ns_list[__pyx_v_i]).ns) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":393
 *         c_nsdef = c_node.nsDef
 *         if c_nsdef is c_ns_list[i].ns:
 *             c_node.nsDef = c_node.nsDef.next             # <<<<<<<<<<<<<<
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:
 */
      __pyx_t_4 = __pyx_v_c_node->nsDef->next;
      __pyx_v_c_node->nsDef = __pyx_t_4;
      goto __pyx_L27;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":395
 *             c_node.nsDef = c_node.nsDef.next
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:             # <<<<<<<<<<<<<<
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next
 */
      while (1) {
        __pyx_t_3 = ((__pyx_v_c_nsdef->next != (__pyx_v_c_ns_list[__pyx_v_i]).ns) != 0);
        if (!__pyx_t_3) break;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":396
 *         else:
 *             while c_nsdef.next is not c_ns_list[i].ns:
 *                 c_nsdef = c_nsdef.next             # <<<<<<<<<<<<<<
 *             c_nsdef.next = c_nsdef.next.next
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 */
        __pyx_t_4 = __pyx_v_c_nsdef->next;
        __pyx_v_c_nsdef = __pyx_t_4;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":397
 *             while c_nsdef.next is not c_ns_list[i].ns:
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 */
      __pyx_t_4 = __pyx_v_c_nsdef->next->next;
      __pyx_v_c_nsdef->next = __pyx_t_4;
    }
    __pyx_L27:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":398
 *                 c_nsdef = c_nsdef.next
 *             c_nsdef.next = c_nsdef.next.next
 *         tree.xmlFreeNs(c_ns_list[i].ns)             # <<<<<<<<<<<<<<
 * 
 *     if c_ns_list is not NULL:
 */
    xmlFreeNs((__pyx_v_c_ns_list[__pyx_v_i]).ns);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":400
 *         tree.xmlFreeNs(c_ns_list[i].ns)
 * 
 *     if c_ns_list is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_ns_list)
 *     return 0
 */
  __pyx_t_3 = ((__pyx_v_c_ns_list != NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":401
 * 
 *     if c_ns_list is not NULL:
 *         stdlib.free(c_ns_list)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    free(__pyx_v_c_ns_list);
    goto __pyx_L30;
  }
  __pyx_L30:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":402
 *     if c_ns_list is not NULL:
 *         stdlib.free(c_ns_list)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":304
 *     xmlNode* node
 * 
 * cdef int _removeUnusedNamespaceDeclarations(xmlNode* c_element) except -1:             # <<<<<<<<<<<<<<
 *     u"""Remove any namespace declarations from a subtree that are not used by
 *     any of its elements (or attributes).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._removeUnusedNamespaceDeclarations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":404
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute):             # <<<<<<<<<<<<<<
 *     u"""Search a namespace declaration that covers a node (element or
 *     attribute).
 */

static xmlNs *__pyx_f_4lxml_5etree__searchNsByHref(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, int __pyx_v_is_attribute) {
  xmlNs *__pyx_v_c_ns;
  xmlNs *__pyx_v_c_default_ns;
  xmlNode *__pyx_v_c_element;
  xmlNs *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlNode *__pyx_t_5;
  xmlNs *__pyx_t_6;
  __Pyx_RefNannySetupContext("_searchNsByHref", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":413
 *     """
 *     cdef xmlNs* c_ns
 *     cdef xmlNs* c_default_ns = NULL             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 */
  __pyx_v_c_default_ns = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":415
 *     cdef xmlNs* c_default_ns = NULL
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 */
  __pyx_t_1 = ((__pyx_v_c_href == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
    if (!__pyx_t_2) {
      __pyx_t_3 = ((__pyx_v_c_node->type == XML_ENTITY_REF_NODE) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":416
 *     cdef xmlNode* c_element
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL             # <<<<<<<<<<<<<<
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 *         # no special cases here, let libxml2 handle this
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":417
 *     if c_href is NULL or c_node is NULL or c_node.type == tree.XML_ENTITY_REF_NODE:
 *         return NULL
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 */
  __pyx_t_2 = ((xmlStrcmp(__pyx_v_c_href, XML_XML_NAMESPACE) == 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":419
 *     if tree.xmlStrcmp(c_href, tree.XML_XML_NAMESPACE) == 0:
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1
 */
    __pyx_r = xmlSearchNsByHref(__pyx_v_c_node->doc, __pyx_v_c_node, __pyx_v_c_href);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":420
 *         # no special cases here, let libxml2 handle this
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 */
  __pyx_t_2 = ((__pyx_v_c_node->type == XML_ATTRIBUTE_NODE) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":421
 *         return tree.xmlSearchNsByHref(c_node.doc, c_node, c_href)
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent
 */
    __pyx_v_is_attribute = 1;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":422
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     c_element = c_node
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_2) {
      __pyx_t_1 = ((__pyx_v_c_node->type != XML_ELEMENT_NODE) != 0);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":423
 *         is_attribute = 1
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     c_element = c_node
 *     while c_node is not NULL:
 */
    __pyx_t_5 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":424
 *     while c_node is not NULL and c_node.type != tree.XML_ELEMENT_NODE:
 *         c_node = c_node.parent
 *     c_element = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_v_c_element = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":425
 *         c_node = c_node.parent
 *     c_element = c_node
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":426
 *     c_element = c_node
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
 */
    __pyx_t_4 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":427
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 */
      __pyx_t_6 = __pyx_v_c_node->nsDef;
      __pyx_v_c_ns = __pyx_t_6;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":428
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:
 */
      while (1) {
        __pyx_t_4 = ((__pyx_v_c_ns != NULL) != 0);
        if (!__pyx_t_4) break;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":429
 *             c_ns = c_node.nsDef
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
 */
        __pyx_t_4 = ((__pyx_v_c_ns->href != NULL) != 0);
        if (__pyx_t_4) {
          __pyx_t_2 = ((xmlStrcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0) != 0);
          __pyx_t_1 = __pyx_t_2;
        } else {
          __pyx_t_1 = __pyx_t_4;
        }
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":430
 *             while c_ns is not NULL:
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
 */
          __pyx_t_1 = ((__pyx_v_c_ns->prefix == NULL) != 0);
          if (__pyx_t_1) {
            __pyx_t_4 = (__pyx_v_is_attribute != 0);
          } else {
            __pyx_t_4 = __pyx_t_1;
          }
          if (__pyx_t_4) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":434
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 */
            __pyx_t_4 = ((__pyx_v_c_default_ns == NULL) != 0);
            if (__pyx_t_4) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":435
 *                         # declaration that we found
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns             # <<<<<<<<<<<<<<
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 */
              __pyx_v_c_default_ns = __pyx_v_c_ns;
              goto __pyx_L15;
            }
            __pyx_L15:;
            goto __pyx_L14;
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":437
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:             # <<<<<<<<<<<<<<
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 */
          __pyx_t_4 = ((xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns) != 0);
          if (__pyx_t_4) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":439
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
 *                         return c_ns             # <<<<<<<<<<<<<<
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:
 */
            __pyx_r = __pyx_v_c_ns;
            goto __pyx_L0;
          }
          __pyx_L14:;
          goto __pyx_L13;
        }
        __pyx_L13:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":440
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 *                 c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *             if c_node is not c_element and c_node.ns is not NULL:
 *                 # optimise: the node may have the namespace itself
 */
        __pyx_t_6 = __pyx_v_c_ns->next;
        __pyx_v_c_ns = __pyx_t_6;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":441
 *                         return c_ns
 *                 c_ns = c_ns.next
 *             if c_node is not c_element and c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
 */
      __pyx_t_4 = ((__pyx_v_c_node != __pyx_v_c_element) != 0);
      if (__pyx_t_4) {
        __pyx_t_1 = ((__pyx_v_c_node->ns != NULL) != 0);
        __pyx_t_2 = __pyx_t_1;
      } else {
        __pyx_t_2 = __pyx_t_4;
      }
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":443
 *             if c_node is not c_element and c_node.ns is not NULL:
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns             # <<<<<<<<<<<<<<
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:
 */
        __pyx_t_6 = __pyx_v_c_node->ns;
        __pyx_v_c_ns = __pyx_t_6;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":444
 *                 # optimise: the node may have the namespace itself
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:             # <<<<<<<<<<<<<<
 *                     if c_ns.prefix is NULL and is_attribute:
 *                         # for attributes, continue searching a named
 */
        __pyx_t_2 = ((__pyx_v_c_ns->href != NULL) != 0);
        if (__pyx_t_2) {
          __pyx_t_4 = ((xmlStrcmp(__pyx_v_c_href, __pyx_v_c_ns->href) == 0) != 0);
          __pyx_t_1 = __pyx_t_4;
        } else {
          __pyx_t_1 = __pyx_t_2;
        }
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":445
 *                 c_ns = c_node.ns
 *                 if c_ns.href is not NULL and tree.xmlStrcmp(c_href, c_ns.href) == 0:
 *                     if c_ns.prefix is NULL and is_attribute:             # <<<<<<<<<<<<<<
 *                         # for attributes, continue searching a named
 *                         # prefix, but keep the first default namespace
 */
          __pyx_t_1 = ((__pyx_v_c_ns->prefix == NULL) != 0);
          if (__pyx_t_1) {
            __pyx_t_2 = (__pyx_v_is_attribute != 0);
          } else {
            __pyx_t_2 = __pyx_t_1;
          }
          if (__pyx_t_2) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":449
 *                         # prefix, but keep the first default namespace
 *                         # declaration that we found
 *                         if c_default_ns is NULL:             # <<<<<<<<<<<<<<
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 */
            __pyx_t_2 = ((__pyx_v_c_default_ns == NULL) != 0);
            if (__pyx_t_2) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":450
 *                         # declaration that we found
 *                         if c_default_ns is NULL:
 *                             c_default_ns = c_ns             # <<<<<<<<<<<<<<
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 */
              __pyx_v_c_default_ns = __pyx_v_c_ns;
              goto __pyx_L19;
            }
            __pyx_L19:;
            goto __pyx_L18;
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":452
 *                             c_default_ns = c_ns
 *                     elif tree.xmlSearchNs(
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:             # <<<<<<<<<<<<<<
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 */
          __pyx_t_2 = ((xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, __pyx_v_c_ns->prefix) == __pyx_v_c_ns) != 0);
          if (__pyx_t_2) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":454
 *                         c_element.doc, c_element, c_ns.prefix) is c_ns:
 *                         # start node is in namespace scope => found!
 *                         return c_ns             # <<<<<<<<<<<<<<
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
 */
            __pyx_r = __pyx_v_c_ns;
            goto __pyx_L0;
          }
          __pyx_L18:;
          goto __pyx_L17;
        }
        __pyx_L17:;
        goto __pyx_L16;
      }
      __pyx_L16:;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":455
 *                         # start node is in namespace scope => found!
 *                         return c_ns
 *         c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
 */
    __pyx_t_5 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_5;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":457
 *         c_node = c_node.parent
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:             # <<<<<<<<<<<<<<
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
 */
  __pyx_t_2 = ((__pyx_v_c_default_ns != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":458
 *     # nothing found => use a matching default namespace or fail
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:             # <<<<<<<<<<<<<<
 *             return c_default_ns
 *     return NULL
 */
    __pyx_t_2 = ((xmlSearchNs(__pyx_v_c_element->doc, __pyx_v_c_element, NULL) == __pyx_v_c_default_ns) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":459
 *     if c_default_ns is not NULL:
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
      __pyx_r = __pyx_v_c_default_ns;
      goto __pyx_L0;
    }
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":460
 *         if tree.xmlSearchNs(c_element.doc, c_element, NULL) is c_default_ns:
 *             return c_default_ns
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":404
 *     return 0
 * 
 * cdef xmlNs* _searchNsByHref(xmlNode* c_node, const_xmlChar* c_href, bint is_attribute):             # <<<<<<<<<<<<<<
 *     u"""Search a namespace declaration that covers a node (element or
 *     attribute).
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":462
 *     return NULL
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     # NOTE: this does not deallocate the node, just unlink it!
 *     cdef xmlNode* c_parent
 */

static int __pyx_f_4lxml_5etree__replaceNodeByChildren(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_child;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_replaceNodeByChildren", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":466
 *     cdef xmlNode* c_parent
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         return 0
 */
  __pyx_t_1 = ((__pyx_v_c_node->children == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":467
 *     cdef xmlNode* c_child
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":468
 *     if c_node.children is NULL:
 *         tree.xmlUnlinkNode(c_node)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     c_parent = c_node.parent
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":470
 *         return 0
 * 
 *     c_parent = c_node.parent             # <<<<<<<<<<<<<<
 *     # fix parent links of children
 *     c_child = c_node.children
 */
  __pyx_t_2 = __pyx_v_c_node->parent;
  __pyx_v_c_parent = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":472
 *     c_parent = c_node.parent
 *     # fix parent links of children
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 */
  __pyx_t_2 = __pyx_v_c_node->children;
  __pyx_v_c_child = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":473
 *     # fix parent links of children
 *     c_child = c_node.children
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         c_child.parent = c_parent
 *         c_child = c_child.next
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":474
 *     c_child = c_node.children
 *     while c_child is not NULL:
 *         c_child.parent = c_parent             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 * 
 */
    __pyx_v_c_child->parent = __pyx_v_c_parent;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":475
 *     while c_child is not NULL:
 *         c_child.parent = c_parent
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # fix namespace references of children if their parent's namespace
 */
    __pyx_t_2 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":479
 *     # fix namespace references of children if their parent's namespace
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *         c_child = c_node.children
 *         while c_child is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_c_node->nsDef != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":480
 *     # declarations get lost
 *     if c_node.nsDef is not NULL:
 *         c_child = c_node.children             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 */
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_child = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":481
 *     if c_node.nsDef is not NULL:
 *         c_child = c_node.children
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 *             c_child = c_child.next
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":482
 *         c_child = c_node.children
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_child.next
 * 
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":483
 *         while c_child is not NULL:
 *             moveNodeToDocument(doc, doc._c_doc, c_child)
 *             c_child = c_child.next             # <<<<<<<<<<<<<<
 * 
 *     # fix sibling links to/from child slice
 */
      __pyx_t_2 = __pyx_v_c_child->next;
      __pyx_v_c_child = __pyx_t_2;
    }
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":486
 * 
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.children = c_node.children
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_node->prev == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":487
 *     # fix sibling links to/from child slice
 *     if c_node.prev is NULL:
 *         c_parent.children = c_node.children             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.prev.next = c_node.children
 */
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_parent->children = __pyx_t_2;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":489
 *         c_parent.children = c_node.children
 *     else:
 *         c_node.prev.next = c_node.children             # <<<<<<<<<<<<<<
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:
 */
    __pyx_t_2 = __pyx_v_c_node->children;
    __pyx_v_c_node->prev->next = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":490
 *     else:
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev             # <<<<<<<<<<<<<<
 *     if c_node.next is NULL:
 *         c_parent.last = c_node.last
 */
    __pyx_t_2 = __pyx_v_c_node->prev;
    __pyx_v_c_node->children->prev = __pyx_t_2;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":491
 *         c_node.prev.next = c_node.children
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:             # <<<<<<<<<<<<<<
 *         c_parent.last = c_node.last
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_node->next == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":492
 *         c_node.children.prev = c_node.prev
 *     if c_node.next is NULL:
 *         c_parent.last = c_node.last             # <<<<<<<<<<<<<<
 *     else:
 *         c_node.next.prev = c_node.last
 */
    __pyx_t_2 = __pyx_v_c_node->last;
    __pyx_v_c_parent->last = __pyx_t_2;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":494
 *         c_parent.last = c_node.last
 *     else:
 *         c_node.next.prev = c_node.last             # <<<<<<<<<<<<<<
 *         c_node.last.next = c_node.next
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->last;
    __pyx_v_c_node->next->prev = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":495
 *     else:
 *         c_node.next.prev = c_node.last
 *         c_node.last.next = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     # unlink c_node
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node->last->next = __pyx_t_2;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":498
 * 
 *     # unlink c_node
 *     c_node.children = c_node.last = NULL             # <<<<<<<<<<<<<<
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0
 */
  __pyx_v_c_node->children = NULL;
  __pyx_v_c_node->last = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":499
 *     # unlink c_node
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_v_c_node->parent = NULL;
  __pyx_v_c_node->next = NULL;
  __pyx_v_c_node->prev = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":500
 *     c_node.children = c_node.last = NULL
 *     c_node.parent = c_node.next = c_node.prev = NULL
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":462
 *     return NULL
 * 
 * cdef int _replaceNodeByChildren(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     # NOTE: this does not deallocate the node, just unlink it!
 *     cdef xmlNode* c_parent
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._replaceNodeByChildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":502
 *     return 0
 * 
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 */

static PyObject *__pyx_f_4lxml_5etree__attributeValue(xmlNode *__pyx_v_c_element, xmlAttr *__pyx_v_c_attrib_node) {
  const xmlChar *__pyx_v_c_href;
  xmlChar *__pyx_v_value;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeValue", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":503
 * 
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     c_href = _getNs(<xmlNode*>c_attrib_node)             # <<<<<<<<<<<<<<
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:
 */
  __pyx_v_c_href = _getNs(((xmlNode *)__pyx_v_c_attrib_node));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":504
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(value)
 */
  __pyx_v_value = xmlGetNsProp(__pyx_v_c_element, __pyx_v_c_attrib_node->name, __pyx_v_c_href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":505
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(value)
 *     finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":506
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 *     try:
 *         result = funicode(value)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(value)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":508
 *         result = funicode(value)
 *     finally:
 *         tree.xmlFree(value)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_value);
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __pyx_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {
        xmlFree(__pyx_v_value);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":509
 *     finally:
 *         tree.xmlFree(value)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeValueFromNsName(xmlNode* c_element,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":502
 *     return 0
 * 
 * cdef object _attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     c_href = _getNs(<xmlNode*>c_attrib_node)
 *     value = tree.xmlGetNsProp(c_element, c_attrib_node.name, c_href)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._attributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":511
 *     return result
 * 
 * cdef object _attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                       const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 */

static PyObject *__pyx_f_4lxml_5etree__attributeValueFromNsName(xmlNode *__pyx_v_c_element, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  xmlChar *__pyx_v_c_result;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeValueFromNsName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":513
 * cdef object _attributeValueFromNsName(xmlNode* c_element,
 *                                       const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)             # <<<<<<<<<<<<<<
 *     if c_result is NULL:
 *         return None
 */
  __pyx_v_c_result = xmlGetNsProp(__pyx_v_c_element, __pyx_v_c_name, __pyx_v_c_href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":514
 *                                       const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     try:
 */
  __pyx_t_1 = ((__pyx_v_c_result == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":515
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 *     if c_result is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(c_result)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":516
 *     if c_result is NULL:
 *         return None
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":517
 *         return None
 *     try:
 *         result = funicode(c_result)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_result)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":519
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_result);
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_result);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":520
 *     finally:
 *         tree.xmlFree(c_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":511
 *     return result
 * 
 * cdef object _attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                       const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_result = tree.xmlGetNsProp(c_element, c_name, c_href)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._attributeValueFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":522
 *     return result
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 */

static PyObject *__pyx_f_4lxml_5etree__getNodeAttributeValue(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_href;
  xmlChar *__pyx_v_c_result;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  const xmlChar *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getNodeAttributeValue", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":523
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":524
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)             # <<<<<<<<<<<<<<
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
 *     if c_result is NULL:
 */
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if ((__pyx_t_5 != 0)) {
    __pyx_t_4 = ((const xmlChar *)NULL);
  } else {
    __pyx_t_4 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":525
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)             # <<<<<<<<<<<<<<
 *     if c_result is NULL:
 *         # XXX free namespace that is not in use..?
 */
  __pyx_v_c_result = xmlGetNsProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":526
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     c_result = tree.xmlGetNsProp(c_node, _xcstr(tag), c_href)
 *     if c_result is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return default
 */
  __pyx_t_5 = ((__pyx_v_c_result == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":528
 *     if c_result is NULL:
 *         # XXX free namespace that is not in use..?
 *         return default             # <<<<<<<<<<<<<<
 *     try:
 *         result = funicode(c_result)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":529
 *         # XXX free namespace that is not in use..?
 *         return default
 *     try:             # <<<<<<<<<<<<<<
 *         result = funicode(c_result)
 *     finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":530
 *         return default
 *     try:
 *         result = funicode(c_result)             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_result)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":532
 *         result = funicode(c_result)
 *     finally:
 *         tree.xmlFree(c_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_result);
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_result);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":533
 *     finally:
 *         tree.xmlFree(c_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":522
 *     return result
 * 
 * cdef object _getNodeAttributeValue(xmlNode* c_node, key, default):             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._getNodeAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":535
 *     return result
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__getAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getAttributeValue", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":536
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):
 *     return _getNodeAttributeValue(element._c_node, key, default)             # <<<<<<<<<<<<<<
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNodeAttributeValue(__pyx_v_element->_c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":535
 *     return result
 * 
 * cdef inline object _getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":538
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)
 */

static int __pyx_f_4lxml_5etree__setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_tag;
  const xmlChar *__pyx_v_c_value;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlNs *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setAttributeValue", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":540
 * cdef int _setAttributeValue(_Element element, key, value) except -1:
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     if not element._doc._parser._for_html:
 *         _attributeValidOrRaise(tag)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":541
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)
 *     if not element._doc._parser._for_html:             # <<<<<<<<<<<<<<
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 */
  __pyx_t_4 = ((!(__pyx_v_element->_doc->_parser->_for_html != 0)) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":542
 *     ns, tag = _getNsTag(key)
 *     if not element._doc._parser._for_html:
 *         _attributeValidOrRaise(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _xcstr(tag)
 *     if isinstance(value, QName):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValidOrRaise(__pyx_v_tag); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":543
 *     if not element._doc._parser._for_html:
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)             # <<<<<<<<<<<<<<
 *     if isinstance(value, QName):
 *         value = _resolveQNameText(element, value)
 */
  __pyx_v_c_tag = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":544
 *         _attributeValidOrRaise(tag)
 *     c_tag = _xcstr(tag)
 *     if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *         value = _resolveQNameText(element, value)
 *     else:
 */
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":545
 *     c_tag = _xcstr(tag)
 *     if isinstance(value, QName):
 *         value = _resolveQNameText(element, value)             # <<<<<<<<<<<<<<
 *     else:
 *         value = _utf8(value)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_element, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":547
 *         value = _resolveQNameText(element, value)
 *     else:
 *         value = _utf8(value)             # <<<<<<<<<<<<<<
 *     c_value = _xcstr(value)
 *     if ns is None:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":548
 *     else:
 *         value = _utf8(value)
 *     c_value = _xcstr(value)             # <<<<<<<<<<<<<<
 *     if ns is None:
 *         c_ns = NULL
 */
  __pyx_v_c_value = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":549
 *         value = _utf8(value)
 *     c_value = _xcstr(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         c_ns = NULL
 *     else:
 */
  __pyx_t_6 = (__pyx_v_ns == Py_None);
  __pyx_t_4 = (__pyx_t_6 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":550
 *     c_value = _xcstr(value)
 *     if ns is None:
 *         c_ns = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)
 */
    __pyx_v_c_ns = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":552
 *         c_ns = NULL
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)             # <<<<<<<<<<<<<<
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)
 *     return 0
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns), NULL, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_ns = __pyx_t_7;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":553
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlSetNsProp(__pyx_v_element->_c_node, __pyx_v_c_ns, __pyx_v_c_tag, __pyx_v_c_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":554
 *         c_ns = element._doc._findOrBuildNodeNs(element._c_node, _xcstr(ns), NULL, 1)
 *     tree.xmlSetNsProp(element._c_node, c_ns, c_tag, c_value)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _delAttribute(_Element element, key) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":538
 *     return _getNodeAttributeValue(element._c_node, key, default)
 * 
 * cdef int _setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(key)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._setAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":556
 *     return 0
 * 
 * cdef int _delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 */

static int __pyx_f_4lxml_5etree__delAttribute(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_href;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  const xmlChar *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_delAttribute", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":557
 * 
 * cdef int _delAttribute(_Element element, key) except -1:
 *     ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":558
 * cdef int _delAttribute(_Element element, key) except -1:
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)             # <<<<<<<<<<<<<<
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 *         raise KeyError, key
 */
  __pyx_t_5 = (__pyx_v_ns == Py_None);
  if ((__pyx_t_5 != 0)) {
    __pyx_t_4 = ((const xmlChar *)NULL);
  } else {
    __pyx_t_4 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":559
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 *     return 0
 */
  __pyx_t_5 = (__pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_element->_c_node, __pyx_v_c_href, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag)) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":560
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 *         raise KeyError, key             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":561
 *     if _delAttributeFromNsName(element._c_node, c_href, _xcstr(tag)):
 *         raise KeyError, key
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":556
 *     return 0
 * 
 * cdef int _delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     ns, tag = _getNsTag(key)
 *     c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._delAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":563
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:
 */

static int __pyx_f_4lxml_5etree__delAttributeFromNsName(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_delAttributeFromNsName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":564
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)             # <<<<<<<<<<<<<<
 *     if c_attr is NULL:
 *         # XXX free namespace that is not in use..?
 */
  __pyx_v_c_attr = xmlHasNsProp(__pyx_v_c_node, __pyx_v_c_name, __pyx_v_c_href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":565
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:             # <<<<<<<<<<<<<<
 *         # XXX free namespace that is not in use..?
 *         return -1
 */
  __pyx_t_1 = ((__pyx_v_c_attr == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":567
 *     if c_attr is NULL:
 *         # XXX free namespace that is not in use..?
 *         return -1             # <<<<<<<<<<<<<<
 *     tree.xmlRemoveProp(c_attr)
 *     return 0
 */
    __pyx_r = -1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":568
 *         # XXX free namespace that is not in use..?
 *         return -1
 *     tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlRemoveProp(__pyx_v_c_attr);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":569
 *         return -1
 *     tree.xmlRemoveProp(c_attr)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":563
 *     return 0
 * 
 * cdef int _delAttributeFromNsName(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     c_attr = tree.xmlHasNsProp(c_node, c_name, c_href)
 *     if c_attr is NULL:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":571
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     u"""Collect all attributes of a node in a list.  Depending on collecttype,
 *     it collects either the name (1), the value (2) or the name-value tuples.
 */

static PyObject *__pyx_f_4lxml_5etree__collectAttributes(xmlNode *__pyx_v_c_node, int __pyx_v_collecttype) {
  Py_ssize_t __pyx_v_count;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlAttr *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectAttributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":576
 *     """
 *     cdef Py_ssize_t count
 *     c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *     count = 0
 *     while c_attr is not NULL:
 */
  __pyx_t_1 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":577
 *     cdef Py_ssize_t count
 *     c_attr = c_node.properties
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":578
 *     c_attr = c_node.properties
 *     count = 0
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count += 1
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_attr != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":579
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_attr = c_attr.next
 */
    __pyx_t_2 = ((__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":580
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 * 
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":581
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             count += 1
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 * 
 *     if not count:
 */
    __pyx_t_1 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":583
 *         c_attr = c_attr.next
 * 
 *     if not count:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_count != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":584
 * 
 *     if not count:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     attributes = [None] * count
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":586
 *         return []
 * 
 *     attributes = [None] * count             # <<<<<<<<<<<<<<
 *     c_attr = c_node.properties
 *     count = 0
 */
  __pyx_t_3 = PyList_New(1 * ((__pyx_v_count<0) ? 0:__pyx_v_count)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_count; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None);
      __Pyx_GIVEREF(Py_None);
    }
  }
  __pyx_v_attributes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":587
 * 
 *     attributes = [None] * count
 *     c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *     count = 0
 *     while c_attr is not NULL:
 */
  __pyx_t_1 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":588
 *     attributes = [None] * count
 *     c_attr = c_node.properties
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":589
 *     c_attr = c_node.properties
 *     count = 0
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_attr != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":590
 *     count = 0
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 */
    __pyx_t_2 = ((__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":593
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:             # <<<<<<<<<<<<<<
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 */
      switch (__pyx_v_collecttype) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":591
 *     while c_attr is not NULL:
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:             # <<<<<<<<<<<<<<
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
 */
        case 1:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":592
 *         if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)             # <<<<<<<<<<<<<<
 *             elif collecttype == 2:
 *                 item = _attributeValue(c_node, c_attr)
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;
        break;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":593
 *             if collecttype == 1:
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:             # <<<<<<<<<<<<<<
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 */
        case 2:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":594
 *                 item = _namespacedName(<xmlNode*>c_attr)
 *             elif collecttype == 2:
 *                 item = _attributeValue(c_node, c_attr)             # <<<<<<<<<<<<<<
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
        __pyx_t_3 = 0;
        break;
        default:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":596
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":597
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 *                         _attributeValue(c_node, c_attr))             # <<<<<<<<<<<<<<
 *             attributes[count] = item
 *             count += 1
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":596
 *                 item = _attributeValue(c_node, c_attr)
 *             else:
 *                 item = (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
 */
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 596; __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);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
        __pyx_t_5 = 0;
        break;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":598
 *                 item = (_namespacedName(<xmlNode*>c_attr),
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_attr = c_attr.next
 */
      if (unlikely(__Pyx_SetItemInt(__pyx_v_attributes, __pyx_v_count, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":599
 *                         _attributeValue(c_node, c_attr))
 *             attributes[count] = item
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return attributes
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":600
 *             attributes[count] = item
 *             count += 1
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     return attributes
 * 
 */
    __pyx_t_1 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":601
 *             count += 1
 *         c_attr = c_attr.next
 *     return attributes             # <<<<<<<<<<<<<<
 * 
 * cdef object __RE_XML_ENCODING = re.compile(
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_attributes);
  __pyx_r = __pyx_v_attributes;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":571
 *     return 0
 * 
 * cdef list _collectAttributes(xmlNode* c_node, int collecttype):             # <<<<<<<<<<<<<<
 *     u"""Collect all attributes of a node in a list.  Depending on collecttype,
 *     it collects either the name (1), the value (2) or the name-value tuples.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._collectAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":609
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(ur'\g<1>\g<2>', xml_string)
 */

static PyObject *__pyx_f_4lxml_5etree__stripEncodingDeclaration(PyObject *__pyx_v_xml_string) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stripEncodingDeclaration", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":611
 * cdef object _stripEncodingDeclaration(object xml_string):
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(ur'\g<1>\g<2>', xml_string)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_u_g_1_g_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_g_1_g_2);
  __Pyx_GIVEREF(__pyx_kp_u_g_1_g_2);
  __Pyx_INCREF(__pyx_v_xml_string);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_xml_string);
  __Pyx_GIVEREF(__pyx_v_xml_string);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 611; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":609
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):             # <<<<<<<<<<<<<<
 *     # this is a hack to remove the XML encoding declaration from unicode
 *     return __REPLACE_XML_ENCODING(ur'\g<1>\g<2>', xml_string)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._stripEncodingDeclaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":613
 *     return __REPLACE_XML_ENCODING(ur'\g<1>\g<2>', xml_string)
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:             # <<<<<<<<<<<<<<
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None
 */

static int __pyx_f_4lxml_5etree__hasEncodingDeclaration(PyObject *__pyx_v_xml_string) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_hasEncodingDeclaration", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":615
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasText(xmlNode* c_node):
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_xml_string);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xml_string);
  __Pyx_GIVEREF(__pyx_v_xml_string);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree___HAS_XML_ENCODING, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 615; __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_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":613
 *     return __REPLACE_XML_ENCODING(ur'\g<1>\g<2>', xml_string)
 * 
 * cdef bint _hasEncodingDeclaration(object xml_string) except -1:             # <<<<<<<<<<<<<<
 *     # check if a (unicode) string has an XML encoding declaration
 *     return __HAS_XML_ENCODING(xml_string) is not None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._hasEncodingDeclaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":617
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef inline bint _hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasText(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":618
 * 
 * cdef inline bint _hasText(xmlNode* c_node):
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->children) != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":617
 *     return __HAS_XML_ENCODING(xml_string) is not None
 * 
 * cdef inline bint _hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":620
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasTail", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":621
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef _collectText(xmlNode* c_node):
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next) != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":620
 *     return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL
 * 
 * cdef inline bint _hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":623
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Collect all text nodes and return them as a unicode string.
 * 
 */

static PyObject *__pyx_f_4lxml_5etree__collectText(xmlNode *__pyx_v_c_node) {
  Py_ssize_t __pyx_v_scount;
  xmlChar *__pyx_v_c_text;
  xmlNode *__pyx_v_c_node_cur;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlChar *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  unsigned char *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":634
 *     cdef xmlNode* c_node_cur
 *     # check for multiple text nodes
 *     scount = 0             # <<<<<<<<<<<<<<
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 */
  __pyx_v_scount = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":635
 *     # check for multiple text nodes
 *     scount = 0
 *     c_text = NULL             # <<<<<<<<<<<<<<
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
 */
  __pyx_v_c_text = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":636
 *     scount = 0
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)             # <<<<<<<<<<<<<<
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node);
  __pyx_v_c_node_cur = __pyx_t_1;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":637
 *     c_text = NULL
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_node_cur != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":638
 *     c_node_cur = c_node = _textNodeOrSkip(c_node)
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':             # <<<<<<<<<<<<<<
 *             c_text = c_node_cur.content
 *         scount += 1
 */
    __pyx_t_2 = (((__pyx_v_c_node_cur->content[0]) != '\x00') != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":639
 *     while c_node_cur is not NULL:
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content             # <<<<<<<<<<<<<<
 *         scount += 1
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)
 */
      __pyx_t_3 = __pyx_v_c_node_cur->content;
      __pyx_v_c_text = __pyx_t_3;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":640
 *         if c_node_cur.content[0] != c'\0':
 *             c_text = c_node_cur.content
 *         scount += 1             # <<<<<<<<<<<<<<
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)
 * 
 */
    __pyx_v_scount = (__pyx_v_scount + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":641
 *             c_text = c_node_cur.content
 *         scount += 1
 *         c_node_cur = _textNodeOrSkip(c_node_cur.next)             # <<<<<<<<<<<<<<
 * 
 *     # handle two most common cases first
 */
    __pyx_v_c_node_cur = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node_cur->next);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":644
 * 
 *     # handle two most common cases first
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         return '' if scount > 0 else None
 *     if scount == 1:
 */
  __pyx_t_2 = ((__pyx_v_c_text == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":645
 *     # handle two most common cases first
 *     if c_text is NULL:
 *         return '' if scount > 0 else None             # <<<<<<<<<<<<<<
 *     if scount == 1:
 *         return funicode(c_text)
 */
    __Pyx_XDECREF(__pyx_r);
    if (((__pyx_v_scount > 0) != 0)) {
      __Pyx_INCREF(__pyx_kp_s__15);
      __pyx_t_4 = __pyx_kp_s__15;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_4 = Py_None;
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":646
 *     if c_text is NULL:
 *         return '' if scount > 0 else None
 *     if scount == 1:             # <<<<<<<<<<<<<<
 *         return funicode(c_text)
 * 
 */
  __pyx_t_2 = ((__pyx_v_scount == 1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":647
 *         return '' if scount > 0 else None
 *     if scount == 1:
 *         return funicode(c_text)             # <<<<<<<<<<<<<<
 * 
 *     # the rest is not performance critical anymore
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":650
 * 
 *     # the rest is not performance critical anymore
 *     result = b''             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         result += <unsigned char*>c_node.content
 */
  __Pyx_INCREF(__pyx_kp_b__15);
  __pyx_v_result = __pyx_kp_b__15;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":651
 *     # the rest is not performance critical anymore
 *     result = b''
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         result += <unsigned char*>c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":652
 *     result = b''
 *     while c_node is not NULL:
 *         result += <unsigned char*>c_node.content             # <<<<<<<<<<<<<<
 *         c_node = _textNodeOrSkip(c_node.next)
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 */
    __pyx_t_4 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_node->content)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":653
 *     while c_node is not NULL:
 *         result += <unsigned char*>c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":654
 *         result += <unsigned char*>c_node.content
 *         c_node = _textNodeOrSkip(c_node.next)
 *     return funicode(<const_xmlChar*><unsigned char*>result)             # <<<<<<<<<<<<<<
 * 
 * cdef void _removeText(xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyObject_AsUString(__pyx_v_result); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(((const xmlChar *)((unsigned char *)__pyx_t_6))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":623
 *     return c_node is not NULL and _textNodeOrSkip(c_node.next) is not NULL
 * 
 * cdef _collectText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Collect all text nodes and return them as a unicode string.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._collectText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":656
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 * cdef void _removeText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Remove all text nodes.
 * 
 */

static void __pyx_f_4lxml_5etree__removeText(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_removeText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":662
 *     """
 *     cdef xmlNode* c_next
 *     c_node = _textNodeOrSkip(c_node)             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":663
 *     cdef xmlNode* c_next
 *     c_node = _textNodeOrSkip(c_node)
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":664
 *     c_node = _textNodeOrSkip(c_node)
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":665
 *     while c_node is not NULL:
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":666
 *         c_next = _textNodeOrSkip(c_node.next)
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
 */
    xmlFreeNode(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":667
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlFreeNode(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":656
 *     return funicode(<const_xmlChar*><unsigned char*>result)
 * 
 * cdef void _removeText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Remove all text nodes.
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":669
 *         c_node = c_next
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 */

static int __pyx_f_4lxml_5etree__setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  PyObject *__pyx_v_text = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setNodeText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":672
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         return 0
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":673
 *     # remove all text nodes at the start first
 *     _removeText(c_node.children)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # now add new text node with value at start
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":674
 *     _removeText(c_node.children)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # now add new text node with value at start
 *     if python._isString(value):
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":676
 *         return 0
 *     # now add new text node with value at start
 *     if python._isString(value):             # <<<<<<<<<<<<<<
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 */
  __pyx_t_2 = (_isString(__pyx_v_value) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":677
 *     # now add new text node with value at start
 *     if python._isString(value):
 *         text = _utf8(value)             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 *     elif isinstance(value, CDATA):
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_text = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":678
 *     if python._isString(value):
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *     elif isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(
 */
    __pyx_v_c_text_node = xmlNewDocText(__pyx_v_c_node->doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));
    goto __pyx_L4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":679
 *         text = _utf8(value)
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 *     elif isinstance(value, CDATA):             # <<<<<<<<<<<<<<
 *         c_text_node = tree.xmlNewCDataBlock(
 *             c_node.doc, _xcstr((<CDATA>value)._utf8_data),
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_CDATA)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":681
 *     elif isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(
 *             c_node.doc, _xcstr((<CDATA>value)._utf8_data),             # <<<<<<<<<<<<<<
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 *     else:
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":682
 *         c_text_node = tree.xmlNewCDataBlock(
 *             c_node.doc, _xcstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))             # <<<<<<<<<<<<<<
 *     else:
 *         # this will raise the right error
 */
    __pyx_t_4 = ((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_value)->_utf8_data;
    __Pyx_INCREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":680
 *         c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 *     elif isinstance(value, CDATA):
 *         c_text_node = tree.xmlNewCDataBlock(             # <<<<<<<<<<<<<<
 *             c_node.doc, _xcstr((<CDATA>value)._utf8_data),
 *             python.PyBytes_GET_SIZE((<CDATA>value)._utf8_data))
 */
    __pyx_v_c_text_node = xmlNewCDataBlock(__pyx_v_c_node->doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_t_3), PyBytes_GET_SIZE(__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":685
 *     else:
 *         # this will raise the right error
 *        _utf8(value)             # <<<<<<<<<<<<<<
 *        return -1
 *     if c_node.children is NULL:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":686
 *         # this will raise the right error
 *        _utf8(value)
 *        return -1             # <<<<<<<<<<<<<<
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)
 */
    __pyx_r = -1;
    goto __pyx_L0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":687
 *        _utf8(value)
 *        return -1
 *     if c_node.children is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_node->children == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":688
 *        return -1
 *     if c_node.children is NULL:
 *         tree.xmlAddChild(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
 */
    xmlAddChild(__pyx_v_c_node, __pyx_v_c_text_node);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":690
 *         tree.xmlAddChild(c_node, c_text_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    xmlAddPrevSibling(__pyx_v_c_node->children, __pyx_v_c_text_node);
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":691
 *     else:
 *         tree.xmlAddPrevSibling(c_node.children, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":669
 *         c_node = c_next
 * 
 * cdef int _setNodeText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._setNodeText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":693
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 */

static int __pyx_f_4lxml_5etree__setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_text_node;
  PyObject *__pyx_v_text = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setTailText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":696
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         return 0
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":697
 *     # remove all text nodes at the start first
 *     _removeText(c_node.next)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     text = _utf8(value)
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":698
 *     _removeText(c_node.next)
 *     if value is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     text = _utf8(value)
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":699
 *     if value is None:
 *         return 0
 *     text = _utf8(value)             # <<<<<<<<<<<<<<
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 *     # XXX what if we're the top element?
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_text = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":700
 *         return 0
 *     text = _utf8(value)
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *     # XXX what if we're the top element?
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 */
  __pyx_v_c_text_node = xmlNewDocText(__pyx_v_c_node->doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":702
 *     c_text_node = tree.xmlNewDocText(c_node.doc, _xcstr(text))
 *     # XXX what if we're the top element?
 *     tree.xmlAddNextSibling(c_node, c_text_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlAddNextSibling(__pyx_v_c_node, __pyx_v_c_text_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":703
 *     # XXX what if we're the top element?
 *     tree.xmlAddNextSibling(c_node, c_text_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _resolveQNameText(_Element element, value):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":693
 *     return 0
 * 
 * cdef int _setTailText(xmlNode* c_node, value) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_text_node
 *     # remove all text nodes at the start first
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._setTailText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":705
 *     return 0
 * 
 * cdef bytes _resolveQNameText(_Element element, value):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 */

static PyObject *__pyx_f_4lxml_5etree__resolveQNameText(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_value) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlNs *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_resolveQNameText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":707
 * cdef bytes _resolveQNameText(_Element element, value):
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)             # <<<<<<<<<<<<<<
 *     if ns is None:
 *         return tag
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_tag = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":708
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 *     if ns is None:             # <<<<<<<<<<<<<<
 *         return tag
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":709
 *     ns, tag = _getNsTag(value)
 *     if ns is None:
 *         return tag             # <<<<<<<<<<<<<<
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyBytes_CheckExact(__pyx_v_tag))||((__pyx_v_tag) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_tag)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_tag);
    __pyx_r = ((PyObject*)__pyx_v_tag);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":711
 *         return tag
 *     else:
 *         c_ns = element._doc._findOrBuildNodeNs(             # <<<<<<<<<<<<<<
 *             element._c_node, _xcstr(ns), NULL, 0)
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_element->_doc, __pyx_v_element->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns), NULL, 0); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_ns = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":713
 *         c_ns = element._doc._findOrBuildNodeNs(
 *             element._c_node, _xcstr(ns), NULL, 0)
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyBytes_FromFormat(__pyx_k_s_s, __pyx_v_c_ns->prefix, PyBytes_AS_STRING(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 713; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":705
 *     return 0
 * 
 * cdef bytes _resolveQNameText(_Element element, value):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     ns, tag = _getNsTag(value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._resolveQNameText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":715
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__hasChild(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_hasChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":716
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node):
 */
  __pyx_t_1 = (__pyx_v_c_node != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0) != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":715
 *         return python.PyBytes_FromFormat('%s:%s', c_ns.prefix, _cstr(tag))
 * 
 * cdef inline bint _hasChild(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":718
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 */

static CYTHON_INLINE Py_ssize_t __pyx_f_4lxml_5etree__countElements(xmlNode *__pyx_v_c_node) {
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  __Pyx_RefNannySetupContext("_countElements", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":721
 *     u"Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 *     count = 0             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 */
  __pyx_v_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":722
 *     cdef Py_ssize_t count
 *     count = 0
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             count += 1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":723
 *     count = 0
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             count += 1
 *         c_node = c_node.next
 */
    __pyx_t_1 = (_isElement(__pyx_v_c_node) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":724
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             count += 1             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return count
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":725
 *         if _isElement(c_node):
 *             count += 1
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":726
 *             count += 1
 *         c_node = c_node.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef int _findChildSlice(
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":718
 *     return c_node is not NULL and _findChildForwards(c_node, 0) is not NULL
 * 
 * cdef inline Py_ssize_t _countElements(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Counts the elements within the following siblings and the node itself."
 *     cdef Py_ssize_t count
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":728
 *     return count
 * 
 * cdef int _findChildSlice(             # <<<<<<<<<<<<<<
 *     slice sliceobject, xmlNode* c_parent,
 *     xmlNode** c_start_node, Py_ssize_t* c_step, Py_ssize_t* c_length) except -1:
 */

static int __pyx_f_4lxml_5etree__findChildSlice(PyObject *__pyx_v_sliceobject, xmlNode *__pyx_v_c_parent, xmlNode **__pyx_v_c_start_node, Py_ssize_t *__pyx_v_c_step, Py_ssize_t *__pyx_v_c_length) {
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_childcount;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findChildSlice", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":736
 *     pointer arguments.
 *     """
 *     cdef Py_ssize_t start = 0, stop = 0, childcount             # <<<<<<<<<<<<<<
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:
 */
  __pyx_v_start = 0;
  __pyx_v_stop = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":737
 *     """
 *     cdef Py_ssize_t start = 0, stop = 0, childcount
 *     childcount = _countElements(c_parent.children)             # <<<<<<<<<<<<<<
 *     if childcount == 0:
 *         c_start_node[0] = NULL
 */
  __pyx_v_childcount = __pyx_f_4lxml_5etree__countElements(__pyx_v_c_parent->children);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":738
 *     cdef Py_ssize_t start = 0, stop = 0, childcount
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 */
  __pyx_t_1 = ((__pyx_v_childcount == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":739
 *     childcount = _countElements(c_parent.children)
 *     if childcount == 0:
 *         c_start_node[0] = NULL             # <<<<<<<<<<<<<<
 *         c_length[0] = 0
 *         if sliceobject.step is None:
 */
    (__pyx_v_c_start_node[0]) = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":740
 *     if childcount == 0:
 *         c_start_node[0] = NULL
 *         c_length[0] = 0             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             c_step[0] = 1
 */
    (__pyx_v_c_length[0]) = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":741
 *         c_start_node[0] = NULL
 *         c_length[0] = 0
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             c_step[0] = 1
 *         else:
 */
    __pyx_t_1 = (((PySliceObject*)__pyx_v_sliceobject)->step == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":742
 *         c_length[0] = 0
 *         if sliceobject.step is None:
 *             c_step[0] = 1             # <<<<<<<<<<<<<<
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
 */
      (__pyx_v_c_step[0]) = 1;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":744
 *             c_step[0] = 1
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)             # <<<<<<<<<<<<<<
 *         return 0
 *     python.PySlice_GetIndicesEx(
 */
      __pyx_t_3 = ((PySliceObject*)__pyx_v_sliceobject)->step;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = _PyEval_SliceIndex(__pyx_t_3, __pyx_v_c_step); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":745
 *         else:
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
 *         return 0             # <<<<<<<<<<<<<<
 *     python.PySlice_GetIndicesEx(
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":746
 *             python._PyEval_SliceIndex(sliceobject.step, c_step)
 *         return 0
 *     python.PySlice_GetIndicesEx(             # <<<<<<<<<<<<<<
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 *     if start > childcount / 2:
 */
  __pyx_t_4 = _lx_PySlice_GetIndicesEx(__pyx_v_sliceobject, __pyx_v_childcount, (&__pyx_v_start), (&__pyx_v_stop), __pyx_v_c_step, __pyx_v_c_length); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":748
 *     python.PySlice_GetIndicesEx(
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 *     if start > childcount / 2:             # <<<<<<<<<<<<<<
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_start > __Pyx_div_Py_ssize_t(__pyx_v_childcount, 2)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":749
 *         sliceobject, childcount, &start, &stop, c_step, c_length)
 *     if start > childcount / 2:
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
 */
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_parent, ((__pyx_v_childcount - __pyx_v_start) - 1));
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":751
 *         c_start_node[0] = _findChildBackwards(c_parent, childcount - start - 1)
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    (__pyx_v_c_start_node[0]) = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_parent, __pyx_v_start);
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":752
 *     else:
 *         c_start_node[0] = _findChild(c_parent, start)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":728
 *     return count
 * 
 * cdef int _findChildSlice(             # <<<<<<<<<<<<<<
 *     slice sliceobject, xmlNode* c_parent,
 *     xmlNode** c_start_node, Py_ssize_t* c_step, Py_ssize_t* c_length) except -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._findChildSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":754
 *     return 0
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:             # <<<<<<<<<<<<<<
 *     u"""Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
 */

static int __pyx_f_4lxml_5etree__isFullSlice(PyObject *__pyx_v_sliceobject) {
  Py_ssize_t __pyx_v_step;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_isFullSlice", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":757
 *     u"""Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
 *     cdef Py_ssize_t step = 0             # <<<<<<<<<<<<<<
 *     if sliceobject is None:
 *         return 0
 */
  __pyx_v_step = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":758
 *     """
 *     cdef Py_ssize_t step = 0
 *     if sliceobject is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     if sliceobject.start is None and \
 */
  __pyx_t_1 = (__pyx_v_sliceobject == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":759
 *     cdef Py_ssize_t step = 0
 *     if sliceobject is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":760
 *     if sliceobject is None:
 *         return 0
 *     if sliceobject.start is None and \             # <<<<<<<<<<<<<<
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 */
  __pyx_t_2 = (((PySliceObject*)__pyx_v_sliceobject)->start == Py_None);
  if ((__pyx_t_2 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":761
 *         return 0
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:             # <<<<<<<<<<<<<<
 *         if sliceobject.step is None:
 *             return 1
 */
    __pyx_t_1 = (((PySliceObject*)__pyx_v_sliceobject)->stop == Py_None);
    __pyx_t_3 = (__pyx_t_1 != 0);
  } else {
    __pyx_t_3 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":762
 *     if sliceobject.start is None and \
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:             # <<<<<<<<<<<<<<
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 */
    __pyx_t_3 = (((PySliceObject*)__pyx_v_sliceobject)->step == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":763
 *             sliceobject.stop is None:
 *         if sliceobject.step is None:
 *             return 1             # <<<<<<<<<<<<<<
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":764
 *         if sliceobject.step is None:
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)             # <<<<<<<<<<<<<<
 *         if step == 1:
 *             return 1
 */
    __pyx_t_4 = ((PySliceObject*)__pyx_v_sliceobject)->step;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = _PyEval_SliceIndex(__pyx_t_4, (&__pyx_v_step)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":765
 *             return 1
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:             # <<<<<<<<<<<<<<
 *             return 1
 *         return 0
 */
    __pyx_t_2 = ((__pyx_v_step == 1) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":766
 *         python._PyEval_SliceIndex(sliceobject.step, &step)
 *         if step == 1:
 *             return 1             # <<<<<<<<<<<<<<
 *         return 0
 *     return 0
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":767
 *         if step == 1:
 *             return 1
 *         return 0             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":768
 *             return 1
 *         return 0
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef _collectChildren(_Element element):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":754
 *     return 0
 * 
 * cdef bint _isFullSlice(slice sliceobject) except -1:             # <<<<<<<<<<<<<<
 *     u"""Conservative guess if this slice is a full slice as in ``s[:]``.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._isFullSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":770
 *     return 0
 * 
 * cdef _collectChildren(_Element element):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef list result = []
 */

static PyObject *__pyx_f_4lxml_5etree__collectChildren(struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectChildren", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":772
 * cdef _collectChildren(_Element element):
 *     cdef xmlNode* c_node
 *     cdef list result = []             # <<<<<<<<<<<<<<
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":773
 *     cdef xmlNode* c_node
 *     cdef list result = []
 *     c_node = element._c_node.children             # <<<<<<<<<<<<<<
 *     if c_node is not NULL:
 *         if not _isElement(c_node):
 */
  __pyx_t_2 = __pyx_v_element->_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":774
 *     cdef list result = []
 *     c_node = element._c_node.children
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 */
  __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":775
 *     c_node = element._c_node.children
 *     if c_node is not NULL:
 *         if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 */
    __pyx_t_3 = ((!(_isElement(__pyx_v_c_node) != 0)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":776
 *     if c_node is not NULL:
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":777
 *         if not _isElement(c_node):
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)
 */
    while (1) {
      __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
      if (!__pyx_t_3) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":778
 *             c_node = _nextElement(c_node)
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))             # <<<<<<<<<<<<<<
 *             c_node = _nextElement(c_node)
 *     return result
 */
      __pyx_t_1 = ((PyObject *)__pyx_v_element->_doc);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":779
 *         while c_node is not NULL:
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":780
 *             result.append(_elementFactory(element._doc, c_node))
 *             c_node = _nextElement(c_node)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":770
 *     return 0
 * 
 * cdef _collectChildren(_Element element):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef list result = []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._collectChildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":782
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChild(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_findChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":783
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_index < 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":784
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         return _findChildForwards(c_node, index)
 */
    __pyx_r = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_node, ((-__pyx_v_index) - 1));
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":786
 *         return _findChildBackwards(c_node, -index - 1)
 *     else:
 *         return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index):
 */
    __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":782
 *     return result
 * 
 * cdef inline xmlNode* _findChild(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     if index < 0:
 *         return _findChildBackwards(c_node, -index - 1)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":788
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     u"""Return child element of c_node with index, or return NULL if not found.
 *     """
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildForwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_v_c_child;
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_findChildForwards", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":793
 *     cdef xmlNode* c_child
 *     cdef Py_ssize_t c
 *     c_child = c_node.children             # <<<<<<<<<<<<<<
 *     c = 0
 *     while c_child is not NULL:
 */
  __pyx_t_1 = __pyx_v_c_node->children;
  __pyx_v_c_child = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":794
 *     cdef Py_ssize_t c
 *     c_child = c_node.children
 *     c = 0             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 */
  __pyx_v_c = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":795
 *     c_child = c_node.children
 *     c = 0
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_child):
 *             if c == index:
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_child != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":796
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
 */
    __pyx_t_2 = (_isElement(__pyx_v_c_child) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":797
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
 */
      __pyx_t_2 = ((__pyx_v_c == __pyx_v_index) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":798
 *         if _isElement(c_child):
 *             if c == index:
 *                 return c_child             # <<<<<<<<<<<<<<
 *             c += 1
 *         c_child = c_child.next
 */
        __pyx_r = __pyx_v_c_child;
        goto __pyx_L0;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":799
 *             if c == index:
 *                 return c_child
 *             c += 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.next
 *     return NULL
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":800
 *                 return c_child
 *             c += 1
 *         c_child = c_child.next             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_t_1 = __pyx_v_c_child->next;
    __pyx_v_c_child = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":801
 *             c += 1
 *         c_child = c_child.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":788
 *         return _findChildForwards(c_node, index)
 * 
 * cdef inline xmlNode* _findChildForwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     u"""Return child element of c_node with index, or return NULL if not found.
 *     """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":803
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     u"""Return child element of c_node with index, or return NULL if not found.
 *     Search from the end.
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findChildBackwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_v_c_child;
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_findChildBackwards", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":809
 *     cdef xmlNode* c_child
 *     cdef Py_ssize_t c
 *     c_child = c_node.last             # <<<<<<<<<<<<<<
 *     c = 0
 *     while c_child is not NULL:
 */
  __pyx_t_1 = __pyx_v_c_node->last;
  __pyx_v_c_child = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":810
 *     cdef Py_ssize_t c
 *     c_child = c_node.last
 *     c = 0             # <<<<<<<<<<<<<<
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 */
  __pyx_v_c = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":811
 *     c_child = c_node.last
 *     c = 0
 *     while c_child is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_child):
 *             if c == index:
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_child != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":812
 *     c = 0
 *     while c_child is not NULL:
 *         if _isElement(c_child):             # <<<<<<<<<<<<<<
 *             if c == index:
 *                 return c_child
 */
    __pyx_t_2 = (_isElement(__pyx_v_c_child) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":813
 *     while c_child is not NULL:
 *         if _isElement(c_child):
 *             if c == index:             # <<<<<<<<<<<<<<
 *                 return c_child
 *             c += 1
 */
      __pyx_t_2 = ((__pyx_v_c == __pyx_v_index) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":814
 *         if _isElement(c_child):
 *             if c == index:
 *                 return c_child             # <<<<<<<<<<<<<<
 *             c += 1
 *         c_child = c_child.prev
 */
        __pyx_r = __pyx_v_c_child;
        goto __pyx_L0;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":815
 *             if c == index:
 *                 return c_child
 *             c += 1             # <<<<<<<<<<<<<<
 *         c_child = c_child.prev
 *     return NULL
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":816
 *                 return c_child
 *             c += 1
 *         c_child = c_child.prev             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_t_1 = __pyx_v_c_child->prev;
    __pyx_v_c_child = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":817
 *             c += 1
 *         c_child = c_child.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) nogil:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":803
 *     return NULL
 * 
 * cdef inline xmlNode* _findChildBackwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     u"""Return child element of c_node with index, or return NULL if not found.
 *     Search from the end.
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":819
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) nogil:             # <<<<<<<<<<<<<<
 *     u"""Return the node if it's a text node.  Skip over ignorable nodes in a
 *     series of text nodes.  Return NULL if a non-ignorable node is found.
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__textNodeOrSkip(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":826
 *     nodes.
 *     """
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":830
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next
 */
    switch (__pyx_v_c_node->type) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":827
 *     """
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 */
      case XML_TEXT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":828
 *     while c_node is not NULL:
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:             # <<<<<<<<<<<<<<
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 */
      case XML_CDATA_SECTION_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":829
 *         if c_node.type == tree.XML_TEXT_NODE or \
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
      break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":830
 *                c_node.type == tree.XML_CDATA_SECTION_NODE:
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next
 */
      case XML_XINCLUDE_START:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":831
 *             return c_node
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         else:
 */
      case XML_XINCLUDE_END:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":832
 *         elif c_node.type == tree.XML_XINCLUDE_START or \
 *                  c_node.type == tree.XML_XINCLUDE_END:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         else:
 *             return NULL
 */
      __pyx_t_2 = __pyx_v_c_node->next;
      __pyx_v_c_node = __pyx_t_2;
      break;
      default:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":834
 *             c_node = c_node.next
 *         else:
 *             return NULL             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
      __pyx_r = NULL;
      goto __pyx_L0;
      break;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":835
 *         else:
 *             return NULL
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":819
 *     return NULL
 * 
 * cdef inline xmlNode* _textNodeOrSkip(xmlNode* c_node) nogil:             # <<<<<<<<<<<<<<
 *     u"""Return the node if it's a text node.  Skip over ignorable nodes in a
 *     series of text nodes.  Return NULL if a non-ignorable node is found.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":837
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__nextElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  __Pyx_RefNannySetupContext("_nextElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":840
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.next
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":841
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.next
 *     while c_node is not NULL:
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":842
 *     if c_node is NULL:
 *         return NULL
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 */
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":843
 *         return NULL
 *     c_node = c_node.next
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             return c_node
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":844
 *     c_node = c_node.next
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.next
 */
    __pyx_t_1 = (_isElement(__pyx_v_c_node) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":845
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return NULL
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":846
 *         if _isElement(c_node):
 *             return c_node
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":847
 *             return c_node
 *         c_node = c_node.next
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":837
 *     return NULL
 * 
 * cdef inline xmlNode* _nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":849
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__previousElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  __Pyx_RefNannySetupContext("_previousElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":852
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.prev
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":853
 *     """
 *     if c_node is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":854
 *     if c_node is NULL:
 *         return NULL
 *     c_node = c_node.prev             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 */
  __pyx_t_2 = __pyx_v_c_node->prev;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":855
 *         return NULL
 *     c_node = c_node.prev
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         if _isElement(c_node):
 *             return c_node
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":856
 *     c_node = c_node.prev
 *     while c_node is not NULL:
 *         if _isElement(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         c_node = c_node.prev
 */
    __pyx_t_1 = (_isElement(__pyx_v_c_node) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":857
 *     while c_node is not NULL:
 *         if _isElement(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         c_node = c_node.prev
 *     return NULL
 */
      __pyx_r = __pyx_v_c_node;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":858
 *         if _isElement(c_node):
 *             return c_node
 *         c_node = c_node.prev             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->prev;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":859
 *             return c_node
 *         c_node = c_node.prev
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":849
 *     return NULL
 * 
 * cdef inline xmlNode* _previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"""Given a node, find the next sibling that is an element.
 *     """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":861
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__parentElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  __Pyx_RefNannySetupContext("_parentElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":863
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     c_node = c_node.parent
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((!(_isElement(__pyx_v_c_node) != 0)) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":864
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":865
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 *     c_node = c_node.parent             # <<<<<<<<<<<<<<
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 */
  __pyx_t_4 = __pyx_v_c_node->parent;
  __pyx_v_c_node = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":866
 *         return NULL
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):             # <<<<<<<<<<<<<<
 *         return NULL
 *     return c_node
 */
  __pyx_t_3 = ((__pyx_v_c_node == NULL) != 0);
  if (!__pyx_t_3) {
    __pyx_t_1 = ((!(_isElement(__pyx_v_c_node) != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":867
 *     c_node = c_node.parent
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":868
 *     if c_node is NULL or not _isElement(c_node):
 *         return NULL
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":861
 *     return NULL
 * 
 * cdef inline xmlNode* _parentElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Given a node, find the parent element."
 *     if c_node is NULL or not _isElement(c_node):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":870
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     u"""Tests if the node matches namespace URI and tag name.
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatches(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  const xmlChar *__pyx_v_c_node_href;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_tagMatches", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":884
 *     * its name string equals the c_name string
 *     """
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":885
 *     """
 *     if c_node is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         # not an element, only succeed if we match everything
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":886
 *     if c_node is NULL:
 *         return 0
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
 */
  __pyx_t_1 = ((__pyx_v_c_node->type != XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":888
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL             # <<<<<<<<<<<<<<
 *     if c_name is NULL:
 *         if c_href is NULL:
 */
    __pyx_t_1 = (__pyx_v_c_name == NULL);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_c_href == NULL);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":889
 *         # not an element, only succeed if we match everything
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         if c_href is NULL:
 *             # always match
 */
  __pyx_t_3 = ((__pyx_v_c_name == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":890
 *         return c_name is NULL and c_href is NULL
 *     if c_name is NULL:
 *         if c_href is NULL:             # <<<<<<<<<<<<<<
 *             # always match
 *             return 1
 */
    __pyx_t_3 = ((__pyx_v_c_href == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":892
 *         if c_href is NULL:
 *             # always match
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             c_node_href = _getNs(c_node)
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":894
 *             return 1
 *         else:
 *             c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'
 */
      __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":895
 *         else:
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *                 return c_href[0] == c'\0'
 *             else:
 */
      __pyx_t_3 = ((__pyx_v_c_node_href == NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":896
 *             c_node_href = _getNs(c_node)
 *             if c_node_href is NULL:
 *                 return c_href[0] == c'\0'             # <<<<<<<<<<<<<<
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 */
        __pyx_r = ((__pyx_v_c_href[0]) == '\x00');
        goto __pyx_L0;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":898
 *                 return c_href[0] == c'\0'
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:
 */
        __pyx_r = (xmlStrcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
        goto __pyx_L0;
      }
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":899
 *             else:
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:             # <<<<<<<<<<<<<<
 *         if _getNs(c_node) is not NULL:
 *             return 0
 */
  __pyx_t_3 = ((__pyx_v_c_href == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":900
 *                 return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 */
    __pyx_t_3 = ((_getNs(__pyx_v_c_node) != NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":901
 *     elif c_href is NULL:
 *         if _getNs(c_node) is not NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":902
 *         if _getNs(c_node) is not NULL:
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0             # <<<<<<<<<<<<<<
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
 */
    __pyx_t_3 = (__pyx_v_c_node->name == __pyx_v_c_name);
    if (!__pyx_t_3) {
      __pyx_t_1 = (xmlStrcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    __pyx_r = __pyx_t_2;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":903
 *             return 0
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:             # <<<<<<<<<<<<<<
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
 */
  __pyx_t_2 = ((__pyx_v_c_node->name == __pyx_v_c_name) != 0);
  if (!__pyx_t_2) {
    __pyx_t_3 = ((xmlStrcmp(__pyx_v_c_node->name, __pyx_v_c_name) == 0) != 0);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":904
 *         return c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *         if c_node_href is NULL:
 *             return c_href[0] == c'\0'
 */
    __pyx_v_c_node_href = _getNs(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":905
 *     elif c_node.name == c_name or tree.xmlStrcmp(c_node.name, c_name) == 0:
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:             # <<<<<<<<<<<<<<
 *             return c_href[0] == c'\0'
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_c_node_href == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":906
 *         c_node_href = _getNs(c_node)
 *         if c_node_href is NULL:
 *             return c_href[0] == c'\0'             # <<<<<<<<<<<<<<
 *         else:
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0
 */
      __pyx_r = ((__pyx_v_c_href[0]) == '\x00');
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":908
 *             return c_href[0] == c'\0'
 *         else:
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0             # <<<<<<<<<<<<<<
 *     else:
 *         return 0
 */
      __pyx_r = (xmlStrcmp(__pyx_v_c_node_href, __pyx_v_c_href) == 0);
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":910
 *             return tree.xmlStrcmp(c_node_href, c_href) == 0
 *     else:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname):
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":870
 *     return c_node
 * 
 * cdef inline bint _tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     u"""Tests if the node matches namespace URI and tag name.
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":912
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname):             # <<<<<<<<<<<<<<
 *     u"""Tests if the node matches namespace URI and tag name.
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__tagMatchesExactly(xmlNode *__pyx_v_c_node, struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_tagMatchesExactly", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":930
 *     * its name string points to the same address (!) as c_name
 *     """
 *     return _nsTagMatchesExactly(_getNs(c_node), c_node.name, c_qname)             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _nsTagMatchesExactly(const_xmlChar* c_node_href,
 */
  __pyx_r = __pyx_f_4lxml_5etree__nsTagMatchesExactly(_getNs(__pyx_v_c_node), __pyx_v_c_node->name, __pyx_v_c_qname);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":912
 *         return 0
 * 
 * cdef inline bint _tagMatchesExactly(xmlNode* c_node, qname* c_qname):             # <<<<<<<<<<<<<<
 *     u"""Tests if the node matches namespace URI and tag name.
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":932
 *     return _nsTagMatchesExactly(_getNs(c_node), c_node.name, c_qname)
 * 
 * cdef inline bint _nsTagMatchesExactly(const_xmlChar* c_node_href,             # <<<<<<<<<<<<<<
 *                                       const_xmlChar* c_node_name,
 *                                       qname* c_qname):
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__nsTagMatchesExactly(const xmlChar *__pyx_v_c_node_href, const xmlChar *__pyx_v_c_node_name, struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname) {
  char *__pyx_v_c_href;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_nsTagMatchesExactly", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":953
 *     """
 *     cdef char* c_href
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:             # <<<<<<<<<<<<<<
 *         return 0
 *     if c_qname.href is NULL:
 */
  __pyx_t_1 = ((__pyx_v_c_qname->c_name != NULL) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_qname->c_name != __pyx_v_c_node_name) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":954
 *     cdef char* c_href
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:
 *         return 0             # <<<<<<<<<<<<<<
 *     if c_qname.href is NULL:
 *         return 1
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":955
 *     if c_qname.c_name is not NULL and c_qname.c_name is not c_node_name:
 *         return 0
 *     if c_qname.href is NULL:             # <<<<<<<<<<<<<<
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
 */
  __pyx_t_3 = ((__pyx_v_c_qname->href == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":956
 *         return 0
 *     if c_qname.href is NULL:
 *         return 1             # <<<<<<<<<<<<<<
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == '\0':
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":957
 *     if c_qname.href is NULL:
 *         return 1
 *     c_href = python.__cstr(c_qname.href)             # <<<<<<<<<<<<<<
 *     if c_href[0] == '\0':
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 */
  __pyx_v_c_href = PyBytes_AS_STRING(__pyx_v_c_qname->href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":958
 *         return 1
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == '\0':             # <<<<<<<<<<<<<<
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 *     elif c_node_href is NULL:
 */
  __pyx_t_3 = (((__pyx_v_c_href[0]) == '\x00') != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":959
 *     c_href = python.__cstr(c_qname.href)
 *     if c_href[0] == '\0':
 *         return c_node_href is NULL or c_node_href[0] == '\0'             # <<<<<<<<<<<<<<
 *     elif c_node_href is NULL:
 *         return 0
 */
    __pyx_t_3 = (__pyx_v_c_node_href == NULL);
    if (!__pyx_t_3) {
      __pyx_t_1 = ((__pyx_v_c_node_href[0]) == '\x00');
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    __pyx_r = __pyx_t_2;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":960
 *     if c_href[0] == '\0':
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 *     elif c_node_href is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_c_node_href == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":961
 *         return c_node_href is NULL or c_node_href[0] == '\0'
 *     elif c_node_href is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     else:
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":963
 *         return 0
 *     else:
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0             # <<<<<<<<<<<<<<
 * 
 * cdef Py_ssize_t _mapTagsToQnameMatchArray(xmlDoc* c_doc, list ns_tags,
 */
    __pyx_r = (xmlStrcmp(((const xmlChar *)__pyx_v_c_href), __pyx_v_c_node_href) == 0);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":932
 *     return _nsTagMatchesExactly(_getNs(c_node), c_node.name, c_qname)
 * 
 * cdef inline bint _nsTagMatchesExactly(const_xmlChar* c_node_href,             # <<<<<<<<<<<<<<
 *                                       const_xmlChar* c_node_name,
 *                                       qname* c_qname):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":965
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0
 * 
 * cdef Py_ssize_t _mapTagsToQnameMatchArray(xmlDoc* c_doc, list ns_tags,             # <<<<<<<<<<<<<<
 *                                           qname* c_ns_tags, bint force_into_dict) except -1:
 *     u"""Map a sequence of (name, namespace) pairs to a qname array for efficient
 */

static Py_ssize_t __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_ns_tags, struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_ns_tags, int __pyx_v_force_into_dict) {
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_v_tag = 0;
  const xmlChar *__pyx_v_c_tag;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __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)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_mapTagsToQnameMatchArray", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":973
 *     if it is not NULL.
 *     """
 *     cdef Py_ssize_t count = 0, i             # <<<<<<<<<<<<<<
 *     cdef bytes ns, tag
 *     for ns, tag in ns_tags:
 */
  __pyx_v_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":975
 *     cdef Py_ssize_t count = 0, i
 *     cdef bytes ns, tag
 *     for ns, tag in ns_tags:             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             c_tag = <const_xmlChar*>NULL
 */
  if (unlikely(__pyx_v_ns_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __pyx_v_ns_tags; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":976
 *     cdef bytes ns, tag
 *     for ns, tag in ns_tags:
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             c_tag = <const_xmlChar*>NULL
 *         elif force_into_dict:
 */
    __pyx_t_8 = (__pyx_v_tag == ((PyObject*)Py_None));
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":977
 *     for ns, tag in ns_tags:
 *         if tag is None:
 *             c_tag = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *         elif force_into_dict:
 *             c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), len(tag))
 */
      __pyx_v_c_tag = ((const xmlChar *)NULL);
      goto __pyx_L7;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":978
 *         if tag is None:
 *             c_tag = <const_xmlChar*>NULL
 *         elif force_into_dict:             # <<<<<<<<<<<<<<
 *             c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), len(tag))
 *             if c_tag is NULL:
 */
    __pyx_t_9 = (__pyx_v_force_into_dict != 0);
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":979
 *             c_tag = <const_xmlChar*>NULL
 *         elif force_into_dict:
 *             c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), len(tag))             # <<<<<<<<<<<<<<
 *             if c_tag is NULL:
 *                 # clean up before raising the error
 */
      if (unlikely(__pyx_v_tag == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = PyBytes_GET_SIZE(__pyx_v_tag); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_tag = xmlDictLookup(__pyx_v_c_doc->dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":980
 *         elif force_into_dict:
 *             c_tag = tree.xmlDictLookup(c_doc.dict, _xcstr(tag), len(tag))
 *             if c_tag is NULL:             # <<<<<<<<<<<<<<
 *                 # clean up before raising the error
 *                 for i in xrange(count):
 */
      __pyx_t_9 = ((__pyx_v_c_tag == NULL) != 0);
      if (__pyx_t_9) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":982
 *             if c_tag is NULL:
 *                 # clean up before raising the error
 *                 for i in xrange(count):             # <<<<<<<<<<<<<<
 *                     cpython.ref.Py_XDECREF(c_ns_tags[i].href)
 *                 raise MemoryError()
 */
        __pyx_t_10 = __pyx_v_count;
        for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
          __pyx_v_i = __pyx_t_11;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":983
 *                 # clean up before raising the error
 *                 for i in xrange(count):
 *                     cpython.ref.Py_XDECREF(c_ns_tags[i].href)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         else:
 */
          Py_XDECREF((__pyx_v_c_ns_tags[__pyx_v_i]).href);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":984
 *                 for i in xrange(count):
 *                     cpython.ref.Py_XDECREF(c_ns_tags[i].href)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         else:
 *             c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), len(tag))
 */
        PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":986
 *                 raise MemoryError()
 *         else:
 *             c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), len(tag))             # <<<<<<<<<<<<<<
 *             if c_tag is NULL:
 *                 # not in the dict => not in the document
 */
      if (unlikely(__pyx_v_tag == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = PyBytes_GET_SIZE(__pyx_v_tag); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_tag = xmlDictExists(__pyx_v_c_doc->dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":987
 *         else:
 *             c_tag = tree.xmlDictExists(c_doc.dict, _xcstr(tag), len(tag))
 *             if c_tag is NULL:             # <<<<<<<<<<<<<<
 *                 # not in the dict => not in the document
 *                 continue
 */
      __pyx_t_9 = ((__pyx_v_c_tag == NULL) != 0);
      if (__pyx_t_9) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":989
 *             if c_tag is NULL:
 *                 # not in the dict => not in the document
 *                 continue             # <<<<<<<<<<<<<<
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:
 */
        goto __pyx_L3_continue;
      }
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":990
 *                 # not in the dict => not in the document
 *                 continue
 *         c_ns_tags[count].c_name = c_tag             # <<<<<<<<<<<<<<
 *         if ns is None:
 *             c_ns_tags[count].href = NULL
 */
    (__pyx_v_c_ns_tags[__pyx_v_count]).c_name = __pyx_v_c_tag;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":991
 *                 continue
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = NULL
 *         else:
 */
    __pyx_t_9 = (__pyx_v_ns == ((PyObject*)Py_None));
    __pyx_t_8 = (__pyx_t_9 != 0);
    if (__pyx_t_8) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":992
 *         c_ns_tags[count].c_name = c_tag
 *         if ns is None:
 *             c_ns_tags[count].href = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!
 */
      (__pyx_v_c_ns_tags[__pyx_v_count]).href = NULL;
      goto __pyx_L12;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":994
 *             c_ns_tags[count].href = NULL
 *         else:
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!             # <<<<<<<<<<<<<<
 *             c_ns_tags[count].href = <python.PyObject*>ns
 *         count += 1
 */
      Py_INCREF(__pyx_v_ns);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":995
 *         else:
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!
 *             c_ns_tags[count].href = <python.PyObject*>ns             # <<<<<<<<<<<<<<
 *         count += 1
 *     return count
 */
      (__pyx_v_c_ns_tags[__pyx_v_count]).href = ((PyObject *)__pyx_v_ns);
    }
    __pyx_L12:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":996
 *             cpython.ref.Py_INCREF(ns) # keep an owned reference!
 *             c_ns_tags[count].href = <python.PyObject*>ns
 *         count += 1             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_v_count = (__pyx_v_count + 1);
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":997
 *             c_ns_tags[count].href = <python.PyObject*>ns
 *         count += 1
 *     return count             # <<<<<<<<<<<<<<
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":965
 *         return tree.xmlStrcmp(<const_xmlChar*>c_href, c_node_href) == 0
 * 
 * cdef Py_ssize_t _mapTagsToQnameMatchArray(xmlDoc* c_doc, list ns_tags,             # <<<<<<<<<<<<<<
 *                                           qname* c_ns_tags, bint force_into_dict) except -1:
 *     u"""Map a sequence of (name, namespace) pairs to a qname array for efficient
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._mapTagsToQnameMatchArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":999
 *     return count
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     u"""Unlink and free a node and subnodes if possible.  Otherwise, make sure
 *     it's self-contained.
 */

static int __pyx_f_4lxml_5etree__removeNode(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_removeNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1004
 *     """
 *     cdef xmlNode* c_next
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1005
 *     cdef xmlNode* c_next
 *     c_next = c_node.next
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1006
 *     c_next = c_node.next
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     if not attemptDeallocation(c_node):
 *         # make namespaces absolute
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1007
 *     tree.xmlUnlinkNode(c_node)
 *     _moveTail(c_next, c_node)
 *     if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
 */
  __pyx_t_2 = ((!(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node) != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1009
 *     if not attemptDeallocation(c_node):
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1010
 *         # make namespaces absolute
 *         moveNodeToDocument(doc, c_node.doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _removeSiblings(xmlNode* c_element, tree.xmlElementType node_type, bint with_tail) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":999
 *     return count
 * 
 * cdef int _removeNode(_Document doc, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *     u"""Unlink and free a node and subnodes if possible.  Otherwise, make sure
 *     it's self-contained.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._removeNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1012
 *     return 0
 * 
 * cdef int _removeSiblings(xmlNode* c_element, tree.xmlElementType node_type, bint with_tail) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
 */

static int __pyx_f_4lxml_5etree__removeSiblings(xmlNode *__pyx_v_c_element, xmlElementType __pyx_v_node_type, int __pyx_v_with_tail) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_removeSiblings", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1015
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
 *     c_node = c_element.next             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 */
  __pyx_t_1 = __pyx_v_c_element->next;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1016
 *     cdef xmlNode* c_next
 *     c_node = c_element.next
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1017
 *     c_node = c_element.next
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *         if c_node.type == node_type:
 *             if with_tail:
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1018
 *     while c_node is not NULL:
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
 */
    __pyx_t_2 = ((__pyx_v_c_node->type == __pyx_v_node_type) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1019
 *         c_next = _nextElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      __pyx_t_2 = (__pyx_v_with_tail != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1020
 *         if c_node.type == node_type:
 *             if with_tail:
 *                 _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 */
        __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1021
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1022
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     c_node = c_element.prev
 */
      __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1023
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     c_node = c_element.prev
 *     while c_node is not NULL:
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1024
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     c_node = c_element.prev             # <<<<<<<<<<<<<<
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 */
  __pyx_t_1 = __pyx_v_c_element->prev;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1025
 *         c_node = c_next
 *     c_node = c_element.prev
 *     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1026
 *     c_node = c_element.prev
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *         if c_node.type == node_type:
 *             if with_tail:
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1027
 *     while c_node is not NULL:
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:             # <<<<<<<<<<<<<<
 *             if with_tail:
 *                 _removeText(c_node.next)
 */
    __pyx_t_2 = ((__pyx_v_c_node->type == __pyx_v_node_type) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1028
 *         c_next = _previousElement(c_node)
 *         if c_node.type == node_type:
 *             if with_tail:             # <<<<<<<<<<<<<<
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 */
      __pyx_t_2 = (__pyx_v_with_tail != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1029
 *         if c_node.type == node_type:
 *             if with_tail:
 *                 _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 */
        __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1030
 *             if with_tail:
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1031
 *                 _removeText(c_node.next)
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
 */
      __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1032
 *             tree.xmlUnlinkNode(c_node)
 *             attemptDeallocation(c_node)
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1033
 *             attemptDeallocation(c_node)
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1012
 *     return 0
 * 
 * cdef int _removeSiblings(xmlNode* c_element, tree.xmlElementType node_type, bint with_tail) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef xmlNode* c_next
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1035
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # tail support: look for any text nodes trailing this node and
 */

static void __pyx_f_4lxml_5etree__moveTail(xmlNode *__pyx_v_c_tail, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_next;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_moveTail", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1039
 *     # tail support: look for any text nodes trailing this node and
 *     # move them too
 *     c_tail = _textNodeOrSkip(c_tail)             # <<<<<<<<<<<<<<
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)
 */
  __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1040
 *     # move them too
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:             # <<<<<<<<<<<<<<
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_tail != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1041
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)             # <<<<<<<<<<<<<<
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)
 *         c_tail = c_next
 */
    __pyx_v_c_next = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail->next);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1042
 *     while c_tail is not NULL:
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)             # <<<<<<<<<<<<<<
 *         c_tail = c_next
 * 
 */
    __pyx_v_c_target = xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_tail);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1043
 *         c_next = _textNodeOrSkip(c_tail.next)
 *         c_target = tree.xmlAddNextSibling(c_target, c_tail)
 *         c_tail = c_next             # <<<<<<<<<<<<<<
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:
 */
    __pyx_v_c_tail = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1035
 *     return 0
 * 
 * cdef void _moveTail(xmlNode* c_tail, xmlNode* c_target):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_next
 *     # tail support: look for any text nodes trailing this node and
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1045
 *         c_tail = c_next
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_new_tail
 *     # tail copying support: look for any text nodes trailing this node and
 */

static int __pyx_f_4lxml_5etree__copyTail(xmlNode *__pyx_v_c_tail, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_new_tail;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyTail", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1049
 *     # tail copying support: look for any text nodes trailing this node and
 *     # copy it to the target node
 *     c_tail = _textNodeOrSkip(c_tail)             # <<<<<<<<<<<<<<
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:
 */
  __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1050
 *     # copy it to the target node
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:             # <<<<<<<<<<<<<<
 *         if c_target.doc is not c_tail.doc:
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_tail != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1051
 *     c_tail = _textNodeOrSkip(c_tail)
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:             # <<<<<<<<<<<<<<
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_c_target->doc != __pyx_v_c_tail->doc) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1052
 *     while c_tail is not NULL:
 *         if c_target.doc is not c_tail.doc:
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)             # <<<<<<<<<<<<<<
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 */
      __pyx_v_c_new_tail = xmlDocCopyNode(__pyx_v_c_tail, __pyx_v_c_target->doc, 0);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1054
 *             c_new_tail = tree.xmlDocCopyNode(c_tail, c_target.doc, 0)
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)             # <<<<<<<<<<<<<<
 *         if c_new_tail is NULL:
 *             raise MemoryError()
 */
      __pyx_v_c_new_tail = xmlCopyNode(__pyx_v_c_tail, 0);
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1055
 *         else:
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 */
    __pyx_t_1 = ((__pyx_v_c_new_tail == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1056
 *             c_new_tail = tree.xmlCopyNode(c_tail, 0)
 *         if c_new_tail is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_tail = _textNodeOrSkip(c_tail.next)
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1057
 *         if c_new_tail is NULL:
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)             # <<<<<<<<<<<<<<
 *         c_tail = _textNodeOrSkip(c_tail.next)
 *     return 0
 */
    __pyx_v_c_target = xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_new_tail);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1058
 *             raise MemoryError()
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_tail = _textNodeOrSkip(c_tail.next)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_tail = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_tail->next);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1059
 *         c_target = tree.xmlAddNextSibling(c_target, c_new_tail)
 *         c_tail = _textNodeOrSkip(c_tail.next)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1045
 *         c_tail = c_next
 * 
 * cdef int _copyTail(xmlNode* c_tail, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_new_tail
 *     # tail copying support: look for any text nodes trailing this node and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyTail", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1061
 *     return 0
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
 */

static int __pyx_f_4lxml_5etree__copyNonElementSiblings(xmlNode *__pyx_v_c_node, xmlNode *__pyx_v_c_target) {
  xmlNode *__pyx_v_c_copy;
  xmlNode *__pyx_v_c_sibling;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyNonElementSiblings", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1063
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node             # <<<<<<<<<<<<<<
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 */
  __pyx_v_c_sibling = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1064
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_sibling->prev != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1065
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 */
      switch (__pyx_v_c_sibling->prev->type) {
        case XML_PI_NODE:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1066
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 */
        case XML_COMMENT_NODE:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1065
 *     cdef xmlNode* c_sibling = c_node
 *     while c_sibling.prev != NULL and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 */
        __pyx_t_2 = 1;
        break;
        default:
        __pyx_t_2 = 0;
        break;
      }
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1067
 *             (c_sibling.prev.type == tree.XML_PI_NODE or \
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling != c_node:
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 */
    __pyx_t_4 = __pyx_v_c_sibling->prev;
    __pyx_v_c_sibling = __pyx_t_4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1068
 *                  c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:             # <<<<<<<<<<<<<<
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_sibling != __pyx_v_c_node) != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1069
 *         c_sibling = c_sibling.prev
 *     while c_sibling != c_node:
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *         if c_copy is NULL:
 *             raise MemoryError()
 */
    __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1070
 *     while c_sibling != c_node:
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 */
    __pyx_t_3 = ((__pyx_v_c_copy == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1071
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1072
 *         if c_copy is NULL:
 *             raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 */
    xmlAddPrevSibling(__pyx_v_c_target, __pyx_v_c_copy);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1073
 *             raise MemoryError()
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 */
    __pyx_t_4 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1074
 *         tree.xmlAddPrevSibling(c_target, c_copy)
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \             # <<<<<<<<<<<<<<
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_sibling->next != NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1075
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
 */
      switch (__pyx_v_c_sibling->next->type) {
        case XML_PI_NODE:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1076
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 */
        case XML_COMMENT_NODE:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1075
 *         c_sibling = c_sibling.next
 *     while c_sibling.next != NULL and \
 *             (c_sibling.next.type == tree.XML_PI_NODE or \             # <<<<<<<<<<<<<<
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
 */
        __pyx_t_1 = 1;
        break;
        default:
        __pyx_t_1 = 0;
        break;
      }
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_2 = __pyx_t_3;
    }
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1077
 *             (c_sibling.next.type == tree.XML_PI_NODE or \
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 */
    __pyx_t_4 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_4;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1078
 *                  c_sibling.next.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)             # <<<<<<<<<<<<<<
 *         if c_copy is NULL:
 *             raise MemoryError()
 */
    __pyx_v_c_copy = xmlDocCopyNode(__pyx_v_c_sibling, __pyx_v_c_target->doc, 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1079
 *         c_sibling = c_sibling.next
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddNextSibling(c_target, c_copy)
 */
    __pyx_t_2 = ((__pyx_v_c_copy == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1080
 *         c_copy = tree.xmlDocCopyNode(c_sibling, c_target.doc, 1)
 *         if c_copy is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1081
 *         if c_copy is NULL:
 *             raise MemoryError()
 *         tree.xmlAddNextSibling(c_target, c_copy)             # <<<<<<<<<<<<<<
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,
 */
    xmlAddNextSibling(__pyx_v_c_target, __pyx_v_c_copy);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1061
 *     return 0
 * 
 * cdef int _copyNonElementSiblings(xmlNode* c_node, xmlNode* c_target) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_copy
 *     cdef xmlNode* c_sibling = c_node
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyNonElementSiblings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1083
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     u"""Delete slice, ``count`` items starting with ``c_node`` with a step
 */

static int __pyx_f_4lxml_5etree__deleteSlice(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_count, Py_ssize_t __pyx_v_step) {
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_c;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_deleteSlice", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1091
 *     cdef Py_ssize_t c, i
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if step > 0:
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1092
 *     cdef _node_to_node_function next_element
 *     if c_node is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if step > 0:
 *         next_element = _nextElement
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1093
 *     if c_node is NULL:
 *         return 0
 *     if step > 0:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_step > 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1094
 *         return 0
 *     if step > 0:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         step = -step
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1096
 *         next_element = _nextElement
 *     else:
 *         step = -step             # <<<<<<<<<<<<<<
 *         next_element = _previousElement
 *     # now start deleting nodes
 */
    __pyx_v_step = (-__pyx_v_step);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1097
 *     else:
 *         step = -step
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 *     # now start deleting nodes
 *     c = 0
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1099
 *         next_element = _previousElement
 *     # now start deleting nodes
 *     c = 0             # <<<<<<<<<<<<<<
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
 */
  __pyx_v_c = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1100
 *     # now start deleting nodes
 *     c = 0
 *     c_next = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c < count:
 *         for i in range(step):
 */
  __pyx_v_c_next = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1101
 *     c = 0
 *     c_next = c_node
 *     while c_node is not NULL and c < count:             # <<<<<<<<<<<<<<
 *         for i in range(step):
 *             c_next = next_element(c_next)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_c < __pyx_v_count) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1102
 *     c_next = c_node
 *     while c_node is not NULL and c < count:
 *         for i in range(step):             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *         _removeNode(doc, c_node)
 */
    __pyx_t_4 = __pyx_v_step;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1103
 *     while c_node is not NULL and c < count:
 *         for i in range(step):
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *         _removeNode(doc, c_node)
 *         c += 1
 */
      __pyx_v_c_next = __pyx_v_next_element(__pyx_v_c_next);
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1104
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *         _removeNode(doc, c_node)             # <<<<<<<<<<<<<<
 *         c += 1
 *         c_node = c_next
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1105
 *             c_next = next_element(c_next)
 *         _removeNode(doc, c_node)
 *         c += 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 *     return 0
 */
    __pyx_v_c = (__pyx_v_c + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1106
 *         _removeNode(doc, c_node)
 *         c += 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1107
 *         c += 1
 *         c_node = c_next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1083
 *         tree.xmlAddNextSibling(c_target, c_copy)
 * 
 * cdef int _deleteSlice(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                       Py_ssize_t count, Py_ssize_t step) except -1:
 *     u"""Delete slice, ``count`` items starting with ``c_node`` with a step
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._deleteSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1109
 *     return 0
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                        Py_ssize_t slicelength, Py_ssize_t step,
 *                        bint left_to_right, elements) except -1:
 */

static int __pyx_f_4lxml_5etree__replaceSlice(struct LxmlElement *__pyx_v_parent, xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_slicelength, Py_ssize_t __pyx_v_step, int __pyx_v_left_to_right, PyObject *__pyx_v_elements) {
  xmlNode *__pyx_v_c_orig_neighbour;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  struct LxmlElement *__pyx_v_element = 0;
  Py_ssize_t __pyx_v_seqlength;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_c;
  _node_to_node_function __pyx_v_next_element;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  xmlNode *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  xmlDoc *__pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_replaceSlice", 0);
  __Pyx_INCREF(__pyx_v_elements);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1124
 *     cdef Py_ssize_t seqlength, i, c
 *     cdef _node_to_node_function next_element
 *     assert step > 0             # <<<<<<<<<<<<<<
 *     if left_to_right:
 *         next_element = _nextElement
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_step > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1125
 *     cdef _node_to_node_function next_element
 *     assert step > 0
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         next_element = _nextElement
 *     else:
 */
  __pyx_t_1 = (__pyx_v_left_to_right != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1126
 *     assert step > 0
 *     if left_to_right:
 *         next_element = _nextElement             # <<<<<<<<<<<<<<
 *     else:
 *         next_element = _previousElement
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1128
 *         next_element = _nextElement
 *     else:
 *         next_element = _previousElement             # <<<<<<<<<<<<<<
 * 
 *     if not isinstance(elements, (list, tuple)):
 */
    __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1130
 *         next_element = _previousElement
 * 
 *     if not isinstance(elements, (list, tuple)):             # <<<<<<<<<<<<<<
 *         elements = list(elements)
 * 
 */
  __pyx_t_1 = PyList_Check(__pyx_v_elements); 
  if (!__pyx_t_1) {
    __pyx_t_2 = PyTuple_Check(__pyx_v_elements); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = ((!(__pyx_t_3 != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1131
 * 
 *     if not isinstance(elements, (list, tuple)):
 *         elements = list(elements)             # <<<<<<<<<<<<<<
 * 
 *     if step > 1:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_elements);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_elements);
    __Pyx_GIVEREF(__pyx_v_elements);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_elements, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1133
 *         elements = list(elements)
 * 
 *     if step > 1:             # <<<<<<<<<<<<<<
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 */
  __pyx_t_1 = ((__pyx_v_step > 1) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1135
 *     if step > 1:
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)             # <<<<<<<<<<<<<<
 *         if seqlength != slicelength:
 *             raise ValueError, u"attempt to assign sequence of size %d " \
 */
    __pyx_t_6 = PyObject_Length(__pyx_v_elements); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_seqlength = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1136
 *         # *replacing* children stepwise with list => check size!
 *         seqlength = len(elements)
 *         if seqlength != slicelength:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"attempt to assign sequence of size %d " \
 *                 u"to extended slice of size %d" % (seqlength, slicelength)
 */
    __pyx_t_1 = ((__pyx_v_seqlength != __pyx_v_slicelength) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1138
 *         if seqlength != slicelength:
 *             raise ValueError, u"attempt to assign sequence of size %d " \
 *                 u"to extended slice of size %d" % (seqlength, slicelength)             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_seqlength); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_slicelength); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_attempt_to_assign_sequence_of_si, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1140
 *                 u"to extended slice of size %d" % (seqlength, slicelength)
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1142
 *     if c_node is NULL:
 *         # no children yet => add all elements straight away
 *         if left_to_right:             # <<<<<<<<<<<<<<
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"
 */
    __pyx_t_1 = (__pyx_v_left_to_right != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1143
 *         # no children yet => add all elements straight away
 *         if left_to_right:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, u"Node must not be None"
 *                 _appendChild(parent, element)
 */
      if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      }
      for (;;) {
        if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_7 = __pyx_t_8(__pyx_t_4);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1144
 *         if left_to_right:
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *                 _appendChild(parent, element)
 *         else:
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
          if (unlikely(!(__pyx_t_1 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Node_must_not_be_None);
            {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
        }
        #endif

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1145
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"
 *                 _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *         else:
 *             for element in elements:
 */
        __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1147
 *                 _appendChild(parent, element)
 *         else:
 *             for element in elements:             # <<<<<<<<<<<<<<
 *                 assert element is not None, u"Node must not be None"
 *                 _prependChild(parent, element)
 */
      if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
        __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      }
      for (;;) {
        if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_7 = __pyx_t_8(__pyx_t_4);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1148
 *         else:
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *                 _prependChild(parent, element)
 *         return 0
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
          if (unlikely(!(__pyx_t_1 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Node_must_not_be_None);
            {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
        }
        #endif

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1149
 *             for element in elements:
 *                 assert element is not None, u"Node must not be None"
 *                 _prependChild(parent, element)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
        __pyx_t_9 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1150
 *                 assert element is not None, u"Node must not be None"
 *                 _prependChild(parent, element)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # remove the elements first as some might be re-added
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1153
 * 
 *     # remove the elements first as some might be re-added
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)
 */
  __pyx_t_1 = (__pyx_v_left_to_right != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1155
 *     if left_to_right:
 *         # L->R, remember left neighbour
 *         c_orig_neighbour = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         # R->L, remember right neighbour
 */
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);
    goto __pyx_L13;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1158
 *     else:
 *         # R->L, remember right neighbour
 *         c_orig_neighbour = _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 *     # We remove the original slice elements one by one. Since we hold
 */
    __pyx_v_c_orig_neighbour = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1164
 *     # safe to let _removeNode() try (and fail) to free them even if
 *     # the element itself or one of its descendents will be reinserted.
 *     c = 0             # <<<<<<<<<<<<<<
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
 */
  __pyx_v_c = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1165
 *     # the element itself or one of its descendents will be reinserted.
 *     c = 0
 *     c_next = c_node             # <<<<<<<<<<<<<<
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):
 */
  __pyx_v_c_next = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1166
 *     c = 0
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *         for i in range(step):
 *             c_next = next_element(c_next)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = ((__pyx_v_c < __pyx_v_slicelength) != 0);
      __pyx_t_2 = __pyx_t_3;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1167
 *     c_next = c_node
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):             # <<<<<<<<<<<<<<
 *             c_next = next_element(c_next)
 *         _removeNode(parent._doc, c_node)
 */
    __pyx_t_6 = __pyx_v_step;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1168
 *     while c_node is not NULL and c < slicelength:
 *         for i in range(step):
 *             c_next = next_element(c_next)             # <<<<<<<<<<<<<<
 *         _removeNode(parent._doc, c_node)
 *         c += 1
 */
      __pyx_v_c_next = __pyx_v_next_element(__pyx_v_c_next);
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1169
 *         for i in range(step):
 *             c_next = next_element(c_next)
 *         _removeNode(parent._doc, c_node)             # <<<<<<<<<<<<<<
 *         c += 1
 *         c_node = c_next
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_9 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1170
 *             c_next = next_element(c_next)
 *         _removeNode(parent._doc, c_node)
 *         c += 1             # <<<<<<<<<<<<<<
 *         c_node = c_next
 * 
 */
    __pyx_v_c = (__pyx_v_c + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1171
 *         _removeNode(parent._doc, c_node)
 *         c += 1
 *         c_node = c_next             # <<<<<<<<<<<<<<
 * 
 *     # make sure each element is inserted only once
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1174
 * 
 *     # make sure each element is inserted only once
 *     elements = iter(elements)             # <<<<<<<<<<<<<<
 * 
 *     # find the first node right of the new insertion point
 */
  __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_elements, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1177
 * 
 *     # find the first node right of the new insertion point
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)
 */
  __pyx_t_2 = (__pyx_v_left_to_right != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1178
 *     # find the first node right of the new insertion point
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:             # <<<<<<<<<<<<<<
 *             c_node = next_element(c_orig_neighbour)
 *         else:
 */
    __pyx_t_2 = ((__pyx_v_c_orig_neighbour != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1179
 *     if left_to_right:
 *         if c_orig_neighbour is not NULL:
 *             c_node = next_element(c_orig_neighbour)             # <<<<<<<<<<<<<<
 *         else:
 *             # before the first element
 */
      __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_orig_neighbour);
      goto __pyx_L19;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1182
 *         else:
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     elif c_orig_neighbour is NULL:
 *         # at the end, but reversed stepping
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);
    }
    __pyx_L19:;
    goto __pyx_L18;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1183
 *             # before the first element
 *             c_node = _findChildForwards(parent._c_node, 0)
 *     elif c_orig_neighbour is NULL:             # <<<<<<<<<<<<<<
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
 */
  __pyx_t_2 = ((__pyx_v_c_orig_neighbour == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1186
 *         # at the end, but reversed stepping
 *         # append one element and go to the next insertion point
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _appendChild(parent, element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_8(__pyx_t_4);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_element = ((struct LxmlElement *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1187
 *         # append one element and go to the next insertion point
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!(__pyx_t_2 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Node_must_not_be_None);
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
      }
      #endif

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1188
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *             c_node = element._c_node
 *             if slicelength > 0:
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1189
 *             assert element is not None, u"Node must not be None"
 *             _appendChild(parent, element)
 *             c_node = element._c_node             # <<<<<<<<<<<<<<
 *             if slicelength > 0:
 *                 slicelength -= 1
 */
      __pyx_t_11 = __pyx_v_element->_c_node;
      __pyx_v_c_node = __pyx_t_11;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1190
 *             _appendChild(parent, element)
 *             c_node = element._c_node
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength -= 1
 *                 for i in range(1, step):
 */
      __pyx_t_2 = ((__pyx_v_slicelength > 0) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1191
 *             c_node = element._c_node
 *             if slicelength > 0:
 *                 slicelength -= 1             # <<<<<<<<<<<<<<
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
 */
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1192
 *             if slicelength > 0:
 *                 slicelength -= 1
 *                 for i in range(1, step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             break
 */
        __pyx_t_10 = __pyx_v_step;
        for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_10; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1193
 *                 slicelength -= 1
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             break
 * 
 */
          __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
        }
        goto __pyx_L22;
      }
      __pyx_L22:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1194
 *                 for i in range(1, step):
 *                     c_node = next_element(c_node)
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if left_to_right:
 */
      goto __pyx_L21_break;
    }
    __pyx_L21_break:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1196
 *             break
 * 
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 */
  __pyx_t_2 = (__pyx_v_left_to_right != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1199
 *         # adjust step size after removing slice as we are not stepping
 *         # over the newly inserted elements
 *         step -= 1             # <<<<<<<<<<<<<<
 * 
 *     # now insert elements where we removed them
 */
    __pyx_v_step = (__pyx_v_step - 1);
    goto __pyx_L25;
  }
  __pyx_L25:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1202
 * 
 *     # now insert elements where we removed them
 *     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 */
  __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1203
 *     # now insert elements where we removed them
 *     if c_node is not NULL:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_8(__pyx_t_4);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1204
 *     if c_node is not NULL:
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             # move element and tail over
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!(__pyx_t_2 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Node_must_not_be_None);
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
      }
      #endif

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1205
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1207
 *             _assertValidNode(element)
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 */
      __pyx_t_13 = __pyx_v_element->_c_node->doc;
      __pyx_v_c_source_doc = __pyx_t_13;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1208
 *             # move element and tail over
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 */
      __pyx_t_11 = __pyx_v_element->_c_node->next;
      __pyx_v_c_next = __pyx_t_11;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1209
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *             _moveTail(c_next, element._c_node)
 * 
 */
      xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1210
 *             c_next = element._c_node.next
 *             tree.xmlAddPrevSibling(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # integrate element into new document
 */
      __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1213
 * 
 *             # integrate element into new document
 *             moveNodeToDocument(parent._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *             # stop at the end of the slice
 */
      __pyx_t_7 = ((PyObject *)__pyx_v_parent->_doc);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_9 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_7), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1216
 * 
 *             # stop at the end of the slice
 *             if slicelength > 0:             # <<<<<<<<<<<<<<
 *                 slicelength = slicelength - 1
 *                 for i in range(step):
 */
      __pyx_t_2 = ((__pyx_v_slicelength > 0) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1217
 *             # stop at the end of the slice
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1             # <<<<<<<<<<<<<<
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 */
        __pyx_v_slicelength = (__pyx_v_slicelength - 1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1218
 *             if slicelength > 0:
 *                 slicelength = slicelength - 1
 *                 for i in range(step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *                 if c_node is NULL:
 */
        __pyx_t_10 = __pyx_v_step;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_10; __pyx_t_12+=1) {
          __pyx_v_i = __pyx_t_12;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1219
 *                 slicelength = slicelength - 1
 *                 for i in range(step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *                 if c_node is NULL:
 *                     break
 */
          __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1220
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *                 if c_node is NULL:             # <<<<<<<<<<<<<<
 *                     break
 *         else:
 */
        __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
        if (__pyx_t_2) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1221
 *                     c_node = next_element(c_node)
 *                 if c_node is NULL:
 *                     break             # <<<<<<<<<<<<<<
 *         else:
 *             # everything inserted
 */
          goto __pyx_L28_break;
        }
        goto __pyx_L29;
      }
      __pyx_L29:;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1224
 *         else:
 *             # everything inserted
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     # append the remaining elements at the respective end
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L28_break:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1227
 * 
 *     # append the remaining elements at the respective end
 *     if left_to_right:             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 */
  __pyx_t_2 = (__pyx_v_left_to_right != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1228
 *     # append the remaining elements at the respective end
 *     if left_to_right:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_8(__pyx_t_4);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1229
 *     if left_to_right:
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(parent, element)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!(__pyx_t_2 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Node_must_not_be_None);
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
      }
      #endif

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1230
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(parent, element)
 *     else:
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1231
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(parent, element)             # <<<<<<<<<<<<<<
 *     else:
 *         for element in elements:
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L34;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1233
 *             _appendChild(parent, element)
 *     else:
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 */
    if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
      __pyx_t_4 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_8(__pyx_t_4);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1234
 *     else:
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _prependChild(parent, element)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (((PyObject *)__pyx_v_element) != Py_None);
        if (unlikely(!(__pyx_t_2 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Node_must_not_be_None);
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
      }
      #endif

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1235
 *         for element in elements:
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _prependChild(parent, element)
 * 
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1236
 *             assert element is not None, u"Node must not be None"
 *             _assertValidNode(element)
 *             _prependChild(parent, element)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__prependChild(__pyx_v_parent, __pyx_v_element); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L34:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1238
 *             _prependChild(parent, element)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1109
 *     return 0
 * 
 * cdef int _replaceSlice(_Element parent, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                        Py_ssize_t slicelength, Py_ssize_t step,
 *                        bint left_to_right, elements) except -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._replaceSlice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_elements);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1240
 *     return 0
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     u"""Append a new child to a parent element.
 *     """
 */

static int __pyx_f_4lxml_5etree__appendChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1243
 *     u"""Append a new child to a parent element.
 *     """
 *     c_node = child._c_node             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 */
  __pyx_t_1 = __pyx_v_child->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1244
 *     """
 *     c_node = child._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     c_parent = parent._c_node
 */
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1246
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     c_parent = parent._c_node             # <<<<<<<<<<<<<<
 *     while c_parent:
 *         if c_parent is c_node:
 */
  __pyx_t_1 = __pyx_v_parent->_c_node;
  __pyx_v_c_parent = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1247
 *     # prevent cycles
 *     c_parent = parent._c_node
 *     while c_parent:             # <<<<<<<<<<<<<<
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_parent != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1248
 *     c_parent = parent._c_node
 *     while c_parent:
 *         if c_parent is c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         c_parent = c_parent.parent
 */
    __pyx_t_3 = ((__pyx_v_c_parent == __pyx_v_c_node) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1249
 *     while c_parent:
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 *     # store possible text node
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1250
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")
 *         c_parent = c_parent.parent             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
    __pyx_t_1 = __pyx_v_c_parent->parent;
    __pyx_v_c_parent = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1252
 *         c_parent = c_parent.parent
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1254
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(parent._c_node, c_node)
 *     _moveTail(c_next, c_node)
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1255
 *     # move node itself
 *     tree.xmlUnlinkNode(c_node)
 *     tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1256
 *     tree.xmlUnlinkNode(c_node)
 *     tree.xmlAddChild(parent._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1259
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1260
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1240
 *     return 0
 * 
 * cdef int _appendChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     u"""Append a new child to a parent element.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._appendChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1262
 *     return 0
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     u"""Prepend a new child to a parent element.
 *     """
 */

static int __pyx_f_4lxml_5etree__prependChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_child;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prependChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1265
 *     u"""Prepend a new child to a parent element.
 *     """
 *     c_node = child._c_node             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 */
  __pyx_t_1 = __pyx_v_child->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1266
 *     """
 *     c_node = child._c_node
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # prevent cycles
 *     c_parent = parent._c_node
 */
  __pyx_t_2 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1268
 *     c_source_doc = c_node.doc
 *     # prevent cycles
 *     c_parent = parent._c_node             # <<<<<<<<<<<<<<
 *     while c_parent:
 *         if c_parent is c_node:
 */
  __pyx_t_1 = __pyx_v_parent->_c_node;
  __pyx_v_c_parent = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1269
 *     # prevent cycles
 *     c_parent = parent._c_node
 *     while c_parent:             # <<<<<<<<<<<<<<
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")
 */
  while (1) {
    __pyx_t_3 = (__pyx_v_c_parent != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1270
 *     c_parent = parent._c_node
 *     while c_parent:
 *         if c_parent is c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot append parent to itself")
 *         c_parent = c_parent.parent
 */
    __pyx_t_3 = ((__pyx_v_c_parent == __pyx_v_c_node) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1271
 *     while c_parent:
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 *     # store possible text node
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1272
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")
 *         c_parent = c_parent.parent             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
    __pyx_t_1 = __pyx_v_c_parent->parent;
    __pyx_v_c_parent = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1274
 *         c_parent = c_parent.parent
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1276
 *     c_next = c_node.next
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)             # <<<<<<<<<<<<<<
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)
 */
  __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_parent->_c_node, 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1277
 *     # move node itself
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlAddChild(parent._c_node, c_node)
 */
  __pyx_t_3 = ((__pyx_v_c_child == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1278
 *     c_child = _findChildForwards(parent._c_node, 0)
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(parent._c_node, c_node)
 *     else:
 */
    xmlUnlinkNode(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1279
 *     if c_child is NULL:
 *         tree.xmlUnlinkNode(c_node)
 *         tree.xmlAddChild(parent._c_node, c_node)             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
 */
    xmlAddChild(__pyx_v_parent->_c_node, __pyx_v_c_node);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1281
 *         tree.xmlAddChild(parent._c_node, c_node)
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
    xmlAddPrevSibling(__pyx_v_c_child, __pyx_v_c_node);
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1282
 *     else:
 *         tree.xmlAddPrevSibling(c_child, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1285
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_parent->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1286
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(parent._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1262
 *     return 0
 * 
 * cdef int _prependChild(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     u"""Prepend a new child to a parent element.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._prependChild", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1288
 *     return 0
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     u"""Add a new sibling behind an element.
 *     """
 */

static int __pyx_f_4lxml_5etree__appendSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendSibling", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1291
 *     u"""Add a new sibling behind an element.
 *     """
 *     c_node = sibling._c_node             # <<<<<<<<<<<<<<
 *     if element._c_node is c_node:
 *         return 0  # nothing to do
 */
  __pyx_t_1 = __pyx_v_sibling->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1292
 *     """
 *     c_node = sibling._c_node
 *     if element._c_node is c_node:             # <<<<<<<<<<<<<<
 *         return 0  # nothing to do
 *     c_source_doc = c_node.doc
 */
  __pyx_t_2 = ((__pyx_v_element->_c_node == __pyx_v_c_node) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1293
 *     c_node = sibling._c_node
 *     if element._c_node is c_node:
 *         return 0  # nothing to do             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # store possible text node
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1294
 *     if element._c_node is c_node:
 *         return 0  # nothing to do
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
  __pyx_t_3 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1296
 *     c_source_doc = c_node.doc
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlAddNextSibling(element._c_node, c_node)
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1298
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlAddNextSibling(element._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  xmlAddNextSibling(__pyx_v_element->_c_node, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1299
 *     # move node itself
 *     tree.xmlAddNextSibling(element._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1302
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1303
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1288
 *     return 0
 * 
 * cdef int _appendSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     u"""Add a new sibling behind an element.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._appendSibling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1305
 *     return 0
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     u"""Add a new sibling before an element.
 *     """
 */

static int __pyx_f_4lxml_5etree__prependSibling(struct LxmlElement *__pyx_v_element, struct LxmlElement *__pyx_v_sibling) {
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_source_doc;
  xmlNode *__pyx_v_c_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prependSibling", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1308
 *     u"""Add a new sibling before an element.
 *     """
 *     c_node = sibling._c_node             # <<<<<<<<<<<<<<
 *     if element._c_node is c_node:
 *         return 0  # nothing to do
 */
  __pyx_t_1 = __pyx_v_sibling->_c_node;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1309
 *     """
 *     c_node = sibling._c_node
 *     if element._c_node is c_node:             # <<<<<<<<<<<<<<
 *         return 0  # nothing to do
 *     c_source_doc = c_node.doc
 */
  __pyx_t_2 = ((__pyx_v_element->_c_node == __pyx_v_c_node) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1310
 *     c_node = sibling._c_node
 *     if element._c_node is c_node:
 *         return 0  # nothing to do             # <<<<<<<<<<<<<<
 *     c_source_doc = c_node.doc
 *     # store possible text node
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1311
 *     if element._c_node is c_node:
 *         return 0  # nothing to do
 *     c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     # store possible text node
 *     c_next = c_node.next
 */
  __pyx_t_3 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1313
 *     c_source_doc = c_node.doc
 *     # store possible text node
 *     c_next = c_node.next             # <<<<<<<<<<<<<<
 *     # move node itself
 *     tree.xmlAddPrevSibling(element._c_node, c_node)
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1315
 *     c_next = c_node.next
 *     # move node itself
 *     tree.xmlAddPrevSibling(element._c_node, c_node)             # <<<<<<<<<<<<<<
 *     _moveTail(c_next, c_node)
 *     # uh oh, elements may be pointing to different doc when
 */
  xmlAddPrevSibling(__pyx_v_element->_c_node, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1316
 *     # move node itself
 *     tree.xmlAddPrevSibling(element._c_node, c_node)
 *     _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1319
 *     # uh oh, elements may be pointing to different doc when
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1320
 *     # parent element has moved; change them too..
 *     moveNodeToDocument(element._doc, c_source_doc, c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int isutf8(const_xmlChar* s):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1305
 *     return 0
 * 
 * cdef int _prependSibling(_Element element, _Element sibling) except -1:             # <<<<<<<<<<<<<<
 *     u"""Add a new sibling before an element.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._prependSibling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1322
 *     return 0
 * 
 * cdef inline int isutf8(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_isutf8(const xmlChar *__pyx_v_s) {
  xmlChar __pyx_v_c;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("isutf8", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1323
 * 
 * cdef inline int isutf8(const_xmlChar* s):
 *     cdef xmlChar c = s[0]             # <<<<<<<<<<<<<<
 *     while c != c'\0':
 *         if c & 0x80:
 */
  __pyx_v_c = (__pyx_v_s[0]);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1324
 * cdef inline int isutf8(const_xmlChar* s):
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':             # <<<<<<<<<<<<<<
 *         if c & 0x80:
 *             return 1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c != '\x00') != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1325
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 *         if c & 0x80:             # <<<<<<<<<<<<<<
 *             return 1
 *         s += 1
 */
    __pyx_t_1 = ((__pyx_v_c & 0x80) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1326
 *     while c != c'\0':
 *         if c & 0x80:
 *             return 1             # <<<<<<<<<<<<<<
 *         s += 1
 *         c = s[0]
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1327
 *         if c & 0x80:
 *             return 1
 *         s += 1             # <<<<<<<<<<<<<<
 *         c = s[0]
 *     return 0
 */
    __pyx_v_s = (__pyx_v_s + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1328
 *             return 1
 *         s += 1
 *         c = s[0]             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c = (__pyx_v_s[0]);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1329
 *         s += 1
 *         c = s[0]
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int check_string_utf8(bytes pystring):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1322
 *     return 0
 * 
 * cdef inline int isutf8(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     cdef xmlChar c = s[0]
 *     while c != c'\0':
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1331
 *     return 0
 * 
 * cdef int check_string_utf8(bytes pystring):             # <<<<<<<<<<<<<<
 *     u"""Check if a string looks like valid UTF-8 XML content.  Returns 0
 *     for ASCII, 1 for UTF-8 and -1 in the case of errors, such as NULL
 */

static int __pyx_f_4lxml_5etree_check_string_utf8(PyObject *__pyx_v_pystring) {
  const xmlChar *__pyx_v_s;
  const xmlChar *__pyx_v_c_end;
  int __pyx_v_is_non_ascii;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_string_utf8", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1336
 *     bytes or ASCII control characters.
 *     """
 *     cdef const_xmlChar* s = _xcstr(pystring)             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef bint is_non_ascii = 0
 */
  __pyx_v_s = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_pystring);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1337
 *     """
 *     cdef const_xmlChar* s = _xcstr(pystring)
 *     cdef const_xmlChar* c_end = s + len(pystring)             # <<<<<<<<<<<<<<
 *     cdef bint is_non_ascii = 0
 *     while s < c_end:
 */
  if (unlikely(__pyx_v_pystring == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyBytes_GET_SIZE(__pyx_v_pystring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_end = (__pyx_v_s + __pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1338
 *     cdef const_xmlChar* s = _xcstr(pystring)
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef bint is_non_ascii = 0             # <<<<<<<<<<<<<<
 *     while s < c_end:
 *         if s[0] & 0x80:
 */
  __pyx_v_is_non_ascii = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1339
 *     cdef const_xmlChar* c_end = s + len(pystring)
 *     cdef bint is_non_ascii = 0
 *     while s < c_end:             # <<<<<<<<<<<<<<
 *         if s[0] & 0x80:
 *             # skip over multi byte sequences
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_s < __pyx_v_c_end) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1340
 *     cdef bint is_non_ascii = 0
 *     while s < c_end:
 *         if s[0] & 0x80:             # <<<<<<<<<<<<<<
 *             # skip over multi byte sequences
 *             while s < c_end and s[0] & 0x80:
 */
    __pyx_t_2 = (((__pyx_v_s[0]) & 0x80) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1342
 *         if s[0] & 0x80:
 *             # skip over multi byte sequences
 *             while s < c_end and s[0] & 0x80:             # <<<<<<<<<<<<<<
 *                 s += 1
 *             is_non_ascii = 1
 */
      while (1) {
        __pyx_t_2 = (__pyx_v_s < __pyx_v_c_end);
        if (__pyx_t_2) {
          __pyx_t_3 = (((__pyx_v_s[0]) & 0x80) != 0);
        } else {
          __pyx_t_3 = __pyx_t_2;
        }
        if (!__pyx_t_3) break;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1343
 *             # skip over multi byte sequences
 *             while s < c_end and s[0] & 0x80:
 *                 s += 1             # <<<<<<<<<<<<<<
 *             is_non_ascii = 1
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 */
        __pyx_v_s = (__pyx_v_s + 1);
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1344
 *             while s < c_end and s[0] & 0x80:
 *                 s += 1
 *             is_non_ascii = 1             # <<<<<<<<<<<<<<
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 *             return -1 # invalid!
 */
      __pyx_v_is_non_ascii = 1;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1345
 *                 s += 1
 *             is_non_ascii = 1
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):             # <<<<<<<<<<<<<<
 *             return -1 # invalid!
 *         s += 1
 */
    __pyx_t_3 = ((__pyx_v_s < __pyx_v_c_end) != 0);
    if (__pyx_t_3) {
      __pyx_t_2 = ((!(xmlIsChar_ch((__pyx_v_s[0])) != 0)) != 0);
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_3;
    }
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1346
 *             is_non_ascii = 1
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 *             return -1 # invalid!             # <<<<<<<<<<<<<<
 *         s += 1
 *     return is_non_ascii
 */
      __pyx_r = -1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1347
 *         if  s < c_end and not tree.xmlIsChar_ch(s[0]):
 *             return -1 # invalid!
 *         s += 1             # <<<<<<<<<<<<<<
 *     return is_non_ascii
 * 
 */
    __pyx_v_s = (__pyx_v_s + 1);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1348
 *             return -1 # invalid!
 *         s += 1
 *     return is_non_ascii             # <<<<<<<<<<<<<<
 * 
 * cdef inline object funicodeOrNone(const_xmlChar* s):
 */
  __pyx_r = __pyx_v_is_non_ascii;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1331
 *     return 0
 * 
 * cdef int check_string_utf8(bytes pystring):             # <<<<<<<<<<<<<<
 *     u"""Check if a string looks like valid UTF-8 XML content.  Returns 0
 *     for ASCII, 1 for UTF-8 and -1 in the case of errors, such as NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.check_string_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1350
 *     return is_non_ascii
 * 
 * cdef inline object funicodeOrNone(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else None
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrNone(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicodeOrNone", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1351
 * 
 * cdef inline object funicodeOrNone(const_xmlChar* s):
 *     return funicode(s) if s is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * cdef inline object funicodeOrEmpty(const_xmlChar* s):
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_s != NULL) != 0)) {
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1350
 *     return is_non_ascii
 * 
 * cdef inline object funicodeOrNone(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else None
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.funicodeOrNone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1353
 *     return funicode(s) if s is not NULL else None
 * 
 * cdef inline object funicodeOrEmpty(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else ''
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree_funicodeOrEmpty(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicodeOrEmpty", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1354
 * 
 * cdef inline object funicodeOrEmpty(const_xmlChar* s):
 *     return funicode(s) if s is not NULL else ''             # <<<<<<<<<<<<<<
 * 
 * cdef object funicode(const_xmlChar* s):
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_s != NULL) != 0)) {
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_kp_s__15);
    __pyx_t_1 = __pyx_kp_s__15;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1353
 *     return funicode(s) if s is not NULL else None
 * 
 * cdef inline object funicodeOrEmpty(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     return funicode(s) if s is not NULL else ''
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.funicodeOrEmpty", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1356
 *     return funicode(s) if s is not NULL else ''
 * 
 * cdef object funicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t slen
 *     cdef const_xmlChar* spos
 */

static PyObject *__pyx_f_4lxml_5etree_funicode(const xmlChar *__pyx_v_s) {
  Py_ssize_t __pyx_v_slen;
  const xmlChar *__pyx_v_spos;
  int __pyx_v_is_non_ascii;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("funicode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1360
 *     cdef const_xmlChar* spos
 *     cdef bint is_non_ascii
 *     if python.LXML_UNICODE_STRINGS:             # <<<<<<<<<<<<<<
 *         return s.decode('UTF-8')
 *     spos = s
 */
  __pyx_t_1 = (LXML_UNICODE_STRINGS != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1361
 *     cdef bint is_non_ascii
 *     if python.LXML_UNICODE_STRINGS:
 *         return s.decode('UTF-8')             # <<<<<<<<<<<<<<
 *     spos = s
 *     is_non_ascii = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_decode_c_string(((char *)__pyx_v_s), 0, strlen(((char *)__pyx_v_s)), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1362
 *     if python.LXML_UNICODE_STRINGS:
 *         return s.decode('UTF-8')
 *     spos = s             # <<<<<<<<<<<<<<
 *     is_non_ascii = 0
 *     while spos[0] != c'\0':
 */
  __pyx_v_spos = __pyx_v_s;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1363
 *         return s.decode('UTF-8')
 *     spos = s
 *     is_non_ascii = 0             # <<<<<<<<<<<<<<
 *     while spos[0] != c'\0':
 *         if spos[0] & 0x80:
 */
  __pyx_v_is_non_ascii = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1364
 *     spos = s
 *     is_non_ascii = 0
 *     while spos[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if spos[0] & 0x80:
 *             is_non_ascii = 1
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_spos[0]) != '\x00') != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1365
 *     is_non_ascii = 0
 *     while spos[0] != c'\0':
 *         if spos[0] & 0x80:             # <<<<<<<<<<<<<<
 *             is_non_ascii = 1
 *             break
 */
    __pyx_t_1 = (((__pyx_v_spos[0]) & 0x80) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1366
 *     while spos[0] != c'\0':
 *         if spos[0] & 0x80:
 *             is_non_ascii = 1             # <<<<<<<<<<<<<<
 *             break
 *         spos += 1
 */
      __pyx_v_is_non_ascii = 1;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1367
 *         if spos[0] & 0x80:
 *             is_non_ascii = 1
 *             break             # <<<<<<<<<<<<<<
 *         spos += 1
 *     slen = spos - s
 */
      goto __pyx_L5_break;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1368
 *             is_non_ascii = 1
 *             break
 *         spos += 1             # <<<<<<<<<<<<<<
 *     slen = spos - s
 *     if spos[0] != c'\0':
 */
    __pyx_v_spos = (__pyx_v_spos + 1);
  }
  __pyx_L5_break:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1369
 *             break
 *         spos += 1
 *     slen = spos - s             # <<<<<<<<<<<<<<
 *     if spos[0] != c'\0':
 *         slen += tree.xmlStrlen(spos)
 */
  __pyx_v_slen = (__pyx_v_spos - __pyx_v_s);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1370
 *         spos += 1
 *     slen = spos - s
 *     if spos[0] != c'\0':             # <<<<<<<<<<<<<<
 *         slen += tree.xmlStrlen(spos)
 *     if is_non_ascii:
 */
  __pyx_t_1 = (((__pyx_v_spos[0]) != '\x00') != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1371
 *     slen = spos - s
 *     if spos[0] != c'\0':
 *         slen += tree.xmlStrlen(spos)             # <<<<<<<<<<<<<<
 *     if is_non_ascii:
 *         return s[:slen].decode('UTF-8')
 */
    __pyx_v_slen = (__pyx_v_slen + xmlStrlen(__pyx_v_spos));
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1372
 *     if spos[0] != c'\0':
 *         slen += tree.xmlStrlen(spos)
 *     if is_non_ascii:             # <<<<<<<<<<<<<<
 *         return s[:slen].decode('UTF-8')
 *     return <bytes>s[:slen]
 */
  __pyx_t_1 = (__pyx_v_is_non_ascii != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1373
 *         slen += tree.xmlStrlen(spos)
 *     if is_non_ascii:
 *         return s[:slen].decode('UTF-8')             # <<<<<<<<<<<<<<
 *     return <bytes>s[:slen]
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_decode_c_string(((char *)__pyx_v_s), 0, __pyx_v_slen, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1374
 *     if is_non_ascii:
 *         return s[:slen].decode('UTF-8')
 *     return <bytes>s[:slen]             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _utf8(object s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_s) + 0, __pyx_v_slen - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject*)__pyx_t_2));
  __pyx_r = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1356
 *     return funicode(s) if s is not NULL else ''
 * 
 * cdef object funicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t slen
 *     cdef const_xmlChar* spos
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.funicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1376
 *     return <bytes>s[:slen]
 * 
 * cdef bytes _utf8(object s):             # <<<<<<<<<<<<<<
 *     """Test if a string is valid user input and encode it to UTF-8.
 *     Reject all bytes/unicode input that contains non-XML characters.
 */

static PyObject *__pyx_f_4lxml_5etree__utf8(PyObject *__pyx_v_s) {
  int __pyx_v_invalid;
  PyObject *__pyx_v_utf8_string = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_utf8", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1383
 *     cdef int invalid
 *     cdef bytes utf8_string
 *     if not python.IS_PYTHON3 and type(s) is bytes:             # <<<<<<<<<<<<<<
 *         utf8_string = <bytes>s
 *         invalid = check_string_utf8(utf8_string)
 */
  __pyx_t_1 = ((!(IS_PYTHON3 != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_s)) == ((PyObject *)((PyObject*)(&PyBytes_Type))));
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1384
 *     cdef bytes utf8_string
 *     if not python.IS_PYTHON3 and type(s) is bytes:
 *         utf8_string = <bytes>s             # <<<<<<<<<<<<<<
 *         invalid = check_string_utf8(utf8_string)
 *     elif isinstance(s, unicode):
 */
    __pyx_t_4 = __pyx_v_s;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1385
 *     if not python.IS_PYTHON3 and type(s) is bytes:
 *         utf8_string = <bytes>s
 *         invalid = check_string_utf8(utf8_string)             # <<<<<<<<<<<<<<
 *     elif isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')
 */
    __pyx_v_invalid = __pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_utf8_string);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1386
 *         utf8_string = <bytes>s
 *         invalid = check_string_utf8(utf8_string)
 *     elif isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *         utf8_string = (<unicode>s).encode('utf8')
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 */
  __pyx_t_3 = PyUnicode_Check(__pyx_v_s); 
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1387
 *         invalid = check_string_utf8(utf8_string)
 *     elif isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')             # <<<<<<<<<<<<<<
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 *     elif isinstance(s, bytes):
 */
    if (unlikely(__pyx_v_s == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_s)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1388
 *     elif isinstance(s, unicode):
 *         utf8_string = (<unicode>s).encode('utf8')
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?             # <<<<<<<<<<<<<<
 *     elif isinstance(s, bytes):
 *         utf8_string = bytes(s)
 */
    __pyx_v_invalid = (__pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_utf8_string) == -1);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1389
 *         utf8_string = (<unicode>s).encode('utf8')
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 *     elif isinstance(s, bytes):             # <<<<<<<<<<<<<<
 *         utf8_string = bytes(s)
 *         invalid = check_string_utf8(utf8_string)
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_s); 
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1390
 *         invalid = check_string_utf8(utf8_string) == -1 # non-XML?
 *     elif isinstance(s, bytes):
 *         utf8_string = bytes(s)             # <<<<<<<<<<<<<<
 *         invalid = check_string_utf8(utf8_string)
 *     else:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_utf8_string = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1391
 *     elif isinstance(s, bytes):
 *         utf8_string = bytes(s)
 *         invalid = check_string_utf8(utf8_string)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 */
    __pyx_v_invalid = __pyx_f_4lxml_5etree_check_string_utf8(__pyx_v_utf8_string);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1393
 *         invalid = check_string_utf8(utf8_string)
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)             # <<<<<<<<<<<<<<
 *     if invalid:
 *         raise ValueError(
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_s)), __pyx_n_s_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Argument_must_be_bytes_or_unicod, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1394
 *     else:
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if invalid:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 */
  __pyx_t_3 = (__pyx_v_invalid != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1395
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if invalid:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1397
 *         raise ValueError(
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _utf8orNone(object s):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_utf8_string);
  __pyx_r = __pyx_v_utf8_string;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1376
 *     return <bytes>s[:slen]
 * 
 * cdef bytes _utf8(object s):             # <<<<<<<<<<<<<<
 *     """Test if a string is valid user input and encode it to UTF-8.
 *     Reject all bytes/unicode input that contains non-XML characters.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._utf8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_utf8_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1399
 *     return utf8_string
 * 
 * cdef bytes _utf8orNone(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s) if s is not None else None
 * 
 */

static PyObject *__pyx_f_4lxml_5etree__utf8orNone(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_utf8orNone", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1400
 * 
 * cdef bytes _utf8orNone(object s):
 *     return _utf8(s) if s is not None else None             # <<<<<<<<<<<<<<
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_s != Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1399
 *     return utf8_string
 * 
 * cdef bytes _utf8orNone(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s) if s is not None else None
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._utf8orNone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1402
 *     return _utf8(s) if s is not None else None
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     u"simple heuristic to see if a path is a filename"
 *     cdef xmlChar c
 */

static int __pyx_f_4lxml_5etree__isFilePath(const xmlChar *__pyx_v_c_path) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_isFilePath", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1406
 *     cdef xmlChar c
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':             # <<<<<<<<<<<<<<
 *         return 1
 * 
 */
  __pyx_t_1 = (((__pyx_v_c_path[0]) == '/') != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1407
 *     # test if it looks like an absolute Unix path or a Windows network path
 *     if c_path[0] == c'/':
 *         return 1             # <<<<<<<<<<<<<<
 * 
 *     # test if it looks like an absolute Windows path or URL
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1410
 * 
 *     # test if it looks like an absolute Windows path or URL
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \             # <<<<<<<<<<<<<<
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *         c_path += 1
 */
  __pyx_t_1 = (((__pyx_v_c_path[0]) >= 'a') != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = (((__pyx_v_c_path[0]) <= 'z') != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (!__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1411
 *     # test if it looks like an absolute Windows path or URL
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):             # <<<<<<<<<<<<<<
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 */
    __pyx_t_1 = (((__pyx_v_c_path[0]) >= 'A') != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = (((__pyx_v_c_path[0]) <= 'Z') != 0);
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_4;
  } else {
    __pyx_t_1 = __pyx_t_3;
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1412
 *     if (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *         c_path += 1             # <<<<<<<<<<<<<<
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 *             return 1  # C: or C:\...
 */
    __pyx_v_c_path = (__pyx_v_c_path + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1413
 *             (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':             # <<<<<<<<<<<<<<
 *             return 1  # C: or C:\...
 * 
 */
    __pyx_t_1 = (((__pyx_v_c_path[0]) == ':') != 0);
    if (__pyx_t_1) {
      switch ((__pyx_v_c_path[1])) {
        case '\x00':
        case '\\':
        __pyx_t_3 = 1;
        break;
        default:
        __pyx_t_3 = 0;
        break;
      }
      __pyx_t_4 = (__pyx_t_3 != 0);
      __pyx_t_3 = __pyx_t_4;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1414
 *         c_path += 1
 *         if c_path[0] == c':' and c_path[1] in b'\0\\':
 *             return 1  # C: or C:\...             # <<<<<<<<<<<<<<
 * 
 *         # test if it looks like a URL with scheme://
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1417
 * 
 *         # test if it looks like a URL with scheme://
 *         while (c_path[0] >= c'a' and c_path[0] <= c'z') or \             # <<<<<<<<<<<<<<
 *                 (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *             c_path += 1
 */
    while (1) {
      __pyx_t_3 = (((__pyx_v_c_path[0]) >= 'a') != 0);
      if (__pyx_t_3) {
        __pyx_t_1 = (((__pyx_v_c_path[0]) <= 'z') != 0);
        __pyx_t_4 = __pyx_t_1;
      } else {
        __pyx_t_4 = __pyx_t_3;
      }
      if (!__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1418
 *         # test if it looks like a URL with scheme://
 *         while (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 *                 (c_path[0] >= c'A' and c_path[0] <= c'Z'):             # <<<<<<<<<<<<<<
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 */
        __pyx_t_3 = (((__pyx_v_c_path[0]) >= 'A') != 0);
        if (__pyx_t_3) {
          __pyx_t_1 = (((__pyx_v_c_path[0]) <= 'Z') != 0);
          __pyx_t_2 = __pyx_t_1;
        } else {
          __pyx_t_2 = __pyx_t_3;
        }
        __pyx_t_3 = __pyx_t_2;
      } else {
        __pyx_t_3 = __pyx_t_4;
      }
      if (!__pyx_t_3) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1419
 *         while (c_path[0] >= c'a' and c_path[0] <= c'z') or \
 *                 (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *             c_path += 1             # <<<<<<<<<<<<<<
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 *             return 0
 */
      __pyx_v_c_path = (__pyx_v_c_path + 1);
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1420
 *                 (c_path[0] >= c'A' and c_path[0] <= c'Z'):
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
    __pyx_t_3 = (((__pyx_v_c_path[0]) == ':') != 0);
    if (__pyx_t_3) {
      __pyx_t_4 = (((__pyx_v_c_path[1]) == '/') != 0);
      if (__pyx_t_4) {
        __pyx_t_2 = (((__pyx_v_c_path[2]) == '/') != 0);
        __pyx_t_1 = __pyx_t_2;
      } else {
        __pyx_t_1 = __pyx_t_4;
      }
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_3;
    }
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1421
 *             c_path += 1
 *         if c_path[0] == c':' and c_path[1] == c'/' and c_path[2] == c'/':
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     # assume it's a relative path
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1424
 * 
 *     # assume it's a relative path
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef object _encodeFilename(object filename):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1402
 *     return _utf8(s) if s is not None else None
 * 
 * cdef bint _isFilePath(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     u"simple heuristic to see if a path is a filename"
 *     cdef xmlChar c
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1426
 *     return 1
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     u"""Make sure a filename is 8-bit encoded (or None).
 *     """
 */

static PyObject *__pyx_f_4lxml_5etree__encodeFilename(PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  unsigned char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encodeFilename", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1429
 *     u"""Make sure a filename is 8-bit encoded (or None).
 *     """
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1430
 *     """
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, bytes):
 *         return filename
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1431
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         return filename
 *     elif isinstance(filename, unicode):
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_filename); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1432
 *         return None
 *     elif isinstance(filename, bytes):
 *         return filename             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_filename);
    __pyx_r = __pyx_v_filename;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1433
 *     elif isinstance(filename, bytes):
 *         return filename
 *     elif isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_filename); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1434
 *         return filename
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')             # <<<<<<<<<<<<<<
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:
 */
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_filename)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_filename8 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1435
 *     elif isinstance(filename, unicode):
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):             # <<<<<<<<<<<<<<
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 */
    __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_v_filename8); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (__pyx_f_4lxml_5etree__isFilePath(((unsigned char *)__pyx_t_4)) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1436
 *         filename8 = (<unicode>filename).encode('utf8')
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:             # <<<<<<<<<<<<<<
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1437
 *         if _isFilePath(<unsigned char*>filename8):
 *             try:
 *                 return python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:
 */
          __Pyx_XDECREF(__pyx_r);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1438
 *             try:
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *             except UnicodeEncodeError:
 *                 pass
 */
          __pyx_t_3 = PyUnicode_AsEncodedString(__pyx_v_filename, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L9_try_return;
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L12_try_end;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1439
 *                 return python.PyUnicode_AsEncodedString(
 *                     filename, _C_FILENAME_ENCODING, NULL)
 *             except UnicodeEncodeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         return filename8
 */
        __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeEncodeError);
        if (__pyx_t_8) {
          PyErr_Restore(0,0,0);
          goto __pyx_L6_exception_handled;
        }
        goto __pyx_L7_except_error;
        __pyx_L7_except_error:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L9_try_return:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L0;
        __pyx_L6_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        __pyx_L12_try_end:;
      }
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1441
 *             except UnicodeEncodeError:
 *                 pass
 *         return filename8             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be string or unicode.")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_filename8);
    __pyx_r = __pyx_v_filename8;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1443
 *         return filename8
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1426
 *     return 1
 * 
 * cdef object _encodeFilename(object filename):             # <<<<<<<<<<<<<<
 *     u"""Make sure a filename is 8-bit encoded (or None).
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1445
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 */

static PyObject *__pyx_f_4lxml_5etree__decodeFilename(const xmlChar *__pyx_v_c_path) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decodeFilename", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1448
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__decodeFilenameWithLength(__pyx_v_c_path, xmlStrlen(__pyx_v_c_path)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1445
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):             # <<<<<<<<<<<<<<
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._decodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1450
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):             # <<<<<<<<<<<<<<
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 */

static PyObject *__pyx_f_4lxml_5etree__decodeFilenameWithLength(const xmlChar *__pyx_v_c_path, size_t __pyx_v_c_len) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decodeFilenameWithLength", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1453
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 *     if _isFilePath(c_path):             # <<<<<<<<<<<<<<
 *         try:
 *             return python.PyUnicode_Decode(
 */
  __pyx_t_1 = (__pyx_f_4lxml_5etree__isFilePath(__pyx_v_c_path) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1454
 *     """
 *     if _isFilePath(c_path):
 *         try:             # <<<<<<<<<<<<<<
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1455
 *     if _isFilePath(c_path):
 *         try:
 *             return python.PyUnicode_Decode(             # <<<<<<<<<<<<<<
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:
 */
        __Pyx_XDECREF(__pyx_r);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1456
 *         try:
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)             # <<<<<<<<<<<<<<
 *         except UnicodeDecodeError:
 *             pass
 */
        __pyx_t_5 = PyUnicode_Decode(((const char *)__pyx_v_c_path), __pyx_v_c_len, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L8_try_return;
      }
      __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;
      goto __pyx_L11_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1457
 *             return python.PyUnicode_Decode(
 *                 <const_char*>c_path, c_len, _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *             pass
 *     try:
 */
      __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_6) {
        PyErr_Restore(0,0,0);
        goto __pyx_L5_exception_handled;
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L8_try_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L0;
      __pyx_L5_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L11_try_end:;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1459
 *         except UnicodeDecodeError:
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1460
 *             pass
 *     try:
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')             # <<<<<<<<<<<<<<
 *     except UnicodeDecodeError:
 *         # this is a stupid fallback, but it might still work...
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_decode_c_string(((char *)((unsigned char *)__pyx_v_c_path)), 0, __pyx_v_c_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_try_return;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L19_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1461
 *     try:
 *         return (<unsigned char*>c_path)[:c_len].decode('UTF-8')
 *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *         # this is a stupid fallback, but it might still work...
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree._decodeFilenameWithLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1463
 *     except UnicodeDecodeError:
 *         # this is a stupid fallback, but it might still work...
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')             # <<<<<<<<<<<<<<
 * 
 * cdef object _encodeFilenameUTF8(object filename):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = __Pyx_decode_c_string(((char *)((unsigned char *)__pyx_v_c_path)), 0, __pyx_v_c_len, NULL, __pyx_k_replace, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1463; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L15_except_return;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L13_exception_handled;
    }
    goto __pyx_L14_except_error;
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L16_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L0;
    __pyx_L15_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L0;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    __pyx_L19_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1450
 *     return _decodeFilenameWithLength(c_path, tree.xmlStrlen(c_path))
 * 
 * cdef object _decodeFilenameWithLength(const_xmlChar* c_path, size_t c_len):             # <<<<<<<<<<<<<<
 *     u"""Make the filename a unicode string if we are in Py3.
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._decodeFilenameWithLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1465
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     u"""Recode filename as UTF-8. Tries ASCII, local filesystem encoding and
 *     UTF-8 as source encoding.
 */

static PyObject *__pyx_f_4lxml_5etree__encodeFilenameUTF8(PyObject *__pyx_v_filename) {
  char *__pyx_v_c_filename;
  PyObject *__pyx_v_decode_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encodeFilenameUTF8", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1470
 *     """
 *     cdef char* c_filename
 *     if filename is None:             # <<<<<<<<<<<<<<
 *         return None
 *     elif isinstance(filename, bytes):
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1471
 *     cdef char* c_filename
 *     if filename is None:
 *         return None             # <<<<<<<<<<<<<<
 *     elif isinstance(filename, bytes):
 *         if not check_string_utf8(<bytes>filename):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1472
 *     if filename is None:
 *         return None
 *     elif isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *         if not check_string_utf8(<bytes>filename):
 *             # plain ASCII!
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_filename); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1473
 *         return None
 *     elif isinstance(filename, bytes):
 *         if not check_string_utf8(<bytes>filename):             # <<<<<<<<<<<<<<
 *             # plain ASCII!
 *             return filename
 */
    __pyx_t_1 = ((!(__pyx_f_4lxml_5etree_check_string_utf8(((PyObject*)__pyx_v_filename)) != 0)) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1475
 *         if not check_string_utf8(<bytes>filename):
 *             # plain ASCII!
 *             return filename             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(<bytes>filename)
 *         try:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_filename);
      __pyx_r = __pyx_v_filename;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1476
 *             # plain ASCII!
 *             return filename
 *         c_filename = _cstr(<bytes>filename)             # <<<<<<<<<<<<<<
 *         try:
 *             # try to decode with default encoding
 */
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1477
 *             return filename
 *         c_filename = _cstr(<bytes>filename)
 *         try:             # <<<<<<<<<<<<<<
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1480
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(
 *                 c_filename, len(<bytes>filename),             # <<<<<<<<<<<<<<
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 */
        if (unlikely(__pyx_v_filename == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        }
        __pyx_t_6 = PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L5_error;}

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1479
 *         try:
 *             # try to decode with default encoding
 *             filename = python.PyUnicode_Decode(             # <<<<<<<<<<<<<<
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
 */
        __pyx_t_7 = PyUnicode_Decode(__pyx_v_c_filename, __pyx_t_6, __pyx_v_4lxml_5etree__C_FILENAME_ENCODING, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_7);
        __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1482
 *                 c_filename, len(<bytes>filename),
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:             # <<<<<<<<<<<<<<
 *             try:
 *                 # try if it's proper UTF-8
 */
      __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
      if (__pyx_t_8) {
        __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __pyx_v_decode_exc = __pyx_t_9;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1483
 *                 _C_FILENAME_ENCODING, NULL)
 *         except UnicodeDecodeError as decode_exc:
 *             try:             # <<<<<<<<<<<<<<
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1485
 *             try:
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')             # <<<<<<<<<<<<<<
 *                 return filename
 *             except UnicodeDecodeError:
 */
            if (unlikely(__pyx_v_filename == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
              {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            }
            __pyx_t_14 = __Pyx_decode_bytes(((PyObject*)__pyx_v_filename), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1486
 *                 # try if it's proper UTF-8
 *                 (<bytes>filename).decode('utf8')
 *                 return filename             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_v_filename);
            __pyx_r = __pyx_v_filename;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L19_try_return;
          }
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L22_try_end;
          __pyx_L15_error:;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1487
 *                 (<bytes>filename).decode('utf8')
 *                 return filename
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):
 */
          __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
          if (__pyx_t_8) {
            __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_GOTREF(__pyx_t_16);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1488
 *                 return filename
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception             # <<<<<<<<<<<<<<
 *     if isinstance(filename, unicode):
 *         return (<unicode>filename).encode('utf8')
 */
            __Pyx_Raise(__pyx_v_decode_exc, 0, 0, 0);
            {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            goto __pyx_L16_exception_handled;
          }
          goto __pyx_L17_except_error;
          __pyx_L17_except_error:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          goto __pyx_L7_except_error;
          __pyx_L19_try_return:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          goto __pyx_L8_except_return;
          __pyx_L16_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __pyx_L22_try_end:;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L8_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L12_try_end:;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1489
 *             except UnicodeDecodeError:
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):             # <<<<<<<<<<<<<<
 *         return (<unicode>filename).encode('utf8')
 *     else:
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_filename); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1490
 *                 raise decode_exc # otherwise re-raise original exception
 *     if isinstance(filename, unicode):
 *         return (<unicode>filename).encode('utf8')             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Argument must be string or unicode.")
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_10 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_filename)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1492
 *         return (<unicode>filename).encode('utf8')
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTag(tag):
 */
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1465
 *         return (<unsigned char*>c_path)[:c_len].decode('latin-1', 'replace')
 * 
 * cdef object _encodeFilenameUTF8(object filename):             # <<<<<<<<<<<<<<
 *     u"""Recode filename as UTF-8. Tries ASCII, local filesystem encoding and
 *     UTF-8 as source encoding.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._encodeFilenameUTF8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_decode_exc);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1494
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     u"""Given a tag, find namespace URI and tag name.
 *     Return None for NS uri if no namespace URI provided.
 */

static PyObject *__pyx_f_4lxml_5etree__getNsTag(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getNsTag", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1498
 *     Return None for NS uri if no namespace URI provided.
 *     """
 *     return __getNsTag(tag, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree___getNsTag(__pyx_v_tag, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1498; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1494
 *         raise TypeError("Argument must be string or unicode.")
 * 
 * cdef tuple _getNsTag(tag):             # <<<<<<<<<<<<<<
 *     u"""Given a tag, find namespace URI and tag name.
 *     Return None for NS uri if no namespace URI provided.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1500
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     u"""Given a tag, find namespace URI and tag name.  Return None for NS uri
 *     if no namespace URI provided, or the empty string if namespace
 */

static PyObject *__pyx_f_4lxml_5etree__getNsTagWithEmptyNs(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getNsTagWithEmptyNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1505
 *     part is '{}'.
 *     """
 *     return __getNsTag(tag, 1)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree___getNsTag(__pyx_v_tag, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1505; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1500
 *     return __getNsTag(tag, 0)
 * 
 * cdef tuple _getNsTagWithEmptyNs(tag):             # <<<<<<<<<<<<<<
 *     u"""Given a tag, find namespace URI and tag name.  Return None for NS uri
 *     if no namespace URI provided, or the empty string if namespace
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._getNsTagWithEmptyNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1507
 *     return __getNsTag(tag, 1)
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):             # <<<<<<<<<<<<<<
 *     cdef char* c_tag
 *     cdef char* c_ns_end
 */

static PyObject *__pyx_f_4lxml_5etree___getNsTag(PyObject *__pyx_v_tag, int __pyx_v_empty_ns) {
  char *__pyx_v_c_tag;
  char *__pyx_v_c_ns_end;
  Py_ssize_t __pyx_v_taglen;
  Py_ssize_t __pyx_v_nslen;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getNsTag", 0);
  __Pyx_INCREF(__pyx_v_tag);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1512
 *     cdef Py_ssize_t taglen
 *     cdef Py_ssize_t nslen
 *     cdef bytes ns = None             # <<<<<<<<<<<<<<
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_ns = ((PyObject*)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1514
 *     cdef bytes ns = None
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):             # <<<<<<<<<<<<<<
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
 */
  __pyx_t_1 = ((!(_isString(__pyx_v_tag) != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_tag, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1515
 *     # _isString() is much faster than isinstance()
 *     if not _isString(tag) and isinstance(tag, QName):
 *         tag = (<QName>tag).text             # <<<<<<<<<<<<<<
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 */
    __pyx_t_4 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_tag)->text;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1516
 *     if not _isString(tag) and isinstance(tag, QName):
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)             # <<<<<<<<<<<<<<
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1517
 *         tag = (<QName>tag).text
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)             # <<<<<<<<<<<<<<
 *     if c_tag[0] == c'{':
 *         c_tag += 1
 */
  __pyx_v_c_tag = PyBytes_AS_STRING(__pyx_v_tag);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1518
 *     tag = _utf8(tag)
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':             # <<<<<<<<<<<<<<
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 */
  __pyx_t_3 = (((__pyx_v_c_tag[0]) == '{') != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1519
 *     c_tag = _cstr(tag)
 *     if c_tag[0] == c'{':
 *         c_tag += 1             # <<<<<<<<<<<<<<
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
 */
      __pyx_v_c_tag = (__pyx_v_c_tag + 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1520
 *     if c_tag[0] == c'{':
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')             # <<<<<<<<<<<<<<
 *         if c_ns_end is NULL:
 *             raise ValueError, u"Invalid tag name"
 */
    __pyx_v_c_ns_end = strchr(__pyx_v_c_tag, '}');

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1521
 *         c_tag += 1
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 */
    __pyx_t_3 = ((__pyx_v_c_ns_end == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1522
 *         c_ns_end = cstring_h.strchr(c_tag, c'}')
 *         if c_ns_end is NULL:
 *             raise ValueError, u"Invalid tag name"             # <<<<<<<<<<<<<<
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Invalid_tag_name, 0, 0);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1523
 *         if c_ns_end is NULL:
 *             raise ValueError, u"Invalid tag name"
 *         nslen  = c_ns_end - c_tag             # <<<<<<<<<<<<<<
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
 */
    __pyx_v_nslen = (__pyx_v_c_ns_end - __pyx_v_c_tag);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1524
 *             raise ValueError, u"Invalid tag name"
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2             # <<<<<<<<<<<<<<
 *         if taglen == 0:
 *             raise ValueError, u"Empty tag name"
 */
    __pyx_v_taglen = ((PyBytes_GET_SIZE(__pyx_v_tag) - __pyx_v_nslen) - 2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1525
 *         nslen  = c_ns_end - c_tag
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Empty tag name"
 *         if nslen > 0:
 */
    __pyx_t_3 = ((__pyx_v_taglen == 0) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1526
 *         taglen = python.PyBytes_GET_SIZE(tag) - nslen - 2
 *         if taglen == 0:
 *             raise ValueError, u"Empty tag name"             # <<<<<<<<<<<<<<
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Empty_tag_name, 0, 0);
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1527
 *         if taglen == 0:
 *             raise ValueError, u"Empty tag name"
 *         if nslen > 0:             # <<<<<<<<<<<<<<
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 */
    __pyx_t_3 = ((__pyx_v_nslen > 0) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1528
 *             raise ValueError, u"Empty tag name"
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]             # <<<<<<<<<<<<<<
 *         elif empty_ns:
 *             ns = b''
 */
      __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_tag + 0, __pyx_v_nslen - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_t_4;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;
      goto __pyx_L7;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1529
 *         if nslen > 0:
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:             # <<<<<<<<<<<<<<
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 */
    __pyx_t_3 = (__pyx_v_empty_ns != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1530
 *             ns = <bytes>c_tag[:nslen]
 *         elif empty_ns:
 *             ns = b''             # <<<<<<<<<<<<<<
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 */
      __Pyx_INCREF(__pyx_kp_b__15);
      __Pyx_DECREF_SET(__pyx_v_ns, __pyx_kp_b__15);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1531
 *         elif empty_ns:
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]             # <<<<<<<<<<<<<<
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, u"Empty tag name"
 */
    __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_ns_end + 1, (__pyx_v_taglen + 1) - 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1532
 *             ns = b''
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Empty tag name"
 *     return ns, tag
 */
  __pyx_t_3 = ((PyBytes_GET_SIZE(__pyx_v_tag) == 0) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1533
 *         tag = <bytes>c_ns_end[1:taglen+1]
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, u"Empty tag name"             # <<<<<<<<<<<<<<
 *     return ns, tag
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Empty_tag_name, 0, 0);
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1534
 *     elif python.PyBytes_GET_SIZE(tag) == 0:
 *         raise ValueError, u"Empty tag name"
 *     return ns, tag             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_ns);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1507
 *     return __getNsTag(tag, 1)
 * 
 * cdef tuple __getNsTag(tag, bint empty_ns):             # <<<<<<<<<<<<<<
 *     cdef char* c_tag
 *     cdef char* c_ns_end
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.__getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1536
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_xcstr(name_utf8))
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyXmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_pyXmlNameIsValid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1537
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):
 *     return _xmlNameIsValid(_xcstr(name_utf8))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 */
  __pyx_r = __pyx_f_4lxml_5etree__xmlNameIsValid((const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf8));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1536
 *     return ns, tag
 * 
 * cdef inline int _pyXmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _xmlNameIsValid(_xcstr(name_utf8))
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1539
 *     return _xmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__pyHtmlNameIsValid(PyObject *__pyx_v_name_utf8) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_pyHtmlNameIsValid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1540
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):
 *     return _htmlNameIsValid(_xcstr(name_utf8))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name):
 */
  __pyx_r = __pyx_f_4lxml_5etree__htmlNameIsValid((const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf8));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1539
 *     return _xmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _pyHtmlNameIsValid(name_utf8):             # <<<<<<<<<<<<<<
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1542
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNCName(c_name, 0) == 0
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__xmlNameIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_xmlNameIsValid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1543
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name):
 *     return tree.xmlValidateNCName(c_name, 0) == 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name):
 */
  __pyx_r = (xmlValidateNCName(__pyx_v_c_name, 0) == 0);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1542
 *     return _htmlNameIsValid(_xcstr(name_utf8))
 * 
 * cdef inline int _xmlNameIsValid(const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     return tree.xmlValidateNCName(c_name, 0) == 0
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1545
 *     return tree.xmlValidateNCName(c_name, 0) == 0
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
 */

static int __pyx_f_4lxml_5etree__htmlNameIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_htmlNameIsValid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1546
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name):
 *     if c_name is NULL or c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  __pyx_t_1 = ((__pyx_v_c_name == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = (((__pyx_v_c_name[0]) == '\x00') != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1547
 * cdef int _htmlNameIsValid(const_xmlChar* c_name):
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0             # <<<<<<<<<<<<<<
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1548
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
 *     while c_name[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 *             return 0
 */
  while (1) {
    __pyx_t_3 = (((__pyx_v_c_name[0]) != '\x00') != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1549
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':             # <<<<<<<<<<<<<<
 *             return 0
 *         c_name += 1
 */
    switch ((__pyx_v_c_name[0])) {
      case '\t':
      case '\n':
      case '\x0B':
      case '\x0C':
      case '\r':
      case ' ':
      case '"':
      case '&':
      case '\'':
      case '/':
      case '<':
      case '>':

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1550
 *     while c_name[0] != c'\0':
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 *             return 0             # <<<<<<<<<<<<<<
 *         c_name += 1
 *     return 1
 */
      __pyx_r = 0;
      goto __pyx_L0;
      break;
      default: break;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1551
 *         if c_name[0] in b'&<>/"\'\t\n\x0B\x0C\r ':
 *             return 0
 *         c_name += 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
    __pyx_v_c_name = (__pyx_v_c_name + 1);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1552
 *             return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1545
 *     return tree.xmlValidateNCName(c_name, 0) == 0
 * 
 * cdef int _htmlNameIsValid(const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     if c_name is NULL or c_name[0] == c'\0':
 *         return 0
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1554
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 */

static int __pyx_f_4lxml_5etree__characterReferenceIsValid(const xmlChar *__pyx_v_c_name) {
  int __pyx_v_is_hex;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_characterReferenceIsValid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1556
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name):
 *     cdef bint is_hex
 *     if c_name[0] == c'x':             # <<<<<<<<<<<<<<
 *         c_name += 1
 *         is_hex = 1
 */
  __pyx_t_1 = (((__pyx_v_c_name[0]) == 'x') != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1557
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 *         c_name += 1             # <<<<<<<<<<<<<<
 *         is_hex = 1
 *     else:
 */
    __pyx_v_c_name = (__pyx_v_c_name + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1558
 *     if c_name[0] == c'x':
 *         c_name += 1
 *         is_hex = 1             # <<<<<<<<<<<<<<
 *     else:
 *         is_hex = 0
 */
    __pyx_v_is_hex = 1;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1560
 *         is_hex = 1
 *     else:
 *         is_hex = 0             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'\0':
 *         return 0
 */
    __pyx_v_is_hex = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1561
 *     else:
 *         is_hex = 0
 *     if c_name[0] == c'\0':             # <<<<<<<<<<<<<<
 *         return 0
 *     while c_name[0] != c'\0':
 */
  __pyx_t_1 = (((__pyx_v_c_name[0]) == '\x00') != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1562
 *         is_hex = 0
 *     if c_name[0] == c'\0':
 *         return 0             # <<<<<<<<<<<<<<
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1563
 *     if c_name[0] == c'\0':
 *         return 0
 *     while c_name[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_c_name[0]) != '\x00') != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1564
 *         return 0
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':             # <<<<<<<<<<<<<<
 *             if not is_hex:
 *                 return 0
 */
    __pyx_t_1 = (((__pyx_v_c_name[0]) < '0') != 0);
    if (!__pyx_t_1) {
      __pyx_t_2 = (((__pyx_v_c_name[0]) > '9') != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1565
 *     while c_name[0] != c'\0':
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):
 */
      __pyx_t_3 = ((!(__pyx_v_is_hex != 0)) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1566
 *         if c_name[0] < c'0' or c_name[0] > c'9':
 *             if not is_hex:
 *                 return 0             # <<<<<<<<<<<<<<
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):
 */
        __pyx_r = 0;
        goto __pyx_L0;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1567
 *             if not is_hex:
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):             # <<<<<<<<<<<<<<
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0
 */
      __pyx_t_3 = ('a' <= (__pyx_v_c_name[0]));
      if (__pyx_t_3) {
        __pyx_t_3 = ((__pyx_v_c_name[0]) <= 'f');
      }
      __pyx_t_1 = ((!(__pyx_t_3 != 0)) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1568
 *                 return 0
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):             # <<<<<<<<<<<<<<
 *                     return 0
 *         c_name += 1
 */
        __pyx_t_1 = ('A' <= (__pyx_v_c_name[0]));
        if (__pyx_t_1) {
          __pyx_t_1 = ((__pyx_v_c_name[0]) <= 'F');
        }
        __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1569
 *             if not (c'a' <= c_name[0] <= c'f'):
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0             # <<<<<<<<<<<<<<
 *         c_name += 1
 *     return 1
 */
          __pyx_r = 0;
          goto __pyx_L0;
        }
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1570
 *                 if not (c'A' <= c_name[0] <= c'F'):
 *                     return 0
 *         c_name += 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
    __pyx_v_c_name = (__pyx_v_c_name + 1);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1571
 *                     return 0
 *         c_name += 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1554
 *     return 1
 * 
 * cdef bint _characterReferenceIsValid(const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     cdef bint is_hex
 *     if c_name[0] == c'x':
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1573
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid tag name %r" %
 */

static int __pyx_f_4lxml_5etree__tagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tagValidOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1574
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(u"Invalid tag name %r" %
 *                          (<bytes>tag_utf).decode('utf8'))
 */
  __pyx_t_1 = ((!(__pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf) != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1576
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid tag name %r" %
 *                          (<bytes>tag_utf).decode('utf8'))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1575
 * cdef int _tagValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid tag name %r" %             # <<<<<<<<<<<<<<
 *                          (<bytes>tag_utf).decode('utf8'))
 *     return 0
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Invalid_tag_name_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1575; __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[4]; __pyx_lineno = 1575; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1577
 *         raise ValueError(u"Invalid tag name %r" %
 *                          (<bytes>tag_utf).decode('utf8'))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1573
 *     return 1
 * 
 * cdef int _tagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid tag name %r" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._tagValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1579
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid HTML tag name %r" %
 */

static int __pyx_f_4lxml_5etree__htmlTagValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_htmlTagValidOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1580
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(u"Invalid HTML tag name %r" %
 *                          (<bytes>tag_utf).decode('utf8'))
 */
  __pyx_t_1 = ((!(__pyx_f_4lxml_5etree__pyHtmlNameIsValid(__pyx_v_tag_utf) != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1582
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid HTML tag name %r" %
 *                          (<bytes>tag_utf).decode('utf8'))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1581
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid HTML tag name %r" %             # <<<<<<<<<<<<<<
 *                          (<bytes>tag_utf).decode('utf8'))
 *     return 0
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Invalid_HTML_tag_name_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1581; __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[4]; __pyx_lineno = 1581; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1583
 *         raise ValueError(u"Invalid HTML tag name %r" %
 *                          (<bytes>tag_utf).decode('utf8'))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1579
 *     return 0
 * 
 * cdef int _htmlTagValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyHtmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid HTML tag name %r" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._htmlTagValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1585
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(u"Invalid attribute name %r" %
 */

static int __pyx_f_4lxml_5etree__attributeValidOrRaise(PyObject *__pyx_v_name_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeValidOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1586
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(u"Invalid attribute name %r" %
 *                          (<bytes>name_utf).decode('utf8'))
 */
  __pyx_t_1 = ((!(__pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_name_utf) != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1588
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(u"Invalid attribute name %r" %
 *                          (<bytes>name_utf).decode('utf8'))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_name_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_decode_bytes(((PyObject*)__pyx_v_name_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1587
 * cdef int _attributeValidOrRaise(name_utf) except -1:
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(u"Invalid attribute name %r" %             # <<<<<<<<<<<<<<
 *                          (<bytes>name_utf).decode('utf8'))
 *     return 0
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Invalid_attribute_name_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1587; __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[4]; __pyx_lineno = 1587; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1589
 *         raise ValueError(u"Invalid attribute name %r" %
 *                          (<bytes>name_utf).decode('utf8'))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1585
 *     return 0
 * 
 * cdef int _attributeValidOrRaise(name_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(name_utf):
 *         raise ValueError(u"Invalid attribute name %r" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._attributeValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1591
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid namespace prefix %r" %
 */

static int __pyx_f_4lxml_5etree__prefixValidOrRaise(PyObject *__pyx_v_tag_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prefixValidOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1592
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):             # <<<<<<<<<<<<<<
 *         raise ValueError(u"Invalid namespace prefix %r" %
 *                          (<bytes>tag_utf).decode('utf8'))
 */
  __pyx_t_1 = ((!(__pyx_f_4lxml_5etree__pyXmlNameIsValid(__pyx_v_tag_utf) != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1594
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid namespace prefix %r" %
 *                          (<bytes>tag_utf).decode('utf8'))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(__pyx_v_tag_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1593
 * cdef int _prefixValidOrRaise(tag_utf) except -1:
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid namespace prefix %r" %             # <<<<<<<<<<<<<<
 *                          (<bytes>tag_utf).decode('utf8'))
 *     return 0
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Invalid_namespace_prefix_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1593; __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[4]; __pyx_lineno = 1593; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1595
 *         raise ValueError(u"Invalid namespace prefix %r" %
 *                          (<bytes>tag_utf).decode('utf8'))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1591
 *     return 0
 * 
 * cdef int _prefixValidOrRaise(tag_utf) except -1:             # <<<<<<<<<<<<<<
 *     if not _pyXmlNameIsValid(tag_utf):
 *         raise ValueError(u"Invalid namespace prefix %r" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._prefixValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1597
 *     return 0
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:             # <<<<<<<<<<<<<<
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
 */

static int __pyx_f_4lxml_5etree__uriValidOrRaise(PyObject *__pyx_v_uri_utf) {
  xmlURI *__pyx_v_c_uri;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_uriValidOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1598
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         raise ValueError(u"Invalid namespace URI %r" %
 */
  __pyx_v_c_uri = xmlParseURI(PyBytes_AS_STRING(__pyx_v_uri_utf));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1599
 * cdef int _uriValidOrRaise(uri_utf) except -1:
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError(u"Invalid namespace URI %r" %
 *                          (<bytes>uri_utf).decode('utf8'))
 */
  __pyx_t_1 = ((__pyx_v_c_uri == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1601
 *     if c_uri is NULL:
 *         raise ValueError(u"Invalid namespace URI %r" %
 *                          (<bytes>uri_utf).decode('utf8'))             # <<<<<<<<<<<<<<
 *     uri.xmlFreeURI(c_uri)
 *     return 0
 */
    if (unlikely(__pyx_v_uri_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_decode_bytes(((PyObject*)__pyx_v_uri_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1600
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
 *         raise ValueError(u"Invalid namespace URI %r" %             # <<<<<<<<<<<<<<
 *                          (<bytes>uri_utf).decode('utf8'))
 *     uri.xmlFreeURI(c_uri)
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Invalid_namespace_URI_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1600; __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[4]; __pyx_lineno = 1600; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1602
 *         raise ValueError(u"Invalid namespace URI %r" %
 *                          (<bytes>uri_utf).decode('utf8'))
 *     uri.xmlFreeURI(c_uri)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  xmlFreeURI(__pyx_v_c_uri);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1603
 *                          (<bytes>uri_utf).decode('utf8'))
 *     uri.xmlFreeURI(c_uri)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1597
 *     return 0
 * 
 * cdef int _uriValidOrRaise(uri_utf) except -1:             # <<<<<<<<<<<<<<
 *     cdef uri.xmlURI* c_uri = uri.xmlParseURI(_cstr(uri_utf))
 *     if c_uri is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._uriValidOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1605
 *     return 0
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__namespacedName(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_namespacedName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1606
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)             # <<<<<<<<<<<<<<
 * 
 * cdef object _namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(_getNs(__pyx_v_c_node), __pyx_v_c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1605
 *     return 0
 * 
 * cdef inline object _namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._namespacedName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1608
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
 * cdef object _namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     if href is NULL:
 *         return funicode(name)
 */

static PyObject *__pyx_f_4lxml_5etree__namespacedNameFromNsName(const xmlChar *__pyx_v_href, const xmlChar *__pyx_v_name) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_namespacedNameFromNsName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1609
 * 
 * cdef object _namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
 *     if href is NULL:             # <<<<<<<<<<<<<<
 *         return funicode(name)
 *     elif python.LXML_UNICODE_STRINGS and python.PY_VERSION_HEX >= 0x02060000:
 */
  __pyx_t_1 = ((__pyx_v_href == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1610
 * cdef object _namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
 *     if href is NULL:
 *         return funicode(name)             # <<<<<<<<<<<<<<
 *     elif python.LXML_UNICODE_STRINGS and python.PY_VERSION_HEX >= 0x02060000:
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1611
 *     if href is NULL:
 *         return funicode(name)
 *     elif python.LXML_UNICODE_STRINGS and python.PY_VERSION_HEX >= 0x02060000:             # <<<<<<<<<<<<<<
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)
 *     else:
 */
  if ((LXML_UNICODE_STRINGS != 0)) {
    __pyx_t_1 = ((PY_VERSION_HEX >= 0x02060000) != 0);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = (LXML_UNICODE_STRINGS != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1612
 *         return funicode(name)
 *     elif python.LXML_UNICODE_STRINGS and python.PY_VERSION_HEX >= 0x02060000:
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)             # <<<<<<<<<<<<<<
 *     else:
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyUnicode_FromFormat(__pyx_k_s_s_2, __pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1614
 *         return python.PyUnicode_FromFormat("{%s}%s", href, name)
 *     else:
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)             # <<<<<<<<<<<<<<
 *         if python.LXML_UNICODE_STRINGS or isutf8(_xcstr(s)):
 *             return (<bytes>s).decode('utf8')
 */
    __pyx_t_2 = PyBytes_FromFormat(__pyx_k_s_s_2, __pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_s = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1615
 *     else:
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)
 *         if python.LXML_UNICODE_STRINGS or isutf8(_xcstr(s)):             # <<<<<<<<<<<<<<
 *             return (<bytes>s).decode('utf8')
 *         else:
 */
    __pyx_t_3 = LXML_UNICODE_STRINGS;
    if (!__pyx_t_3) {
      __pyx_t_1 = (__pyx_f_4lxml_5etree_isutf8((const xmlChar*)PyBytes_AS_STRING(__pyx_v_s)) != 0);
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1616
 *         s = python.PyBytes_FromFormat("{%s}%s", href, name)
 *         if python.LXML_UNICODE_STRINGS or isutf8(_xcstr(s)):
 *             return (<bytes>s).decode('utf8')             # <<<<<<<<<<<<<<
 *         else:
 *             return s
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_v_s == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
        {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_decode_bytes(((PyObject*)__pyx_v_s), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1618
 *             return (<bytes>s).decode('utf8')
 *         else:
 *             return s             # <<<<<<<<<<<<<<
 * 
 * cdef _getFilenameForFile(source):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_s);
      __pyx_r = __pyx_v_s;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1608
 *     return _namespacedNameFromNsName(_getNs(c_node), c_node.name)
 * 
 * cdef object _namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     if href is NULL:
 *         return funicode(name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._namespacedNameFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1620
 *             return s
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     u"""Given a Python File or Gzip object, give filename back.
 * 
 */

static PyObject *__pyx_f_4lxml_5etree__getFilenameForFile(PyObject *__pyx_v_source) {
  PyObject *__pyx_v_filename = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getFilenameForFile", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1626
 *     """
 *     # urllib2 provides a geturl() method
 *     try:             # <<<<<<<<<<<<<<
 *         return source.geturl()
 *     except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1627
 *     # urllib2 provides a geturl() method
 *     try:
 *         return source.geturl()             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_geturl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1628
 *     try:
 *         return source.geturl()
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # file instances have a name attribute
 */
    /*except:*/ {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1631
 *         pass
 *     # file instances have a name attribute
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.name
 *         if _isString(filename):
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1632
 *     # file instances have a name attribute
 *     try:
 *         filename = source.name             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_filename = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1633
 *     try:
 *         filename = source.name
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      __pyx_t_6 = (_isString(__pyx_v_filename) != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1634
 *         filename = source.name
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_filename);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_filename);
        __Pyx_GIVEREF(__pyx_v_filename);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_os_path_abspath, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L15_try_return;
      }
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L18_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1635
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 */
    /*except:*/ {
      PyErr_Restore(0,0,0);
      goto __pyx_L12_exception_handled;
    }
    __pyx_L15_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L0;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L18_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1638
 *         pass
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:             # <<<<<<<<<<<<<<
 *         filename = source.filename
 *         if _isString(filename):
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1639
 *     # gzip file instances have a filename attribute (before Py3k)
 *     try:
 *         filename = source.filename             # <<<<<<<<<<<<<<
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_filename, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1640
 *     try:
 *         filename = source.filename
 *         if _isString(filename):             # <<<<<<<<<<<<<<
 *             return os_path_abspath(filename)
 *     except:
 */
      __pyx_t_6 = (_isString(__pyx_v_filename) != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1641
 *         filename = source.filename
 *         if _isString(filename):
 *             return os_path_abspath(filename)             # <<<<<<<<<<<<<<
 *     except:
 *         pass
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_filename);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
        __Pyx_GIVEREF(__pyx_v_filename);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_os_path_abspath, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L20_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_L24_try_return;
      }
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L27_try_end;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1642
 *         if _isString(filename):
 *             return os_path_abspath(filename)
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 *     # can't determine filename
 */
    /*except:*/ {
      PyErr_Restore(0,0,0);
      goto __pyx_L21_exception_handled;
    }
    __pyx_L24_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L21_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L27_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1645
 *         pass
 *     # can't determine filename
 *     return None             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1620
 *             return s
 * 
 * cdef _getFilenameForFile(source):             # <<<<<<<<<<<<<<
 *     u"""Given a Python File or Gzip object, give filename back.
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":8
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     u"""clear_error_log()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_2clear_error_log[] = "clear_error_log()\n\n    Clear the global error log.  Note that this log is already bound to a\n    fixed size.\n\n    Note: since lxml 2.2, the global error log is local to a thread\n    and this function will only clear the global error log of the\n    current thread.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_3clear_error_log = {__Pyx_NAMESTR("clear_error_log"), (PyCFunction)__pyx_pw_4lxml_5etree_3clear_error_log, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_2clear_error_log)};
static PyObject *__pyx_pw_4lxml_5etree_3clear_error_log(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_error_log (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_2clear_error_log(__pyx_self);

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":18
 *     current thread.
 *     """
 *     _getGlobalErrorLog().clear()             # <<<<<<<<<<<<<<
 * 
 * # dummy function: no debug output at all
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_clear); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":8
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     u"""clear_error_log()
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":21
 * 
 * # dummy function: no debug output at all
 * cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) nogil:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

static void __pyx_f_4lxml_5etree__nullGenericErrorFunc(CYTHON_UNUSED void *__pyx_v_ctxt, CYTHON_UNUSED char *__pyx_v_msg, ...) {

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":26
 * # setup for global log:
 * 
 * cdef void _initThreadLogging():             # <<<<<<<<<<<<<<
 *     # disable generic error lines from libxml2
 *     xmlerror.xmlSetGenericErrorFunc(NULL, <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc)
 */

static void __pyx_f_4lxml_5etree__initThreadLogging(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initThreadLogging", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":28
 * cdef void _initThreadLogging():
 *     # disable generic error lines from libxml2
 *     xmlerror.xmlSetGenericErrorFunc(NULL, <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc)             # <<<<<<<<<<<<<<
 * 
 *     # divert error messages to the global error log
 */
  xmlSetGenericErrorFunc(NULL, ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__nullGenericErrorFunc));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":31
 * 
 *     # divert error messages to the global error log
 *     connectErrorLog(NULL)             # <<<<<<<<<<<<<<
 * 
 * cdef void connectErrorLog(void* log):
 */
  __pyx_f_4lxml_5etree_connectErrorLog(NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":26
 * # setup for global log:
 * 
 * cdef void _initThreadLogging():             # <<<<<<<<<<<<<<
 *     # disable generic error lines from libxml2
 *     xmlerror.xmlSetGenericErrorFunc(NULL, <xmlerror.xmlGenericErrorFunc>_nullGenericErrorFunc)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":33
 *     connectErrorLog(NULL)
 * 
 * cdef void connectErrorLog(void* log):             # <<<<<<<<<<<<<<
 *     xslt.xsltSetGenericErrorFunc(log, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 * 
 */

static void __pyx_f_4lxml_5etree_connectErrorLog(void *__pyx_v_log) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connectErrorLog", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":34
 * 
 * cdef void connectErrorLog(void* log):
 *     xslt.xsltSetGenericErrorFunc(log, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)             # <<<<<<<<<<<<<<
 * 
 * # Logging classes
 */
  xsltSetGenericErrorFunc(__pyx_v_log, ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":33
 *     connectErrorLog(NULL)
 * 
 * cdef void connectErrorLog(void* log):             # <<<<<<<<<<<<<<
 *     xslt.xsltSetGenericErrorFunc(log, <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":63
 *     cdef xmlChar* _c_filename
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_9_LogEntry___dealloc__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_9_LogEntry___dealloc__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":64
 * 
 *     def __dealloc__(self):
 *         tree.xmlFree(self._c_message)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_filename)
 * 
 */
  xmlFree(__pyx_v_self->_c_message);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":65
 *     def __dealloc__(self):
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  xmlFree(__pyx_v_self->_c_filename);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":63
 *     cdef xmlChar* _c_filename
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFree(self._c_message)
 *         tree.xmlFree(self._c_filename)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":68
 * 
 *     @cython.final
 *     cdef _setError(self, xmlerror.xmlError* error):             # <<<<<<<<<<<<<<
 *         self.domain   = error.domain
 *         self.type     = error.code
 */

static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setError(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, xmlError *__pyx_v_error) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setError", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":69
 *     @cython.final
 *     cdef _setError(self, xmlerror.xmlError* error):
 *         self.domain   = error.domain             # <<<<<<<<<<<<<<
 *         self.type     = error.code
 *         self.level    = <int>error.level
 */
  __pyx_t_1 = __pyx_v_error->domain;
  __pyx_v_self->domain = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":70
 *     cdef _setError(self, xmlerror.xmlError* error):
 *         self.domain   = error.domain
 *         self.type     = error.code             # <<<<<<<<<<<<<<
 *         self.level    = <int>error.level
 *         self.line     = error.line
 */
  __pyx_t_1 = __pyx_v_error->code;
  __pyx_v_self->type = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":71
 *         self.domain   = error.domain
 *         self.type     = error.code
 *         self.level    = <int>error.level             # <<<<<<<<<<<<<<
 *         self.line     = error.line
 *         self.column   = error.int2
 */
  __pyx_v_self->level = ((int)__pyx_v_error->level);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":72
 *         self.type     = error.code
 *         self.level    = <int>error.level
 *         self.line     = error.line             # <<<<<<<<<<<<<<
 *         self.column   = error.int2
 *         self._c_message = NULL
 */
  __pyx_t_1 = __pyx_v_error->line;
  __pyx_v_self->line = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":73
 *         self.level    = <int>error.level
 *         self.line     = error.line
 *         self.column   = error.int2             # <<<<<<<<<<<<<<
 *         self._c_message = NULL
 *         self._c_filename = NULL
 */
  __pyx_t_1 = __pyx_v_error->int2;
  __pyx_v_self->column = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":74
 *         self.line     = error.line
 *         self.column   = error.int2
 *         self._c_message = NULL             # <<<<<<<<<<<<<<
 *         self._c_filename = NULL
 *         if error.message is NULL or error.message[0] in b'\n\0':
 */
  __pyx_v_self->_c_message = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":75
 *         self.column   = error.int2
 *         self._c_message = NULL
 *         self._c_filename = NULL             # <<<<<<<<<<<<<<
 *         if error.message is NULL or error.message[0] in b'\n\0':
 *             self._message = u"unknown error"
 */
  __pyx_v_self->_c_filename = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":76
 *         self._c_message = NULL
 *         self._c_filename = NULL
 *         if error.message is NULL or error.message[0] in b'\n\0':             # <<<<<<<<<<<<<<
 *             self._message = u"unknown error"
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_error->message == NULL) != 0);
  if (!__pyx_t_2) {
    switch ((__pyx_v_error->message[0])) {
      case '\x00':
      case '\n':
      __pyx_t_3 = 1;
      break;
      default:
      __pyx_t_3 = 0;
      break;
    }
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_3 = __pyx_t_4;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":77
 *         self._c_filename = NULL
 *         if error.message is NULL or error.message[0] in b'\n\0':
 *             self._message = u"unknown error"             # <<<<<<<<<<<<<<
 *         else:
 *             self._message = None
 */
    __Pyx_INCREF(__pyx_kp_u_unknown_error);
    __Pyx_GIVEREF(__pyx_kp_u_unknown_error);
    __Pyx_GOTREF(__pyx_v_self->_message);
    __Pyx_DECREF(__pyx_v_self->_message);
    __pyx_v_self->_message = __pyx_kp_u_unknown_error;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":79
 *             self._message = u"unknown error"
 *         else:
 *             self._message = None             # <<<<<<<<<<<<<<
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_message);
    __Pyx_DECREF(__pyx_v_self->_message);
    __pyx_v_self->_message = Py_None;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":80
 *         else:
 *             self._message = None
 *             self._c_message = <char*> tree.xmlStrdup(             # <<<<<<<<<<<<<<
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:
 */
    __pyx_v_self->_c_message = ((char *)xmlStrdup(((const xmlChar *)__pyx_v_error->message)));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":82
 *             self._c_message = <char*> tree.xmlStrdup(
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         if error.file is NULL:
 */
    __pyx_t_3 = ((!(__pyx_v_self->_c_message != 0)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":83
 *                 <const_xmlChar*> error.message)
 *             if not self._c_message:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         if error.file is NULL:
 *             self._filename = u'<string>'
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":84
 *             if not self._c_message:
 *                 raise MemoryError()
 *         if error.file is NULL:             # <<<<<<<<<<<<<<
 *             self._filename = u'<string>'
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_error->file == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":85
 *                 raise MemoryError()
 *         if error.file is NULL:
 *             self._filename = u'<string>'             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = None
 */
    __Pyx_INCREF(__pyx_kp_u_string);
    __Pyx_GIVEREF(__pyx_kp_u_string);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_kp_u_string;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":87
 *             self._filename = u'<string>'
 *         else:
 *             self._filename = None             # <<<<<<<<<<<<<<
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = Py_None;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":88
 *         else:
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)             # <<<<<<<<<<<<<<
 *             if not self._c_filename:
 *                 raise MemoryError()
 */
    __pyx_v_self->_c_filename = xmlStrdup(((const xmlChar *)__pyx_v_error->file));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":89
 *             self._filename = None
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 * 
 */
    __pyx_t_3 = ((!(__pyx_v_self->_c_filename != 0)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":90
 *             self._c_filename = tree.xmlStrdup(<const_xmlChar*> error.file)
 *             if not self._c_filename:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":68
 * 
 *     @cython.final
 *     cdef _setError(self, xmlerror.xmlError* error):             # <<<<<<<<<<<<<<
 *         self.domain   = error.domain
 *         self.type     = error.code
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._LogEntry._setError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":93
 * 
 *     @cython.final
 *     cdef _setGeneric(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                      message, filename):
 *         self.domain  = domain
 */

static PyObject *__pyx_f_4lxml_5etree_9_LogEntry__setGeneric(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setGeneric", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":95
 *     cdef _setGeneric(self, int domain, int type, int level, int line,
 *                      message, filename):
 *         self.domain  = domain             # <<<<<<<<<<<<<<
 *         self.type    = type
 *         self.level   = level
 */
  __pyx_v_self->domain = __pyx_v_domain;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":96
 *                      message, filename):
 *         self.domain  = domain
 *         self.type    = type             # <<<<<<<<<<<<<<
 *         self.level   = level
 *         self.line    = line
 */
  __pyx_v_self->type = __pyx_v_type;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":97
 *         self.domain  = domain
 *         self.type    = type
 *         self.level   = level             # <<<<<<<<<<<<<<
 *         self.line    = line
 *         self.column  = 0
 */
  __pyx_v_self->level = __pyx_v_level;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":98
 *         self.type    = type
 *         self.level   = level
 *         self.line    = line             # <<<<<<<<<<<<<<
 *         self.column  = 0
 *         self._message = message
 */
  __pyx_v_self->line = __pyx_v_line;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":99
 *         self.level   = level
 *         self.line    = line
 *         self.column  = 0             # <<<<<<<<<<<<<<
 *         self._message = message
 *         self._filename = filename
 */
  __pyx_v_self->column = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":100
 *         self.line    = line
 *         self.column  = 0
 *         self._message = message             # <<<<<<<<<<<<<<
 *         self._filename = filename
 * 
 */
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  __Pyx_GOTREF(__pyx_v_self->_message);
  __Pyx_DECREF(__pyx_v_self->_message);
  __pyx_v_self->_message = __pyx_v_message;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":101
 *         self.column  = 0
 *         self._message = message
 *         self._filename = filename             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(__pyx_v_self->_filename);
  __Pyx_DECREF(__pyx_v_self->_filename);
  __pyx_v_self->_filename = __pyx_v_filename;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":93
 * 
 *     @cython.final
 *     cdef _setGeneric(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                      message, filename):
 *         self.domain  = domain
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":103
 *         self._filename = filename
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_2__repr__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_2__repr__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":104
 * 
 *     def __repr__(self):
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (             # <<<<<<<<<<<<<<
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":105
 *     def __repr__(self):
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,             # <<<<<<<<<<<<<<
 *             self.domain_name, self.type_name, self.message)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->column); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_level_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":106
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)             # <<<<<<<<<<<<<<
 * 
 *     property domain_name:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_domain_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":105
 *     def __repr__(self):
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,             # <<<<<<<<<<<<<<
 *             self.domain_name, self.type_name, self.message)
 * 
 */
  __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":104
 * 
 *     def __repr__(self):
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (             # <<<<<<<<<<<<<<
 *             self.filename, self.line, self.column, self.level_name,
 *             self.domain_name, self.type_name, self.message)
 */
  __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_s_d_d_s_s_s_s, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":103
 *         self._filename = filename
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"%s:%d:%d:%s:%s:%s: %s" % (
 *             self.filename, self.line, self.column, self.level_name,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._LogEntry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":111
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ErrorDomains._getName(self.domain, u"unknown")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_11domain_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_11domain_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_11domain_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":112
 *         """
 *         def __get__(self):
 *             return ErrorDomains._getName(self.domain, u"unknown")             # <<<<<<<<<<<<<<
 * 
 *     property type_name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorDomains); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __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_PyInt_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __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[1]; __pyx_lineno = 112; __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(__pyx_n_u_unknown);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_unknown);
  __Pyx_GIVEREF(__pyx_n_u_unknown);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":111
 *         """The name of the error domain.  See lxml.etree.ErrorDomains
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ErrorDomains._getName(self.domain, u"unknown")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.domain_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":117
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self.domain == ErrorDomains.RELAXNGV:
 *                 getName = RelaxNGErrorTypes._getName
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_9type_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_9type_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_9type_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_v_getName = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":118
 *         """
 *         def __get__(self):
 *             if self.domain == ErrorDomains.RELAXNGV:             # <<<<<<<<<<<<<<
 *                 getName = RelaxNGErrorTypes._getName
 *             else:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorDomains); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RELAXNGV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __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_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":119
 *         def __get__(self):
 *             if self.domain == ErrorDomains.RELAXNGV:
 *                 getName = RelaxNGErrorTypes._getName             # <<<<<<<<<<<<<<
 *             else:
 *                 getName = ErrorTypes._getName
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGErrorTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getName); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_getName = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":121
 *                 getName = RelaxNGErrorTypes._getName
 *             else:
 *                 getName = ErrorTypes._getName             # <<<<<<<<<<<<<<
 *             return getName(self.type, u"unknown")
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_getName = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":122
 *             else:
 *                 getName = ErrorTypes._getName
 *             return getName(self.type, u"unknown")             # <<<<<<<<<<<<<<
 * 
 *     property level_name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __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[1]; __pyx_lineno = 122; __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_n_u_unknown);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_unknown);
  __Pyx_GIVEREF(__pyx_n_u_unknown);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_getName, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":117
 *         """The name of the error type.  See lxml.etree.ErrorTypes
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self.domain == ErrorDomains.RELAXNGV:
 *                 getName = RelaxNGErrorTypes._getName
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.type_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_getName);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":127
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ErrorLevels._getName(self.level, u"unknown")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_10level_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_10level_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_10level_name___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":128
 *         """
 *         def __get__(self):
 *             return ErrorLevels._getName(self.level, u"unknown")             # <<<<<<<<<<<<<<
 * 
 *     property message:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __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_PyInt_From_int(__pyx_v_self->level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __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[1]; __pyx_lineno = 128; __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(__pyx_n_u_unknown);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_unknown);
  __Pyx_GIVEREF(__pyx_n_u_unknown);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":127
 *         """The name of the error level.  See lxml.etree.ErrorLevels
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ErrorLevels._getName(self.level, u"unknown")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.level_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":131
 * 
 *     property message:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef size_t size
 *             if self._message is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_7message_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_7message_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_7message___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  size_t __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":133
 *         def __get__(self):
 *             cdef size_t size
 *             if self._message is not None:             # <<<<<<<<<<<<<<
 *                 return self._message
 *             if self._c_message is NULL:
 */
  __pyx_t_1 = (__pyx_v_self->_message != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":134
 *             cdef size_t size
 *             if self._message is not None:
 *                 return self._message             # <<<<<<<<<<<<<<
 *             if self._c_message is NULL:
 *                 return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_message);
    __pyx_r = __pyx_v_self->_message;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":135
 *             if self._message is not None:
 *                 return self._message
 *             if self._c_message is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             size = cstring_h.strlen(self._c_message)
 */
  __pyx_t_2 = ((__pyx_v_self->_c_message == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":136
 *                 return self._message
 *             if self._c_message is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             size = cstring_h.strlen(self._c_message)
 *             if size > 0 and self._c_message[size-1] == '\n':
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":137
 *             if self._c_message is NULL:
 *                 return None
 *             size = cstring_h.strlen(self._c_message)             # <<<<<<<<<<<<<<
 *             if size > 0 and self._c_message[size-1] == '\n':
 *                 size -= 1  # strip EOL
 */
  __pyx_v_size = strlen(__pyx_v_self->_c_message);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":138
 *                 return None
 *             size = cstring_h.strlen(self._c_message)
 *             if size > 0 and self._c_message[size-1] == '\n':             # <<<<<<<<<<<<<<
 *                 size -= 1  # strip EOL
 *             # cannot use funicode() here because the message may contain
 */
  __pyx_t_2 = ((__pyx_v_size > 0) != 0);
  if (__pyx_t_2) {
    __pyx_t_1 = (((__pyx_v_self->_c_message[(__pyx_v_size - 1)]) == '\n') != 0);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":139
 *             size = cstring_h.strlen(self._c_message)
 *             if size > 0 and self._c_message[size-1] == '\n':
 *                 size -= 1  # strip EOL             # <<<<<<<<<<<<<<
 *             # cannot use funicode() here because the message may contain
 *             # byte encoded file paths etc.
 */
    __pyx_v_size = (__pyx_v_size - 1);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":142
 *             # cannot use funicode() here because the message may contain
 *             # byte encoded file paths etc.
 *             try:             # <<<<<<<<<<<<<<
 *                 self._message = self._c_message[:size].decode('utf8')
 *             except UnicodeDecodeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":143
 *             # byte encoded file paths etc.
 *             try:
 *                 self._message = self._c_message[:size].decode('utf8')             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 try:
 */
      __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_self->_c_message, 0, __pyx_v_size, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_v_self->_message);
      __Pyx_DECREF(__pyx_v_self->_message);
      __pyx_v_self->_message = __pyx_t_7;
      __pyx_t_7 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":144
 *             try:
 *                 self._message = self._c_message[:size].decode('utf8')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.message = self._c_message[:size].decode(
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":145
 *                 self._message = self._c_message[:size].decode('utf8')
 *             except UnicodeDecodeError:
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.message = self._c_message[:size].decode(
 *                         'ascii', 'backslashreplace')
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":146
 *             except UnicodeDecodeError:
 *                 try:
 *                     self.message = self._c_message[:size].decode(             # <<<<<<<<<<<<<<
 *                         'ascii', 'backslashreplace')
 *                 except UnicodeDecodeError:
 */
          __pyx_t_14 = __Pyx_decode_c_string(__pyx_v_self->_c_message, 0, __pyx_v_size, NULL, __pyx_k_backslashreplace, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_14);
          if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L23_try_end;
        __pyx_L16_error:;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":148
 *                     self.message = self._c_message[:size].decode(
 *                         'ascii', 'backslashreplace')
 *                 except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                     self._message = u'<undecodable error message>'
 *             if self._c_message:
 */
        __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_8) {
          __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GOTREF(__pyx_t_16);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":149
 *                         'ascii', 'backslashreplace')
 *                 except UnicodeDecodeError:
 *                     self._message = u'<undecodable error message>'             # <<<<<<<<<<<<<<
 *             if self._c_message:
 *                 # clean up early
 */
          __Pyx_INCREF(__pyx_kp_u_undecodable_error_message);
          __Pyx_GIVEREF(__pyx_kp_u_undecodable_error_message);
          __Pyx_GOTREF(__pyx_v_self->_message);
          __Pyx_DECREF(__pyx_v_self->_message);
          __pyx_v_self->_message = __pyx_kp_u_undecodable_error_message;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          goto __pyx_L17_exception_handled;
        }
        goto __pyx_L18_except_error;
        __pyx_L18_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        goto __pyx_L8_except_error;
        __pyx_L17_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        __pyx_L23_try_end:;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_exception_handled;
    }
    goto __pyx_L8_except_error;
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L13_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":150
 *                 except UnicodeDecodeError:
 *                     self._message = u'<undecodable error message>'
 *             if self._c_message:             # <<<<<<<<<<<<<<
 *                 # clean up early
 *                 tree.xmlFree(self._c_message)
 */
  __pyx_t_3 = (__pyx_v_self->_c_message != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":152
 *             if self._c_message:
 *                 # clean up early
 *                 tree.xmlFree(self._c_message)             # <<<<<<<<<<<<<<
 *                 self._c_message = NULL
 *             return self._message
 */
    xmlFree(__pyx_v_self->_c_message);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":153
 *                 # clean up early
 *                 tree.xmlFree(self._c_message)
 *                 self._c_message = NULL             # <<<<<<<<<<<<<<
 *             return self._message
 * 
 */
    __pyx_v_self->_c_message = NULL;
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":154
 *                 tree.xmlFree(self._c_message)
 *                 self._c_message = NULL
 *             return self._message             # <<<<<<<<<<<<<<
 * 
 *     property filename:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_message);
  __pyx_r = __pyx_v_self->_message;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":131
 * 
 *     property message:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef size_t size
 *             if self._message is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._LogEntry.message.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":157
 * 
 *     property filename:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._filename is None:
 *                 if self._c_filename is not NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_8filename_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_8filename___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":158
 *     property filename:
 *         def __get__(self):
 *             if self._filename is None:             # <<<<<<<<<<<<<<
 *                 if self._c_filename is not NULL:
 *                     self._filename = _decodeFilename(self._c_filename)
 */
  __pyx_t_1 = (__pyx_v_self->_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":159
 *         def __get__(self):
 *             if self._filename is None:
 *                 if self._c_filename is not NULL:             # <<<<<<<<<<<<<<
 *                     self._filename = _decodeFilename(self._c_filename)
 *                     # clean up early
 */
    __pyx_t_2 = ((__pyx_v_self->_c_filename != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":160
 *             if self._filename is None:
 *                 if self._c_filename is not NULL:
 *                     self._filename = _decodeFilename(self._c_filename)             # <<<<<<<<<<<<<<
 *                     # clean up early
 *                     tree.xmlFree(self._c_filename)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_c_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->_filename);
      __Pyx_DECREF(__pyx_v_self->_filename);
      __pyx_v_self->_filename = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":162
 *                     self._filename = _decodeFilename(self._c_filename)
 *                     # clean up early
 *                     tree.xmlFree(self._c_filename)             # <<<<<<<<<<<<<<
 *                     self._c_filename = NULL
 *             return self._filename
 */
      xmlFree(__pyx_v_self->_c_filename);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":163
 *                     # clean up early
 *                     tree.xmlFree(self._c_filename)
 *                     self._c_filename = NULL             # <<<<<<<<<<<<<<
 *             return self._filename
 * 
 */
      __pyx_v_self->_c_filename = NULL;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":164
 *                     tree.xmlFree(self._c_filename)
 *                     self._c_filename = NULL
 *             return self._filename             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_filename);
  __pyx_r = __pyx_v_self->_filename;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":157
 * 
 *     property filename:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._filename is None:
 *                 if self._c_filename is not NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._LogEntry.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":53
 *     - filename: the name of the file in which the message originated (if applicable)
 *     """
 *     cdef readonly int domain             # <<<<<<<<<<<<<<
 *     cdef readonly int type
 *     cdef readonly int level
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6domain_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6domain_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6domain___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.domain.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":54
 *     """
 *     cdef readonly int domain
 *     cdef readonly int type             # <<<<<<<<<<<<<<
 *     cdef readonly int level
 *     cdef readonly int line
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4type___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":55
 *     cdef readonly int domain
 *     cdef readonly int type
 *     cdef readonly int level             # <<<<<<<<<<<<<<
 *     cdef readonly int line
 *     cdef readonly int column
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_5level_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_5level_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_5level___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.level.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":56
 *     cdef readonly int type
 *     cdef readonly int level
 *     cdef readonly int line             # <<<<<<<<<<<<<<
 *     cdef readonly int column
 *     cdef object _message
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4line_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_4line_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_4line___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.line.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":57
 *     cdef readonly int level
 *     cdef readonly int line
 *     cdef readonly int column             # <<<<<<<<<<<<<<
 *     cdef object _message
 *     cdef object _filename
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6column_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_LogEntry_6column_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_LogEntry_6column___get__(struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->column); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._LogEntry.column.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":170
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):             # <<<<<<<<<<<<<<
 *         self._first_error = first_error
 *         self.last_error = last_error
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_first_error = 0;
  PyObject *__pyx_v_last_error = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_first_error,&__pyx_n_s_last_error,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_first_error)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_last_error)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_first_error = values[0];
    __pyx_v_last_error = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_first_error, __pyx_v_last_error);

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

static int __pyx_pf_4lxml_5etree_13_BaseErrorLog___init__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":171
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error             # <<<<<<<<<<<<<<
 *         self.last_error = last_error
 * 
 */
  if (!(likely(((__pyx_v_first_error) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_first_error, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_first_error;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_first_error);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_first_error));
  __pyx_v_self->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":172
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error
 *         self.last_error = last_error             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
 */
  __Pyx_INCREF(__pyx_v_last_error);
  __Pyx_GIVEREF(__pyx_v_last_error);
  __Pyx_GOTREF(__pyx_v_self->last_error);
  __Pyx_DECREF(__pyx_v_self->last_error);
  __pyx_v_self->last_error = __pyx_v_last_error;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":170
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error
 *     def __init__(self, first_error, last_error):             # <<<<<<<<<<<<<<
 *         self._first_error = first_error
 *         self.last_error = last_error
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":174
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":175
 * 
 *     cpdef copy(self):
 *         return _BaseErrorLog(self._first_error, self.last_error)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_first_error));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->_first_error));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_first_error));
  __Pyx_INCREF(__pyx_v_self->last_error);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->last_error);
  __Pyx_GIVEREF(__pyx_v_self->last_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":174
 *         self.last_error = last_error
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_2copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_2copy(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_vtab)->copy(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":177
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u''
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_4__repr__(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_4__repr__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":178
 * 
 *     def __repr__(self):
 *         return u''             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_u__15);
  __pyx_r = __pyx_kp_u__15;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":177
 *         return _BaseErrorLog(self._first_error, self.last_error)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u''
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":180
 *         return u''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog_receive(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":181
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         pass             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":180
 *         return u''
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_entry));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_6receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_vtab)->receive(__pyx_v_self, __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":184
 * 
 *     @cython.final
 *     cdef void _receive(self, xmlerror.xmlError* error):             # <<<<<<<<<<<<<<
 *         cdef bint is_error
 *         cdef _LogEntry entry
 */

static void __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, xmlError *__pyx_v_error) {
  int __pyx_v_is_error;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_global_log = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_receive", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":188
 *         cdef _LogEntry entry
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)             # <<<<<<<<<<<<<<
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 */
  __pyx_t_1 = __pyx_tp_new_4lxml_5etree__LogEntry(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__LogEntry)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__LogEntry)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":189
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)             # <<<<<<<<<<<<<<
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_LogEntry__setError(__pyx_v_entry, __pyx_v_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":190
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 */
  switch (__pyx_v_error->level) {
    case XML_ERR_ERROR:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":191
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 */
    case XML_ERR_FATAL:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":190
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setError(error)
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 */
    __pyx_t_2 = 1;
    break;
    default:
    __pyx_t_2 = 0;
    break;
  }
  __pyx_v_is_error = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":192
 *         is_error = error.level == xmlerror.XML_ERR_ERROR or \
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":193
 *                    error.level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  __pyx_t_2 = (__pyx_v_global_log != __pyx_v_self);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":194
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 *             global_log.receive(entry)             # <<<<<<<<<<<<<<
 *             if is_error:
 *                 global_log.last_error = entry
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_global_log->__pyx_vtab)->receive(__pyx_v_global_log, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":195
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    __pyx_t_3 = (__pyx_v_is_error != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":196
 *             global_log.receive(entry)
 *             if is_error:
 *                 global_log.last_error = entry             # <<<<<<<<<<<<<<
 *         self.receive(entry)
 *         if is_error:
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __Pyx_GOTREF(__pyx_v_global_log->last_error);
      __Pyx_DECREF(__pyx_v_global_log->last_error);
      __pyx_v_global_log->last_error = ((PyObject *)__pyx_v_entry);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":197
 *             if is_error:
 *                 global_log.last_error = entry
 *         self.receive(entry)             # <<<<<<<<<<<<<<
 *         if is_error:
 *             self.last_error = entry
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_vtab)->receive(__pyx_v_self, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":198
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  __pyx_t_3 = (__pyx_v_is_error != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":199
 *         self.receive(entry)
 *         if is_error:
 *             self.last_error = entry             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __Pyx_GOTREF(__pyx_v_self->last_error);
    __Pyx_DECREF(__pyx_v_self->last_error);
    __pyx_v_self->last_error = ((PyObject *)__pyx_v_entry);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":184
 * 
 *     @cython.final
 *     cdef void _receive(self, xmlerror.xmlError* error):             # <<<<<<<<<<<<<<
 *         cdef bint is_error
 *         cdef _LogEntry entry
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._BaseErrorLog._receive", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF((PyObject *)__pyx_v_global_log);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":202
 * 
 *     @cython.final
 *     cdef void _receiveGeneric(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         cdef bint is_error
 */

static void __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  int __pyx_v_is_error;
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_global_log = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_receiveGeneric", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":207
 *         cdef _LogEntry entry
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)             # <<<<<<<<<<<<<<
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 */
  __pyx_t_1 = __pyx_tp_new_4lxml_5etree__LogEntry(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__LogEntry)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__LogEntry)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_entry = ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":208
 *         cdef _BaseErrorLog global_log
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setGeneric(domain, type, level, line, message, filename)             # <<<<<<<<<<<<<<
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_LogEntry__setGeneric(__pyx_v_entry, __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":209
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 */
  switch (__pyx_v_level) {
    case XML_ERR_ERROR:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":210
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL             # <<<<<<<<<<<<<<
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 */
    case XML_ERR_FATAL:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":209
 *         entry = _LogEntry.__new__(_LogEntry)
 *         entry._setGeneric(domain, type, level, line, message, filename)
 *         is_error = level == xmlerror.XML_ERR_ERROR or \             # <<<<<<<<<<<<<<
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 */
    __pyx_t_2 = 1;
    break;
    default:
    __pyx_t_2 = 0;
    break;
  }
  __pyx_v_is_error = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":211
 *         is_error = level == xmlerror.XML_ERR_ERROR or \
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()             # <<<<<<<<<<<<<<
 *         if global_log is not self:
 *             global_log.receive(entry)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_global_log = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":212
 *                    level == xmlerror.XML_ERR_FATAL
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:             # <<<<<<<<<<<<<<
 *             global_log.receive(entry)
 *             if is_error:
 */
  __pyx_t_2 = (__pyx_v_global_log != __pyx_v_self);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":213
 *         global_log = _getGlobalErrorLog()
 *         if global_log is not self:
 *             global_log.receive(entry)             # <<<<<<<<<<<<<<
 *             if is_error:
 *                 global_log.last_error = entry
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_global_log->__pyx_vtab)->receive(__pyx_v_global_log, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":214
 *         if global_log is not self:
 *             global_log.receive(entry)
 *             if is_error:             # <<<<<<<<<<<<<<
 *                 global_log.last_error = entry
 *         self.receive(entry)
 */
    __pyx_t_3 = (__pyx_v_is_error != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":215
 *             global_log.receive(entry)
 *             if is_error:
 *                 global_log.last_error = entry             # <<<<<<<<<<<<<<
 *         self.receive(entry)
 *         if is_error:
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __Pyx_GOTREF(__pyx_v_global_log->last_error);
      __Pyx_DECREF(__pyx_v_global_log->last_error);
      __pyx_v_global_log->last_error = ((PyObject *)__pyx_v_entry);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":216
 *             if is_error:
 *                 global_log.last_error = entry
 *         self.receive(entry)             # <<<<<<<<<<<<<<
 *         if is_error:
 *             self.last_error = entry
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_vtab)->receive(__pyx_v_self, __pyx_v_entry, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":217
 *                 global_log.last_error = entry
 *         self.receive(entry)
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.last_error = entry
 * 
 */
  __pyx_t_3 = (__pyx_v_is_error != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":218
 *         self.receive(entry)
 *         if is_error:
 *             self.last_error = entry             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __Pyx_GOTREF(__pyx_v_self->last_error);
    __Pyx_DECREF(__pyx_v_self->last_error);
    __pyx_v_self->last_error = ((PyObject *)__pyx_v_entry);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":202
 * 
 *     @cython.final
 *     cdef void _receiveGeneric(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         cdef bint is_error
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._BaseErrorLog._receiveGeneric", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF((PyObject *)__pyx_v_global_log);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":221
 * 
 *     @cython.final
 *     cdef _buildParseException(self, exctype, default_message):             # <<<<<<<<<<<<<<
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:
 */

static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_exctype, PyObject *__pyx_v_default_message) {
  int __pyx_v_code;
  PyObject *__pyx_v_message = NULL;
  int __pyx_v_line;
  int __pyx_v_column;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildParseException", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":222
 *     @cython.final
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)
 */
  __pyx_v_code = XML_ERR_INTERNAL_ERROR;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":223
 *     cdef _buildParseException(self, exctype, default_message):
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_first_error) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":224
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)             # <<<<<<<<<<<<<<
 *         message = self._first_error.message
 *         if message:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_default_message);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_default_message);
    __Pyx_GIVEREF(__pyx_v_default_message);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_exctype, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":225
 *         if self._first_error is None:
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message             # <<<<<<<<<<<<<<
 *         if message:
 *             code = self._first_error.type
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_message = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":226
 *             return exctype(default_message, code, 0, 0)
 *         message = self._first_error.message
 *         if message:             # <<<<<<<<<<<<<<
 *             code = self._first_error.type
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_message); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":227
 *         message = self._first_error.message
 *         if message:
 *             code = self._first_error.type             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
 */
    __pyx_t_5 = __pyx_v_self->_first_error->type;
    __pyx_v_code = __pyx_t_5;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":229
 *             code = self._first_error.type
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         line = self._first_error.line
 *         column = self._first_error.column
 */
    __Pyx_INCREF(__pyx_v_default_message);
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_v_default_message);
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":230
 *         else:
 *             message = default_message
 *         line = self._first_error.line             # <<<<<<<<<<<<<<
 *         column = self._first_error.column
 *         if line > 0:
 */
  __pyx_t_5 = __pyx_v_self->_first_error->line;
  __pyx_v_line = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":231
 *             message = default_message
 *         line = self._first_error.line
 *         column = self._first_error.column             # <<<<<<<<<<<<<<
 *         if line > 0:
 *             if column > 0:
 */
  __pyx_t_5 = __pyx_v_self->_first_error->column;
  __pyx_v_column = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":232
 *         line = self._first_error.line
 *         column = self._first_error.column
 *         if line > 0:             # <<<<<<<<<<<<<<
 *             if column > 0:
 *                 message = u"%s, line %d, column %d" % (message, line, column)
 */
  __pyx_t_2 = ((__pyx_v_line > 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":233
 *         column = self._first_error.column
 *         if line > 0:
 *             if column > 0:             # <<<<<<<<<<<<<<
 *                 message = u"%s, line %d, column %d" % (message, line, column)
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_column > 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":234
 *         if line > 0:
 *             if column > 0:
 *                 message = u"%s, line %d, column %d" % (message, line, column)             # <<<<<<<<<<<<<<
 *             else:
 *                 message = u"%s, line %d" % (message, line)
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_column); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_line_d_column_d, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":236
 *                 message = u"%s, line %d, column %d" % (message, line, column)
 *             else:
 *                 message = u"%s, line %d" % (message, line)             # <<<<<<<<<<<<<<
 *         return exctype(message, code, line, column)
 * 
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __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[1]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_line_d, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":237
 *             else:
 *                 message = u"%s, line %d" % (message, line)
 *         return exctype(message, code, line, column)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_column); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_exctype, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":221
 * 
 *     @cython.final
 *     cdef _buildParseException(self, exctype, default_message):             # <<<<<<<<<<<<<<
 *         code = xmlerror.XML_ERR_INTERNAL_ERROR
 *         if self._first_error is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildParseException", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":240
 * 
 *     @cython.final
 *     cdef _buildExceptionMessage(self, default_message):             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             return default_message
 */

static PyObject *__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self, PyObject *__pyx_v_default_message) {
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildExceptionMessage", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":241
 *     @cython.final
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:             # <<<<<<<<<<<<<<
 *             return default_message
 *         if self._first_error.message:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_first_error) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":242
 *     cdef _buildExceptionMessage(self, default_message):
 *         if self._first_error is None:
 *             return default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.message:
 *             message = self._first_error.message
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default_message);
    __pyx_r = __pyx_v_default_message;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":243
 *         if self._first_error is None:
 *             return default_message
 *         if self._first_error.message:             # <<<<<<<<<<<<<<
 *             message = self._first_error.message
 *         elif default_message is None:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":244
 *             return default_message
 *         if self._first_error.message:
 *             message = self._first_error.message             # <<<<<<<<<<<<<<
 *         elif default_message is None:
 *             return None
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_first_error), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_message = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":245
 *         if self._first_error.message:
 *             message = self._first_error.message
 *         elif default_message is None:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_2 = (__pyx_v_default_message == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":246
 *             message = self._first_error.message
 *         elif default_message is None:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             message = default_message
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":248
 *             return None
 *         else:
 *             message = default_message             # <<<<<<<<<<<<<<
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
 */
    __Pyx_INCREF(__pyx_v_default_message);
    __pyx_v_message = __pyx_v_default_message;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":249
 *         else:
 *             message = default_message
 *         if self._first_error.line > 0:             # <<<<<<<<<<<<<<
 *             if self._first_error.column > 0:
 *                 message = u"%s, line %d, column %d" % (
 */
  __pyx_t_1 = ((__pyx_v_self->_first_error->line > 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":250
 *             message = default_message
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:             # <<<<<<<<<<<<<<
 *                 message = u"%s, line %d, column %d" % (
 *                     message, self._first_error.line, self._first_error.column)
 */
    __pyx_t_1 = ((__pyx_v_self->_first_error->column > 0) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":252
 *             if self._first_error.column > 0:
 *                 message = u"%s, line %d, column %d" % (
 *                     message, self._first_error.line, self._first_error.column)             # <<<<<<<<<<<<<<
 *             else:
 *                 message = u"%s, line %d" % (message, self._first_error.line)
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->_first_error->line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->_first_error->column); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":251
 *         if self._first_error.line > 0:
 *             if self._first_error.column > 0:
 *                 message = u"%s, line %d, column %d" % (             # <<<<<<<<<<<<<<
 *                     message, self._first_error.line, self._first_error.column)
 *             else:
 */
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_line_d_column_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":254
 *                     message, self._first_error.line, self._first_error.column)
 *             else:
 *                 message = u"%s, line %d" % (message, self._first_error.line)             # <<<<<<<<<<<<<<
 *         return message
 * 
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->_first_error->line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_line_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":255
 *             else:
 *                 message = u"%s, line %d" % (message, self._first_error.line)
 *         return message             # <<<<<<<<<<<<<<
 * 
 * cdef class _ListErrorLog(_BaseErrorLog):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_message);
  __pyx_r = __pyx_v_message;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":240
 * 
 *     @cython.final
 *     cdef _buildExceptionMessage(self, default_message):             # <<<<<<<<<<<<<<
 *         if self._first_error is None:
 *             return default_message
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseErrorLog._buildExceptionMessage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":169
 * cdef class _BaseErrorLog:
 *     cdef _LogEntry _first_error
 *     cdef readonly object last_error             # <<<<<<<<<<<<<<
 *     def __init__(self, first_error, last_error):
 *         self._first_error = first_error
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_10last_error_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_BaseErrorLog_10last_error_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_BaseErrorLog_10last_error___get__(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->last_error);
  __pyx_r = __pyx_v_self->last_error;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":261
 *     cdef list _entries
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):             # <<<<<<<<<<<<<<
 *         if entries:
 *             if first_error is None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_entries = 0;
  PyObject *__pyx_v_first_error = 0;
  PyObject *__pyx_v_last_error = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_entries,&__pyx_n_s_first_error,&__pyx_n_s_last_error,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_entries)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_first_error)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_last_error)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_entries = values[0];
    __pyx_v_first_error = values[1];
    __pyx_v_last_error = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), __pyx_v_entries, __pyx_v_first_error, __pyx_v_last_error);

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

static int __pyx_pf_4lxml_5etree_13_ListErrorLog___init__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_first_error, PyObject *__pyx_v_last_error) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_first_error);
  __Pyx_INCREF(__pyx_v_last_error);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":262
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:             # <<<<<<<<<<<<<<
 *             if first_error is None:
 *                 first_error = entries[0]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":263
 *     def __init__(self, entries, first_error, last_error):
 *         if entries:
 *             if first_error is None:             # <<<<<<<<<<<<<<
 *                 first_error = entries[0]
 *             if last_error is None:
 */
    __pyx_t_1 = (__pyx_v_first_error == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":264
 *         if entries:
 *             if first_error is None:
 *                 first_error = entries[0]             # <<<<<<<<<<<<<<
 *             if last_error is None:
 *                 last_error = entries[-1]
 */
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_entries, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_first_error, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":265
 *             if first_error is None:
 *                 first_error = entries[0]
 *             if last_error is None:             # <<<<<<<<<<<<<<
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 */
    __pyx_t_2 = (__pyx_v_last_error == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":266
 *                 first_error = entries[0]
 *             if last_error is None:
 *                 last_error = entries[-1]             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 *         self._entries = entries
 */
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_entries, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_last_error, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":267
 *             if last_error is None:
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)             # <<<<<<<<<<<<<<
 *         self._entries = entries
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __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[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_first_error);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_first_error);
  __Pyx_GIVEREF(__pyx_v_first_error);
  __Pyx_INCREF(__pyx_v_last_error);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_last_error);
  __Pyx_GIVEREF(__pyx_v_last_error);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":268
 *                 last_error = entries[-1]
 *         _BaseErrorLog.__init__(self, first_error, last_error)
 *         self._entries = entries             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
 */
  if (!(likely(PyList_CheckExact(__pyx_v_entries))||((__pyx_v_entries) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_entries)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_v_entries;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_entries);
  __Pyx_DECREF(__pyx_v_self->_entries);
  __pyx_v_self->_entries = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":261
 *     cdef list _entries
 *     cdef int _offset
 *     def __init__(self, entries, first_error, last_error):             # <<<<<<<<<<<<<<
 *         if entries:
 *             if first_error is None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_first_error);
  __Pyx_XDECREF(__pyx_v_last_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":270
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         u"""Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
 */

static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_13_ListErrorLog_copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_log = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":274
 *         entries.
 *         """
 *         cdef _ListErrorLog log = _ListErrorLog(             # <<<<<<<<<<<<<<
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->_entries);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_entries);
  __Pyx_GIVEREF(__pyx_v_self->_entries);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._first_error));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->__pyx_base._first_error));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._first_error));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.last_error);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->__pyx_base.last_error);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.last_error);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_log = ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":276
 *         cdef _ListErrorLog log = _ListErrorLog(
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
  __pyx_t_3 = __pyx_v_self->_offset;
  __pyx_v_log->_offset = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":277
 *             self._entries, self._first_error, self.last_error)
 *         log._offset = self._offset
 *         return log             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_log));
  __pyx_r = ((PyObject *)__pyx_v_log);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":270
 *         self._entries = entries
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         u"""Creates a shallow copy of this error log.  Reuses the list of
 *         entries.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_2copy[] = "Creates a shallow copy of this error log.  Reuses the list of\n        entries.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_2copy(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_2copy(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":279
 *         return log
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         entries = self._entries
 *         if self._offset:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_4__iter__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_4__iter__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_v_entries = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":280
 * 
 *     def __iter__(self):
 *         entries = self._entries             # <<<<<<<<<<<<<<
 *         if self._offset:
 *             entries = islice(entries, self._offset)
 */
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_entries = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":281
 *     def __iter__(self):
 *         entries = self._entries
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             entries = islice(entries, self._offset)
 *         return iter(entries)
 */
  __pyx_t_2 = (__pyx_v_self->_offset != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":282
 *         entries = self._entries
 *         if self._offset:
 *             entries = islice(entries, self._offset)             # <<<<<<<<<<<<<<
 *         return iter(entries)
 * 
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __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[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_entries);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_entries);
    __Pyx_GIVEREF(__pyx_v_entries);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_islice, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_entries, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":283
 *         if self._offset:
 *             entries = islice(entries, self._offset)
 *         return iter(entries)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(__pyx_v_entries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":279
 *         return log
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         entries = self._entries
 *         if self._offset:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entries);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":285
 *         return iter(entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u'\n'.join([repr(entry) for entry in self])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_6__repr__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_6__repr__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":286
 * 
 *     def __repr__(self):
 *         return u'\n'.join([repr(entry) for entry in self])             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Repr(__pyx_v_entry); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __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 = PyUnicode_Join(__pyx_kp_u__21, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":285
 *         return iter(entries)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u'\n'.join([repr(entry) for entry in self])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":288
 *         return u'\n'.join([repr(entry) for entry in self])
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if self._offset:
 *             index += self._offset
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_8__getitem__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_index));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_8__getitem__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":289
 * 
 *     def __getitem__(self, index):
 *         if self._offset:             # <<<<<<<<<<<<<<
 *             index += self._offset
 *         return self._entries[index]
 */
  __pyx_t_1 = (__pyx_v_self->_offset != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":290
 *     def __getitem__(self, index):
 *         if self._offset:
 *             index += self._offset             # <<<<<<<<<<<<<<
 *         return self._entries[index]
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":291
 *         if self._offset:
 *             index += self._offset
 *         return self._entries[index]             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->_entries, __pyx_v_index); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":288
 *         return u'\n'.join([repr(entry) for entry in self])
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if self._offset:
 *             index += self._offset
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":293
 *         return self._entries[index]
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) - self._offset
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_10__len__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_4lxml_5etree_13_ListErrorLog_10__len__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":294
 * 
 *     def __len__(self):
 *         return len(self._entries) - self._offset             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, error_type):
 */
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 - __pyx_v_self->_offset);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":293
 *         return self._entries[index]
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) - self._offset
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":296
 *         return len(self._entries) - self._offset
 * 
 *     def __contains__(self, error_type):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_error_type) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_12__contains__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_error_type));

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

static int __pyx_pf_4lxml_5etree_13_ListErrorLog_12__contains__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_error_type) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_entry = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":298
 *     def __contains__(self, error_type):
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):             # <<<<<<<<<<<<<<
 *             if i < self._offset:
 *                 continue
 */
  __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_v_self->_entries; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":299
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:             # <<<<<<<<<<<<<<
 *                 continue
 *             if entry.type == error_type:
 */
    __pyx_t_5 = ((__pyx_v_i < __pyx_v_self->_offset) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":300
 *         for i, entry in enumerate(self._entries):
 *             if i < self._offset:
 *                 continue             # <<<<<<<<<<<<<<
 *             if entry.type == error_type:
 *                 return True
 */
      goto __pyx_L3_continue;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":301
 *             if i < self._offset:
 *                 continue
 *             if entry.type == error_type:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_error_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":302
 *                 continue
 *             if entry.type == error_type:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":303
 *             if entry.type == error_type:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":296
 *         return len(self._entries) - self._offset
 * 
 *     def __contains__(self, error_type):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t i
 *         for i, entry in enumerate(self._entries):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":305
 *         return False
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) > self._offset
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_15__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_13_ListErrorLog_15__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_14__nonzero__(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_13_ListErrorLog_14__nonzero__(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":306
 * 
 *     def __nonzero__(self):
 *         return len(self._entries) > self._offset             # <<<<<<<<<<<<<<
 * 
 *     def filter_domains(self, domains):
 */
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 > __pyx_v_self->_offset);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":305
 *         return False
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         return len(self._entries) > self._offset
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":308
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         u"""Filter the errors by the given domains and return a new error log
 *         containing the matches.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains(PyObject *__pyx_v_self, PyObject *__pyx_v_domains); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains[] = "Filter the errors by the given domains and return a new error log\n        containing the matches.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains(PyObject *__pyx_v_self, PyObject *__pyx_v_domains) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_domains (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_domains));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_16filter_domains(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_domains) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  PyObject *__pyx_v_filtered = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_domains", 0);
  __Pyx_INCREF(__pyx_v_domains);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":313
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(domains, (int, long)):             # <<<<<<<<<<<<<<
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_domains); 
  if (!__pyx_t_1) {
    __pyx_t_2 = PyLong_Check(__pyx_v_domains); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":314
 *         cdef _LogEntry entry
 *         if isinstance(domains, (int, long)):
 *             domains = (domains,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.domain in domains]
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_domains);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_domains);
    __Pyx_GIVEREF(__pyx_v_domains);
    __Pyx_DECREF_SET(__pyx_v_domains, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":315
 *         if isinstance(domains, (int, long)):
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_5 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_5);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_8));
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_entry->domain); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_t_8, __pyx_v_domains, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_entry))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_filtered = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":316
 *             domains = (domains,)
 *         filtered = [entry for entry in self if entry.domain in domains]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_types(self, types):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_filtered);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":308
 *         return len(self._entries) > self._offset
 * 
 *     def filter_domains(self, domains):             # <<<<<<<<<<<<<<
 *         u"""Filter the errors by the given domains and return a new error log
 *         containing the matches.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_domains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF(__pyx_v_domains);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":318
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         u"""filter_types(self, types)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types[] = "filter_types(self, types)\n\n        Filter the errors by the given types and return a new error\n        log containing the matches.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_types (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_types));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_18filter_types(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_types) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  PyObject *__pyx_v_filtered = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_types", 0);
  __Pyx_INCREF(__pyx_v_types);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":325
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(types, (int, long)):             # <<<<<<<<<<<<<<
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_types); 
  if (!__pyx_t_1) {
    __pyx_t_2 = PyLong_Check(__pyx_v_types); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":326
 *         cdef _LogEntry entry
 *         if isinstance(types, (int, long)):
 *             types = (types,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.type in types]
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_types);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_types);
    __Pyx_GIVEREF(__pyx_v_types);
    __Pyx_DECREF_SET(__pyx_v_types, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":327
 *         if isinstance(types, (int, long)):
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_5 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_5);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_8));
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_entry->type); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_t_8, __pyx_v_types, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_entry))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_filtered = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":328
 *             types = (types,)
 *         filtered = [entry for entry in self if entry.type in types]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_levels(self, levels):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_filtered);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":318
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_types(self, types):             # <<<<<<<<<<<<<<
 *         u"""filter_types(self, types)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":330
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         u"""filter_levels(self, levels)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels(PyObject *__pyx_v_self, PyObject *__pyx_v_levels); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels[] = "filter_levels(self, levels)\n\n        Filter the errors by the given error levels and return a new\n        error log containing the matches.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels(PyObject *__pyx_v_self, PyObject *__pyx_v_levels) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_levels (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_levels));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_20filter_levels(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_levels) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  PyObject *__pyx_v_filtered = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_levels", 0);
  __Pyx_INCREF(__pyx_v_levels);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":337
 *         """
 *         cdef _LogEntry entry
 *         if isinstance(levels, (int, long)):             # <<<<<<<<<<<<<<
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_levels); 
  if (!__pyx_t_1) {
    __pyx_t_2 = PyLong_Check(__pyx_v_levels); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":338
 *         cdef _LogEntry entry
 *         if isinstance(levels, (int, long)):
 *             levels = (levels,)             # <<<<<<<<<<<<<<
 *         filtered = [entry for entry in self if entry.level in levels]
 *         return _ListErrorLog(filtered, None, None)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_levels);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_levels);
    __Pyx_GIVEREF(__pyx_v_levels);
    __Pyx_DECREF_SET(__pyx_v_levels, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":339
 *         if isinstance(levels, (int, long)):
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_5 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_5);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_8));
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_entry->level); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_t_8, __pyx_v_levels, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_entry))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_filtered = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":340
 *             levels = (levels,)
 *         filtered = [entry for entry in self if entry.level in levels]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_level(self, level):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_filtered);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 340; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":330
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_levels(self, levels):             # <<<<<<<<<<<<<<
 *         u"""filter_levels(self, levels)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_levels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XDECREF(__pyx_v_levels);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":342
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         u"""filter_from_level(self, level)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level[] = "filter_from_level(self, level)\n\n        Return a log with all messages of the requested level of worse.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_level (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self), ((PyObject *)__pyx_v_level));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_22filter_from_level(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self, PyObject *__pyx_v_level) {
  struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry = 0;
  PyObject *__pyx_v_filtered = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_level", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":348
 *         """
 *         cdef _LogEntry entry
 *         filtered = [entry for entry in self if entry.level >= level]             # <<<<<<<<<<<<<<
 *         return _ListErrorLog(filtered, None, None)
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__LogEntry))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_entry, ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_entry->level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_level, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_entry))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_filtered = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":349
 *         cdef _LogEntry entry
 *         filtered = [entry for entry in self if entry.level >= level]
 *         return _ListErrorLog(filtered, None, None)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_fatals(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_filtered);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filtered);
  __Pyx_GIVEREF(__pyx_v_filtered);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 349; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":342
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_level(self, level):             # <<<<<<<<<<<<<<
 *         u"""filter_from_level(self, level)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ListErrorLog.filter_from_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_filtered);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":351
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_fatals(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals[] = "filter_from_fatals(self)\n\n        Convenience method to get all fatal error messages.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_fatals (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_24filter_from_fatals(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_24filter_from_fatals(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_fatals", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":356
 *         Convenience method to get all fatal error messages.
 *         """
 *         return self.filter_from_level(ErrorLevels.FATAL)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_errors(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FATAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __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 = 356; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 356; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":351
 *         return _ListErrorLog(filtered, None, None)
 * 
 *     def filter_from_fatals(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_fatals(self)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":358
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_errors(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors[] = "filter_from_errors(self)\n\n        Convenience method to get all error messages or worse.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_errors (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_26filter_from_errors(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_26filter_from_errors(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_errors", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":363
 *         Convenience method to get all error messages or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.ERROR)             # <<<<<<<<<<<<<<
 * 
 *     def filter_from_warnings(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __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 = 363; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 363; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":358
 *         return self.filter_from_level(ErrorLevels.FATAL)
 * 
 *     def filter_from_errors(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_errors(self)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":365
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_warnings(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings[] = "filter_from_warnings(self)\n\n        Convenience method to get all warnings or worse.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_from_warnings (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13_ListErrorLog_28filter_from_warnings(((struct __pyx_obj_4lxml_5etree__ListErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13_ListErrorLog_28filter_from_warnings(struct __pyx_obj_4lxml_5etree__ListErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_from_warnings", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":370
 *         Convenience method to get all warnings or worse.
 *         """
 *         return self.filter_from_level(ErrorLevels.WARNING)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filter_from_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __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 = 370; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 370; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":365
 *         return self.filter_from_level(ErrorLevels.ERROR)
 * 
 *     def filter_from_warnings(self):             # <<<<<<<<<<<<<<
 *         u"""filter_from_warnings(self)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":385
 * cdef class _ErrorLog(_ListErrorLog):
 *     cdef list _logContexts
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._logContexts = []
 * 
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":386
 *     cdef list _logContexts
 *     def __cinit__(self):
 *         self._logContexts = []             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_logContexts);
  __Pyx_DECREF(__pyx_v_self->_logContexts);
  __pyx_v_self->_logContexts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":385
 * cdef class _ErrorLog(_ListErrorLog):
 *     cdef list _logContexts
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._logContexts = []
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":388
 *         self._logContexts = []
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9_ErrorLog_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9_ErrorLog_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_2__init__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_9_ErrorLog_2__init__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":389
 * 
 *     def __init__(self):
 *         _ListErrorLog.__init__(self, [], None, None)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __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));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 3, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":388
 *         self._logContexts = []
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         _ListErrorLog.__init__(self, [], None, None)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":392
 * 
 *     @cython.final
 *     cdef int __enter__(self) except -1:             # <<<<<<<<<<<<<<
 *         return self.connect()
 * 
 */

static int __pyx_f_4lxml_5etree_9_ErrorLog___enter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":393
 *     @cython.final
 *     cdef int __enter__(self) except -1:
 *         return self.connect()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *args):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_connect(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":392
 * 
 *     @cython.final
 *     cdef int __enter__(self) except -1:             # <<<<<<<<<<<<<<
 *         return self.connect()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":395
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_4__exit__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), __pyx_v_args);

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

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_4__exit__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":397
 *     def __exit__(self, *args):
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":395
 *         return self.connect()
 * 
 *     def __exit__(self, *args):             # <<<<<<<<<<<<<<
 *         #  TODO: make this a cdef function when Cython supports it
 *         self.disconnect()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ErrorLog.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":400
 * 
 *     @cython.final
 *     cdef int connect(self) except -1:             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         del self._entries[:]
 */

static int __pyx_f_4lxml_5etree_9_ErrorLog_connect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":401
 *     @cython.final
 *     cdef int connect(self) except -1:
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
  __pyx_v_self->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":402
 *     cdef int connect(self) except -1:
 *         self._first_error = None
 *         del self._entries[:]             # <<<<<<<<<<<<<<
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 */
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base._entries, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":404
 *         del self._entries[:]
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)             # <<<<<<<<<<<<<<
 *         context.old_error_func = xmlerror.xmlStructuredError
 *         context.old_error_context = xmlerror.xmlStructuredErrorContext
 */
  __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ErrorLogContext(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLogContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ErrorLogContext)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":405
 * 
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 *         context.old_error_func = xmlerror.xmlStructuredError             # <<<<<<<<<<<<<<
 *         context.old_error_context = xmlerror.xmlStructuredErrorContext
 *         self._logContexts.append(context)
 */
  __pyx_v_context->old_error_func = xmlStructuredError;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":406
 *         cdef _ErrorLogContext context = _ErrorLogContext.__new__(_ErrorLogContext)
 *         context.old_error_func = xmlerror.xmlStructuredError
 *         context.old_error_context = xmlerror.xmlStructuredErrorContext             # <<<<<<<<<<<<<<
 *         self._logContexts.append(context)
 *         xmlerror.xmlSetStructuredErrorFunc(
 */
  __pyx_v_context->old_error_context = xmlStructuredErrorContext;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":407
 *         context.old_error_func = xmlerror.xmlStructuredError
 *         context.old_error_context = xmlerror.xmlStructuredErrorContext
 *         self._logContexts.append(context)             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             <void*>self, <xmlerror.xmlStructuredErrorFunc>_receiveError)
 */
  if (unlikely(__pyx_v_self->_logContexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyList_Append(__pyx_v_self->_logContexts, ((PyObject *)__pyx_v_context)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":408
 *         context.old_error_context = xmlerror.xmlStructuredErrorContext
 *         self._logContexts.append(context)
 *         xmlerror.xmlSetStructuredErrorFunc(             # <<<<<<<<<<<<<<
 *             <void*>self, <xmlerror.xmlStructuredErrorFunc>_receiveError)
 *         return 0
 */
  xmlSetStructuredErrorFunc(((void *)__pyx_v_self), ((xmlStructuredErrorFunc)__pyx_f_4lxml_5etree__receiveError));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":410
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             <void*>self, <xmlerror.xmlStructuredErrorFunc>_receiveError)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":400
 * 
 *     @cython.final
 *     cdef int connect(self) except -1:             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         del self._entries[:]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":413
 * 
 *     @cython.final
 *     cdef int disconnect(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         xmlerror.xmlSetStructuredErrorFunc(
 */

static int __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ErrorLogContext *__pyx_v_context = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("disconnect", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":414
 *     @cython.final
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()             # <<<<<<<<<<<<<<
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             context.old_error_context, context.old_error_func)
 */
  if (unlikely(__pyx_v_self->_logContexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_logContexts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ErrorLogContext))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ErrorLogContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":415
 *     cdef int disconnect(self) except -1:
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         xmlerror.xmlSetStructuredErrorFunc(             # <<<<<<<<<<<<<<
 *             context.old_error_context, context.old_error_func)
 *         return 0
 */
  xmlSetStructuredErrorFunc(__pyx_v_context->old_error_context, __pyx_v_context->old_error_func);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":417
 *         xmlerror.xmlSetStructuredErrorFunc(
 *             context.old_error_context, context.old_error_func)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef clear(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":413
 * 
 *     @cython.final
 *     cdef int disconnect(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef _ErrorLogContext context = self._logContexts.pop()
 *         xmlerror.xmlSetStructuredErrorFunc(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":419
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
 */

static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_7clear)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 419; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":420
 * 
 *     cpdef clear(self):
 *         self._first_error = None             # <<<<<<<<<<<<<<
 *         self.last_error = None
 *         self._offset = 0
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base._first_error);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
  __pyx_v_self->__pyx_base.__pyx_base._first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":421
 *     cpdef clear(self):
 *         self._first_error = None
 *         self.last_error = None             # <<<<<<<<<<<<<<
 *         self._offset = 0
 *         del self._entries[:]
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  __pyx_v_self->__pyx_base.__pyx_base.last_error = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":422
 *         self._first_error = None
 *         self.last_error = None
 *         self._offset = 0             # <<<<<<<<<<<<<<
 *         del self._entries[:]
 * 
 */
  __pyx_v_self->__pyx_base._offset = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":423
 *         self.last_error = None
 *         self._offset = 0
 *         del self._entries[:]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
 */
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base._entries, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":419
 *         return 0
 * 
 *     cpdef clear(self):             # <<<<<<<<<<<<<<
 *         self._first_error = None
 *         self.last_error = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_6clear(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_6clear(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":425
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         u"""Creates a shallow copy of this error log and the list of entries.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_9copy)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":428
 *         u"""Creates a shallow copy of this error log and the list of entries.
 *         """
 *         return _ListErrorLog(             # <<<<<<<<<<<<<<
 *             self._entries[self._offset:],
 *             self._first_error, self.last_error)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":429
 *         """
 *         return _ListErrorLog(
 *             self._entries[self._offset:],             # <<<<<<<<<<<<<<
 *             self._first_error, self.last_error)
 * 
 */
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_self->__pyx_base._entries, __pyx_v_self->__pyx_base._offset, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":428
 *         u"""Creates a shallow copy of this error log and the list of entries.
 *         """
 *         return _ListErrorLog(             # <<<<<<<<<<<<<<
 *             self._entries[self._offset:],
 *             self._first_error, self.last_error)
 */
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; __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_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->__pyx_base.__pyx_base.last_error);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.last_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":425
 *         del self._entries[:]
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         u"""Creates a shallow copy of this error log and the list of entries.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_9_ErrorLog_8copy[] = "Creates a shallow copy of this error log and the list of entries.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_9copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_8copy(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_8copy(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":432
 *             self._first_error, self.last_error)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries[self._offset:])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_10__iter__(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_10__iter__(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":433
 * 
 *     def __iter__(self):
 *         return iter(self._entries[self._offset:])             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_self->__pyx_base._entries, __pyx_v_self->__pyx_base._offset, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 433; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":432
 *             self._first_error, self.last_error)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries[self._offset:])
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":435
 *         return iter(self._entries[self._offset:])
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 */

static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_9_ErrorLog_receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_13receive)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 435; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":436
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error) == Py_None);
  if ((__pyx_t_4 != 0)) {
    __pyx_t_5 = ((__pyx_v_entry->level >= XML_ERR_ERROR) != 0);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = (__pyx_t_4 != 0);
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":437
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry             # <<<<<<<<<<<<<<
 *         self._entries.append(entry)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base._first_error);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._first_error));
    __pyx_v_self->__pyx_base.__pyx_base._first_error = __pyx_v_entry;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":438
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 *         self._entries.append(entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 */
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->__pyx_base._entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":435
 *         return iter(self._entries[self._offset:])
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9_ErrorLog_13receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_9_ErrorLog_12receive(((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_entry));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_ErrorLog_12receive(struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":441
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_domains = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domains,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_domains)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_domains = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)__pyx_v_self), __pyx_v_domains);

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

static int __pyx_pf_4lxml_5etree_15_DomainErrorLog___init__(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, PyObject *__pyx_v_domains) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":442
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._accepted_domains = tuple(domains)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 442; __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[1]; __pyx_lineno = 442; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 442; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":443
 *     def __init__(self, domains):
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_domains);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_domains);
  __Pyx_GIVEREF(__pyx_v_domains);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accepted_domains, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":441
 * 
 * cdef class _DomainErrorLog(_ErrorLog):
 *     def __init__(self, domains):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._accepted_domains = tuple(domains)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":445
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
 */

static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_15_DomainErrorLog_receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 445; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":446
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:             # <<<<<<<<<<<<<<
 *             _ErrorLog.receive(self, entry)
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_entry->domain); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accepted_domains); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":447
 *     cpdef receive(self, _LogEntry entry):
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)             # <<<<<<<<<<<<<<
 * 
 * cdef class _RotatingErrorLog(_ErrorLog):
 */
    __pyx_t_3 = __pyx_vtabptr_4lxml_5etree__ErrorLog->__pyx_base.__pyx_base.receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_entry, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":445
 *         self._accepted_domains = tuple(domains)
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if entry.domain in self._accepted_domains:
 *             _ErrorLog.receive(self, entry)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_entry));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_15_DomainErrorLog_2receive(struct __pyx_obj_4lxml_5etree__DomainErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._DomainErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":451
 * cdef class _RotatingErrorLog(_ErrorLog):
 *     cdef int _max_len
 *     def __init__(self, max_len):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_len = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_len,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_len)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_max_len = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self), __pyx_v_max_len);

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

static int __pyx_pf_4lxml_5etree_17_RotatingErrorLog___init__(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, PyObject *__pyx_v_max_len) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":452
 *     cdef int _max_len
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)             # <<<<<<<<<<<<<<
 *         self._max_len = max_len
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __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[1]; __pyx_lineno = 452; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 452; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":453
 *     def __init__(self, max_len):
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry entry):
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_max_len); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_max_len = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":451
 * cdef class _RotatingErrorLog(_ErrorLog):
 *     cdef int _max_len
 *     def __init__(self, max_len):             # <<<<<<<<<<<<<<
 *         _ErrorLog.__init__(self)
 *         self._max_len = max_len
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":455
 *         self._max_len = max_len
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 */

static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_17_RotatingErrorLog_receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry, int __pyx_skip_dispatch) {
  int __pyx_v_offset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_entry));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 455; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":456
 * 
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:             # <<<<<<<<<<<<<<
 *             self._first_error = entry
 *         self._entries.append(entry)
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error) == Py_None);
  if ((__pyx_t_4 != 0)) {
    __pyx_t_5 = ((__pyx_v_entry->level >= XML_ERR_ERROR) != 0);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = (__pyx_t_4 != 0);
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":457
 *     cpdef receive(self, _LogEntry entry):
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry             # <<<<<<<<<<<<<<
 *         self._entries.append(entry)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_entry));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry));
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error));
    __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._first_error = __pyx_v_entry;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":458
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 *         self._entries.append(entry)             # <<<<<<<<<<<<<<
 * 
 *         if len(self._entries) > self._max_len:
 */
  if (unlikely(__pyx_v_self->__pyx_base.__pyx_base._entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->__pyx_base.__pyx_base._entries, ((PyObject *)__pyx_v_entry)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":460
 *         self._entries.append(entry)
 * 
 *         if len(self._entries) > self._max_len:             # <<<<<<<<<<<<<<
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base._entries;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = ((__pyx_t_8 > __pyx_v_self->_max_len) != 0);
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":461
 * 
 *         if len(self._entries) > self._max_len:
 *             self._offset += 1             # <<<<<<<<<<<<<<
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset
 */
    __pyx_v_self->__pyx_base.__pyx_base._offset = (__pyx_v_self->__pyx_base.__pyx_base._offset + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":462
 *         if len(self._entries) > self._max_len:
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:             # <<<<<<<<<<<<<<
 *                 offset = self._offset
 *                 self._offset = 0
 */
    __pyx_t_6 = ((__pyx_v_self->__pyx_base.__pyx_base._offset > __Pyx_div_long(__pyx_v_self->_max_len, 3)) != 0);
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":463
 *             self._offset += 1
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset             # <<<<<<<<<<<<<<
 *                 self._offset = 0
 *                 del self._entries[:offset]
 */
      __pyx_t_9 = __pyx_v_self->__pyx_base.__pyx_base._offset;
      __pyx_v_offset = __pyx_t_9;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":464
 *             if self._offset > self._max_len // 3:
 *                 offset = self._offset
 *                 self._offset = 0             # <<<<<<<<<<<<<<
 *                 del self._entries[:offset]
 * 
 */
      __pyx_v_self->__pyx_base.__pyx_base._offset = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":465
 *                 offset = self._offset
 *                 self._offset = 0
 *                 del self._entries[:offset]             # <<<<<<<<<<<<<<
 * 
 * cdef class PyErrorLog(_BaseErrorLog):
 */
      if (unlikely(__pyx_v_self->__pyx_base.__pyx_base._entries == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (__Pyx_PyObject_DelSlice(__pyx_v_self->__pyx_base.__pyx_base._entries, 0, __pyx_v_offset, NULL, NULL, NULL, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":455
 *         self._max_len = max_len
 * 
 *     cpdef receive(self, _LogEntry entry):             # <<<<<<<<<<<<<<
 *         if self._first_error is None and entry.level >= xmlerror.XML_ERR_ERROR:
 *             self._first_error = entry
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive(PyObject *__pyx_v_self, PyObject *__pyx_v_entry) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "entry", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_entry));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_RotatingErrorLog_2receive(struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_entry, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._RotatingErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":490
 *     cdef object _map_level
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10PyErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10PyErrorLog_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_logger_name = 0;
  PyObject *__pyx_v_logger = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_logger_name,&__pyx_n_s_logger,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_logger_name);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_logger);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_logger_name = values[0];
    __pyx_v_logger = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog___init__(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), __pyx_v_logger_name, __pyx_v_logger);

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

static int __pyx_pf_4lxml_5etree_10PyErrorLog___init__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_logger_name, PyObject *__pyx_v_logger) {
  PyObject *__pyx_v_logging = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_logger);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":491
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)             # <<<<<<<<<<<<<<
 *         import logging
 *         self.level_map = {
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseErrorLog)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 491; __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[1]; __pyx_lineno = 491; __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_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 491; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":492
 *     def __init__(self, logger_name=None, logger=None):
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging             # <<<<<<<<<<<<<<
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_logging = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":493
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 *         self.level_map = {             # <<<<<<<<<<<<<<
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":494
 *         import logging
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,             # <<<<<<<<<<<<<<
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":495
 *         self.level_map = {
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,             # <<<<<<<<<<<<<<
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":496
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 *             ErrorLevels.FATAL   : logging.CRITICAL             # <<<<<<<<<<<<<<
 *             }
 *         self._map_level = self.level_map.get
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FATAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_CRITICAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":493
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 *         self.level_map = {             # <<<<<<<<<<<<<<
 *             ErrorLevels.WARNING : logging.WARNING,
 *             ErrorLevels.ERROR   : logging.ERROR,
 */
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->level_map);
  __Pyx_DECREF(__pyx_v_self->level_map);
  __pyx_v_self->level_map = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":498
 *             ErrorLevels.FATAL   : logging.CRITICAL
 *             }
 *         self._map_level = self.level_map.get             # <<<<<<<<<<<<<<
 *         if logger is None:
 *             if logger_name:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->level_map, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_map_level);
  __Pyx_DECREF(__pyx_v_self->_map_level);
  __pyx_v_self->_map_level = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":499
 *             }
 *         self._map_level = self.level_map.get
 *         if logger is None:             # <<<<<<<<<<<<<<
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)
 */
  __pyx_t_4 = (__pyx_v_logger == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":500
 *         self._map_level = self.level_map.get
 *         if logger is None:
 *             if logger_name:             # <<<<<<<<<<<<<<
 *                 logger = logging.getLogger(logger_name)
 *             else:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_logger_name); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":501
 *         if logger is None:
 *             if logger_name:
 *                 logger = logging.getLogger(logger_name)             # <<<<<<<<<<<<<<
 *             else:
 *                 logger = logging.getLogger()
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 501; __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[1]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_logger_name);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_logger_name);
      __Pyx_GIVEREF(__pyx_v_logger_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_logger, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":503
 *                 logger = logging.getLogger(logger_name)
 *             else:
 *                 logger = logging.getLogger()             # <<<<<<<<<<<<<<
 *         self._log = logger.log
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_logging, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_logger, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":504
 *             else:
 *                 logger = logging.getLogger()
 *         self._log = logger.log             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_logger, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_log);
  __Pyx_DECREF(__pyx_v_self->_log);
  __pyx_v_self->_log = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":490
 *     cdef object _map_level
 *     cdef object _log
 *     def __init__(self, logger_name=None, logger=None):             # <<<<<<<<<<<<<<
 *         _BaseErrorLog.__init__(self, None, None)
 *         import logging
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_logging);
  __Pyx_XDECREF(__pyx_v_logger);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":506
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         u"""Dummy method that returns an empty error log.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_copy(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_10PyErrorLog_3copy)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 506; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":509
 *         u"""Dummy method that returns an empty error log.
 *         """
 *         return _ListErrorLog([], None, None)             # <<<<<<<<<<<<<<
 * 
 *     def log(self, log_entry, message, *args):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 509; __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[1]; __pyx_lineno = 509; __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_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ListErrorLog)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":506
 *         self._log = logger.log
 * 
 *     cpdef copy(self):             # <<<<<<<<<<<<<<
 *         u"""Dummy method that returns an empty error log.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_10PyErrorLog_2copy[] = "Dummy method that returns an empty error log.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_2copy(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_2copy(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":511
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         u"""log(self, log_entry, message, *args)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_5log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_10PyErrorLog_4log[] = "log(self, log_entry, message, *args)\n\n        Called by the .receive() method to log a _LogEntry instance to\n        the Python logging system.  This handles the error level\n        mapping.\n\n        In the default implementation, the ``message`` argument\n        receives a complete log line, and there are no further\n        ``args``.  To change the message format, it is best to\n        override the .receive() method instead of this one.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_5log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_log_entry = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_args = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log_entry,&__pyx_n_s_message,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log_entry)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "log") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_log_entry = values[0];
    __pyx_v_message = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_4log(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), __pyx_v_log_entry, __pyx_v_message, __pyx_v_args);

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

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_4log(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, PyObject *__pyx_v_log_entry, PyObject *__pyx_v_message, PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("log", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":524
 *         """
 *         self._log(
 *             self._map_level(log_entry.level, 0),             # <<<<<<<<<<<<<<
 *             message, *args
 *             )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_log_entry, __pyx_n_s_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 524; __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[1]; __pyx_lineno = 524; __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_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->_map_level, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":523
 *         override the .receive() method instead of this one.
 *         """
 *         self._log(             # <<<<<<<<<<<<<<
 *             self._map_level(log_entry.level, 0),
 *             message, *args
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 523; __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_INCREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":526
 *             self._map_level(log_entry.level, 0),
 *             message, *args
 *             )             # <<<<<<<<<<<<<<
 * 
 *     cpdef receive(self, _LogEntry log_entry):
 */
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":523
 *         override the .receive() method instead of this one.
 *         """
 *         self._log(             # <<<<<<<<<<<<<<
 *             self._map_level(log_entry.level, 0),
 *             message, *args
 */
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->_log, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":511
 *         return _ListErrorLog([], None, None)
 * 
 *     def log(self, log_entry, message, *args):             # <<<<<<<<<<<<<<
 *         u"""log(self, log_entry, message, *args)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":528
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         u"""receive(self, log_entry)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, PyObject *__pyx_v_log_entry); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10PyErrorLog_receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_receive); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_10PyErrorLog_7receive)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_log_entry));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_log_entry));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_log_entry));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":539
 *         format.
 *         """
 *         self.log(log_entry, repr(log_entry))             # <<<<<<<<<<<<<<
 * 
 * # thread-local, global list log to collect error output messages from
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_log_entry)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_log_entry));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_log_entry));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_log_entry));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 539; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":528
 *             )
 * 
 *     cpdef receive(self, _LogEntry log_entry):             # <<<<<<<<<<<<<<
 *         u"""receive(self, log_entry)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, PyObject *__pyx_v_log_entry); /*proto*/
static char __pyx_doc_4lxml_5etree_10PyErrorLog_6receive[] = "receive(self, log_entry)\n\n        Receive a _LogEntry instance from the logging system.  Calls\n        the .log() method with appropriate parameters::\n\n            self.log(log_entry, repr(log_entry))\n\n        You can override this method to provide your own log output\n        format.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_7receive(PyObject *__pyx_v_self, PyObject *__pyx_v_log_entry) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("receive (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_entry), __pyx_ptype_4lxml_5etree__LogEntry, 1, "log_entry", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_6receive(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__LogEntry *)__pyx_v_log_entry));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_6receive(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self, struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_v_log_entry) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("receive", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self), __pyx_v_log_entry, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.PyErrorLog.receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":487
 *     with appropriate data.
 *     """
 *     cdef readonly dict level_map             # <<<<<<<<<<<<<<
 *     cdef object _map_level
 *     cdef object _log
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_9level_map_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_10PyErrorLog_9level_map_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_10PyErrorLog_9level_map___get__(struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->level_map);
  __pyx_r = __pyx_v_self->level_map;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":547
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     u"""Retrieve the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

static struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_f_4lxml_5etree__getGlobalErrorLog(void) {
  PyObject *__pyx_v_thread_dict;
  struct __pyx_obj_4lxml_5etree__RotatingErrorLog *__pyx_v_log = NULL;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getGlobalErrorLog", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":550
 *     u"""Retrieve the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":551
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         return __GLOBAL_ERROR_LOG
 *     try:
 */
  __pyx_t_1 = ((__pyx_v_thread_dict == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":552
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG             # <<<<<<<<<<<<<<
 *     try:
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
    __pyx_r = __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":553
 *     if thread_dict is NULL:
 *         return __GLOBAL_ERROR_LOG
 *     try:             # <<<<<<<<<<<<<<
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 *     except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":554
 *         return __GLOBAL_ERROR_LOG
 *     try:
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_thread_dict), __pyx_n_u_GlobalErrorLog); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L4_error;};
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L8_try_return;
    }
    __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;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":555
 *     try:
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree._getGlobalErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":557
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__RotatingErrorLog)), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_log = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)__pyx_t_9);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":556
 *         return (<object>thread_dict)[u"_GlobalErrorLog"]
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \             # <<<<<<<<<<<<<<
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log
 */
      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), __pyx_n_u_GlobalErrorLog, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":558
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)
 *         return log             # <<<<<<<<<<<<<<
 * 
 * cdef _setGlobalErrorLog(_BaseErrorLog log):
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_log));
      __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L11_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":547
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     u"""Retrieve the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._getGlobalErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":560
 *         return log
 * 
 * cdef _setGlobalErrorLog(_BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     u"""Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

static PyObject *__pyx_f_4lxml_5etree__setGlobalErrorLog(struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log) {
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setGlobalErrorLog", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":563
 *     u"""Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *     if thread_dict is NULL:
 *         global __GLOBAL_ERROR_LOG
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":564
 *     cdef python.PyObject* thread_dict
 *     thread_dict = python.PyThreadState_GetDict()
 *     if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *         global __GLOBAL_ERROR_LOG
 *         __GLOBAL_ERROR_LOG = log
 */
  __pyx_t_1 = ((__pyx_v_thread_dict == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":566
 *     if thread_dict is NULL:
 *         global __GLOBAL_ERROR_LOG
 *         __GLOBAL_ERROR_LOG = log             # <<<<<<<<<<<<<<
 *     else:
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_log));
    __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
    __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG, __pyx_v_log);
    __Pyx_GIVEREF(((PyObject *)__pyx_v_log));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":568
 *         __GLOBAL_ERROR_LOG = log
 *     else:
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log             # <<<<<<<<<<<<<<
 * 
 * cdef __copyGlobalErrorLog():
 */
    if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_thread_dict), __pyx_n_u_GlobalErrorLog, ((PyObject *)__pyx_v_log)) < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":560
 *         return log
 * 
 * cdef _setGlobalErrorLog(_BaseErrorLog log):             # <<<<<<<<<<<<<<
 *     u"""Set the global error log of this thread."""
 *     cdef python.PyObject* thread_dict
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._setGlobalErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":570
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     u"Helper function for properties in exceptions."
 *     return _getGlobalErrorLog().copy()
 */

static PyObject *__pyx_f_4lxml_5etree___copyGlobalErrorLog(void) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copyGlobalErrorLog", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":572
 * cdef __copyGlobalErrorLog():
 *     u"Helper function for properties in exceptions."
 *     return _getGlobalErrorLog().copy()             # <<<<<<<<<<<<<<
 * 
 * def use_global_python_log(PyErrorLog log not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1)->__pyx_vtab)->copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 572; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":570
 *         (<object>thread_dict)[u"_GlobalErrorLog"] = log
 * 
 * cdef __copyGlobalErrorLog():             # <<<<<<<<<<<<<<
 *     u"Helper function for properties in exceptions."
 *     return _getGlobalErrorLog().copy()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__copyGlobalErrorLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":574
 *     return _getGlobalErrorLog().copy()
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     u"""use_global_python_log(log)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5use_global_python_log(PyObject *__pyx_self, PyObject *__pyx_v_log); /*proto*/
static char __pyx_doc_4lxml_5etree_4use_global_python_log[] = "use_global_python_log(log)\n\n    Replace the global error log by an etree.PyErrorLog that uses the\n    standard Python logging package.\n\n    Note that this disables access to the global error log from exceptions.\n    Parsers, XSLT etc. will continue to provide their normal local error log.\n\n    Note: prior to lxml 2.2, this changed the error log globally.\n    Since lxml 2.2, the global error log is local to a thread and this\n    function will only set the global error log of the current thread.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_5use_global_python_log = {__Pyx_NAMESTR("use_global_python_log"), (PyCFunction)__pyx_pw_4lxml_5etree_5use_global_python_log, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4use_global_python_log)};
static PyObject *__pyx_pw_4lxml_5etree_5use_global_python_log(PyObject *__pyx_self, PyObject *__pyx_v_log) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("use_global_python_log (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_4lxml_5etree_PyErrorLog, 0, "log", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_4use_global_python_log(__pyx_self, ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)__pyx_v_log));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4use_global_python_log(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree_PyErrorLog *__pyx_v_log) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("use_global_python_log", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":587
 *     function will only set the global error log of the current thread.
 *     """
 *     _setGlobalErrorLog(log)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setGlobalErrorLog(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_log)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":574
 *     return _getGlobalErrorLog().copy()
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     u"""use_global_python_log(log)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.use_global_python_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":591
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:             # <<<<<<<<<<<<<<
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 */

static void __pyx_f_4lxml_5etree__forwardError(void *__pyx_v_c_log_handler, xmlError *__pyx_v_error) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_log_handler = 0;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_forwardError", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":593
 * cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:             # <<<<<<<<<<<<<<
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_log_handler != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":594
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 *         log_handler = <_BaseErrorLog>c_log_handler             # <<<<<<<<<<<<<<
 *     else:
 *         log_handler = _getGlobalErrorLog()
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_c_log_handler);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":596
 *         log_handler = <_BaseErrorLog>c_log_handler
 *     else:
 *         log_handler = _getGlobalErrorLog()             # <<<<<<<<<<<<<<
 *     log_handler._receive(error)
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__getGlobalErrorLog()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_log_handler = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":597
 *     else:
 *         log_handler = _getGlobalErrorLog()
 *     log_handler._receive(error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:
 */
  __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(__pyx_v_log_handler, __pyx_v_error);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":591
 * 
 * # local log functions: forward error to logger object
 * cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:             # <<<<<<<<<<<<<<
 *     cdef _BaseErrorLog log_handler
 *     if c_log_handler is not NULL:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("lxml.etree._forwardError", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_log_handler);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":599
 *     log_handler._receive(error)
 * 
 * cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
 */

static void __pyx_f_4lxml_5etree__receiveError(void *__pyx_v_c_log_handler, xmlError *__pyx_v_error) {

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":602
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
 *         _forwardError(c_log_handler, error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil:
 */
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, __pyx_v_error);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":599
 *     log_handler._receive(error)
 * 
 * cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     if __DEBUG:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":604
 *         _forwardError(c_log_handler, error)
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef xmlerror.xmlError c_error
 */

static void __pyx_f_4lxml_5etree__receiveXSLTError(void *__pyx_v_c_log_handler, char *__pyx_v_msg, ...) {
  xmlError __pyx_v_c_error;
  va_list __pyx_v_args;
  char *__pyx_v_c_text;
  char *__pyx_v_c_message;
  char *__pyx_v_c_element;
  char *__pyx_v_c_pos;
  char *__pyx_v_c_name_pos;
  char *__pyx_v_c_str;
  int __pyx_v_text_size;
  int __pyx_v_element_size;
  int __pyx_v_format_count;
  int __pyx_v_c_int;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":615
 *     cdef char* c_str
 *     cdef int text_size, element_size, format_count, c_int
 *     if not __DEBUG or msg is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     if msg[0] in b'\n\0':
 */
  __pyx_t_1 = ((__pyx_v_msg == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":616
 *     cdef int text_size, element_size, format_count, c_int
 *     if not __DEBUG or msg is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     if msg[0] in b'\n\0':
 *         return
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":617
 *     if not __DEBUG or msg is NULL:
 *         return
 *     if msg[0] in b'\n\0':             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  switch ((__pyx_v_msg[0])) {
    case '\x00':
    case '\n':

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":618
 *         return
 *     if msg[0] in b'\n\0':
 *         return             # <<<<<<<<<<<<<<
 * 
 *     c_text = c_element = c_error.file = NULL
 */
    goto __pyx_L0;
    break;
    default: break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":620
 *         return
 * 
 *     c_text = c_element = c_error.file = NULL             # <<<<<<<<<<<<<<
 *     c_error.line = 0
 * 
 */
  __pyx_v_c_text = NULL;
  __pyx_v_c_element = NULL;
  __pyx_v_c_error.file = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":621
 * 
 *     c_text = c_element = c_error.file = NULL
 *     c_error.line = 0             # <<<<<<<<<<<<<<
 * 
 *     # parse "NAME %s" chunks from the format string
 */
  __pyx_v_c_error.line = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":624
 * 
 *     # parse "NAME %s" chunks from the format string
 *     cvarargs.va_start(args, msg)             # <<<<<<<<<<<<<<
 *     c_name_pos = c_pos = msg
 *     format_count = 0
 */
  va_start(__pyx_v_args, __pyx_v_msg);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":625
 *     # parse "NAME %s" chunks from the format string
 *     cvarargs.va_start(args, msg)
 *     c_name_pos = c_pos = msg             # <<<<<<<<<<<<<<
 *     format_count = 0
 *     while c_pos[0]:
 */
  __pyx_v_c_name_pos = __pyx_v_msg;
  __pyx_v_c_pos = __pyx_v_msg;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":626
 *     cvarargs.va_start(args, msg)
 *     c_name_pos = c_pos = msg
 *     format_count = 0             # <<<<<<<<<<<<<<
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':
 */
  __pyx_v_format_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":627
 *     c_name_pos = c_pos = msg
 *     format_count = 0
 *     while c_pos[0]:             # <<<<<<<<<<<<<<
 *         if c_pos[0] == b'%':
 *             c_pos += 1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_pos[0]) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":628
 *     format_count = 0
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':             # <<<<<<<<<<<<<<
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"
 */
    __pyx_t_1 = (((__pyx_v_c_pos[0]) == '%') != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":629
 *     while c_pos[0]:
 *         if c_pos[0] == b'%':
 *             c_pos += 1             # <<<<<<<<<<<<<<
 *             if c_pos[0] == b's':  # "%s"
 *                 format_count += 1
 */
      __pyx_v_c_pos = (__pyx_v_c_pos + 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":630
 *         if c_pos[0] == b'%':
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_str = cvarargs.va_charptr(args)
 */
      __pyx_t_1 = (((__pyx_v_c_pos[0]) == 's') != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":631
 *             c_pos += 1
 *             if c_pos[0] == b's':  # "%s"
 *                 format_count += 1             # <<<<<<<<<<<<<<
 *                 c_str = cvarargs.va_charptr(args)
 *                 if c_pos == msg + 1:
 */
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":632
 *             if c_pos[0] == b's':  # "%s"
 *                 format_count += 1
 *                 c_str = cvarargs.va_charptr(args)             # <<<<<<<<<<<<<<
 *                 if c_pos == msg + 1:
 *                     c_text = c_str  # msg == "%s..."
 */
        __pyx_v_c_str = va_charptr(__pyx_v_args);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":633
 *                 format_count += 1
 *                 c_str = cvarargs.va_charptr(args)
 *                 if c_pos == msg + 1:             # <<<<<<<<<<<<<<
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':
 */
        __pyx_t_1 = ((__pyx_v_c_pos == (__pyx_v_msg + 1)) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":634
 *                 c_str = cvarargs.va_charptr(args)
 *                 if c_pos == msg + 1:
 *                     c_text = c_str  # msg == "%s..."             # <<<<<<<<<<<<<<
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10):
 */
          __pyx_v_c_text = __pyx_v_c_str;
          goto __pyx_L8;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":635
 *                 if c_pos == msg + 1:
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':             # <<<<<<<<<<<<<<
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10):
 *                         c_element = c_str
 */
        __pyx_t_1 = (((__pyx_v_c_name_pos[0]) == 'e') != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":636
 *                     c_text = c_str  # msg == "%s..."
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10):             # <<<<<<<<<<<<<<
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':
 */
          __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, __pyx_k_element_s, 10) != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":637
 *                 elif c_name_pos[0] == b'e':
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10):
 *                         c_element = c_str             # <<<<<<<<<<<<<<
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7):
 */
            __pyx_v_c_element = __pyx_v_c_str;
            goto __pyx_L9;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":638
 *                     if cstring_h.strncmp(c_name_pos, 'element %s', 10):
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':             # <<<<<<<<<<<<<<
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7):
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 */
        __pyx_t_1 = (((__pyx_v_c_name_pos[0]) == 'f') != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":639
 *                         c_element = c_str
 *                 elif c_name_pos[0] == b'f':
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7):             # <<<<<<<<<<<<<<
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:
 */
          __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, __pyx_k_file_s, 7) != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":641
 *                     if cstring_h.strncmp(c_name_pos, 'file %s', 7):
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:             # <<<<<<<<<<<<<<
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
 */
            __pyx_t_1 = ((strncmp(__pyx_k_string___STRING__XSLT, __pyx_v_c_str, 23) == 0) != 0);
            if (__pyx_t_1) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":642
 *                         if cstring_h.strncmp('string://__STRING__XSLT',
 *                                              c_str, 23) == 0:
 *                             c_str = '<xslt>'             # <<<<<<<<<<<<<<
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"
 */
              __pyx_v_c_str = __pyx_k_xslt;
              goto __pyx_L11;
            }
            __pyx_L11:;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":643
 *                                              c_str, 23) == 0:
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str             # <<<<<<<<<<<<<<
 *             elif c_pos[0] == b'd':  # "%d"
 *                 format_count += 1
 */
            __pyx_v_c_error.file = __pyx_v_c_str;
            goto __pyx_L10;
          }
          __pyx_L10:;
          goto __pyx_L8;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":644
 *                             c_str = '<xslt>'
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
 */
      __pyx_t_1 = (((__pyx_v_c_pos[0]) == 'd') != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":645
 *                         c_error.file = c_str
 *             elif c_pos[0] == b'd':  # "%d"
 *                 format_count += 1             # <<<<<<<<<<<<<<
 *                 c_int = cvarargs.va_int(args)
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7):
 */
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":646
 *             elif c_pos[0] == b'd':  # "%d"
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)             # <<<<<<<<<<<<<<
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7):
 *                     c_error.line = c_int
 */
        __pyx_v_c_int = va_int(__pyx_v_args);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":647
 *                 format_count += 1
 *                 c_int = cvarargs.va_int(args)
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7):             # <<<<<<<<<<<<<<
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 */
        __pyx_t_1 = (strncmp(__pyx_v_c_name_pos, __pyx_k_line_d, 7) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":648
 *                 c_int = cvarargs.va_int(args)
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7):
 *                     c_error.line = c_int             # <<<<<<<<<<<<<<
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 *                 format_count += 1
 */
          __pyx_v_c_error.line = __pyx_v_c_int;
          goto __pyx_L12;
        }
        __pyx_L12:;
        goto __pyx_L7;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":649
 *                 if cstring_h.strncmp(c_name_pos, 'line %d', 7):
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"             # <<<<<<<<<<<<<<
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
 */
      __pyx_t_1 = (((__pyx_v_c_pos[0]) != '%') != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":650
 *                     c_error.line = c_int
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 *                 format_count += 1             # <<<<<<<<<<<<<<
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':
 */
        __pyx_v_format_count = (__pyx_v_format_count + 1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":651
 *             elif c_pos[0] != b'%':  # "%%" == "%"
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort             # <<<<<<<<<<<<<<
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':
 */
        goto __pyx_L5_break;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":652
 *                 format_count += 1
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':             # <<<<<<<<<<<<<<
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1
 */
    __pyx_t_1 = (((__pyx_v_c_pos[0]) == ' ') != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":653
 *                 break  # unexpected format or end of string => abort
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':             # <<<<<<<<<<<<<<
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1
 */
      __pyx_t_1 = (((__pyx_v_c_pos[1]) != '%') != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":654
 *         elif c_pos[0] == b' ':
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1             # <<<<<<<<<<<<<<
 *         c_pos += 1
 *     cvarargs.va_end(args)
 */
        __pyx_v_c_name_pos = (__pyx_v_c_pos + 1);
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":655
 *             if c_pos[1] != b'%':
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1             # <<<<<<<<<<<<<<
 *     cvarargs.va_end(args)
 * 
 */
    __pyx_v_c_pos = (__pyx_v_c_pos + 1);
  }
  __pyx_L5_break:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":656
 *                 c_name_pos = c_pos + 1
 *         c_pos += 1
 *     cvarargs.va_end(args)             # <<<<<<<<<<<<<<
 * 
 *     c_message = NULL
 */
  va_end(__pyx_v_args);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":658
 *     cvarargs.va_end(args)
 * 
 *     c_message = NULL             # <<<<<<<<<<<<<<
 *     if c_text is NULL:
 *         if c_element is not NULL and format_count == 1:
 */
  __pyx_v_c_message = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":659
 * 
 *     c_message = NULL
 *     if c_text is NULL:             # <<<<<<<<<<<<<<
 *         if c_element is not NULL and format_count == 1:
 *             # special case: a single occurrence of 'element %s'
 */
  __pyx_t_1 = ((__pyx_v_c_text == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":660
 *     c_message = NULL
 *     if c_text is NULL:
 *         if c_element is not NULL and format_count == 1:             # <<<<<<<<<<<<<<
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)
 */
    __pyx_t_1 = ((__pyx_v_c_element != NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_format_count == 1) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":662
 *         if c_element is not NULL and format_count == 1:
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)             # <<<<<<<<<<<<<<
 *             element_size = cstring_h.strlen(c_element)
 *             c_message = <char*>stdlib.malloc(
 */
      __pyx_v_text_size = strlen(__pyx_v_msg);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":663
 *             # special case: a single occurrence of 'element %s'
 *             text_size    = cstring_h.strlen(msg)
 *             element_size = cstring_h.strlen(c_element)             # <<<<<<<<<<<<<<
 *             c_message = <char*>stdlib.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
 */
      __pyx_v_element_size = strlen(__pyx_v_c_element);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":664
 *             text_size    = cstring_h.strlen(msg)
 *             element_size = cstring_h.strlen(c_element)
 *             c_message = <char*>stdlib.malloc(             # <<<<<<<<<<<<<<
 *                 (text_size + element_size + 1) * sizeof(char))
 *             stdio.sprintf(c_message, msg, c_element)
 */
      __pyx_v_c_message = ((char *)malloc((((__pyx_v_text_size + __pyx_v_element_size) + 1) * (sizeof(char)))));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":666
 *             c_message = <char*>stdlib.malloc(
 *                 (text_size + element_size + 1) * sizeof(char))
 *             stdio.sprintf(c_message, msg, c_element)             # <<<<<<<<<<<<<<
 *             c_error.message = c_message
 *         else:
 */
      sprintf(__pyx_v_c_message, __pyx_v_msg, __pyx_v_c_element);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":667
 *                 (text_size + element_size + 1) * sizeof(char))
 *             stdio.sprintf(c_message, msg, c_element)
 *             c_error.message = c_message             # <<<<<<<<<<<<<<
 *         else:
 *             c_error.message = ''
 */
      __pyx_v_c_error.message = __pyx_v_c_message;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":669
 *             c_error.message = c_message
 *         else:
 *             c_error.message = ''             # <<<<<<<<<<<<<<
 *     elif c_element is NULL:
 *         c_error.message = c_text
 */
      __pyx_v_c_error.message = __pyx_k__15;
    }
    __pyx_L15:;
    goto __pyx_L14;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":670
 *         else:
 *             c_error.message = ''
 *     elif c_element is NULL:             # <<<<<<<<<<<<<<
 *         c_error.message = c_text
 *     else:
 */
  __pyx_t_3 = ((__pyx_v_c_element == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":671
 *             c_error.message = ''
 *     elif c_element is NULL:
 *         c_error.message = c_text             # <<<<<<<<<<<<<<
 *     else:
 *         text_size    = cstring_h.strlen(c_text)
 */
    __pyx_v_c_error.message = __pyx_v_c_text;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":673
 *         c_error.message = c_text
 *     else:
 *         text_size    = cstring_h.strlen(c_text)             # <<<<<<<<<<<<<<
 *         element_size = cstring_h.strlen(c_element)
 *         c_message = <char*>stdlib.malloc(
 */
    __pyx_v_text_size = strlen(__pyx_v_c_text);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":674
 *     else:
 *         text_size    = cstring_h.strlen(c_text)
 *         element_size = cstring_h.strlen(c_element)             # <<<<<<<<<<<<<<
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 */
    __pyx_v_element_size = strlen(__pyx_v_c_element);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":675
 *         text_size    = cstring_h.strlen(c_text)
 *         element_size = cstring_h.strlen(c_element)
 *         c_message = <char*>stdlib.malloc(             # <<<<<<<<<<<<<<
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 */
    __pyx_v_c_message = ((char *)malloc(((((__pyx_v_text_size + 12) + __pyx_v_element_size) + 1) * (sizeof(char)))));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":677
 *         c_message = <char*>stdlib.malloc(
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)             # <<<<<<<<<<<<<<
 *         c_error.message = c_message
 * 
 */
    sprintf(__pyx_v_c_message, __pyx_k_s_element_s, __pyx_v_c_text, __pyx_v_c_element);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":678
 *             (text_size + 12 + element_size + 1) * sizeof(char))
 *         stdio.sprintf(c_message, "%s, element '%s'", c_text, c_element)
 *         c_error.message = c_message             # <<<<<<<<<<<<<<
 * 
 *     c_error.domain = xmlerror.XML_FROM_XSLT
 */
    __pyx_v_c_error.message = __pyx_v_c_message;
  }
  __pyx_L14:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":680
 *         c_error.message = c_message
 * 
 *     c_error.domain = xmlerror.XML_FROM_XSLT             # <<<<<<<<<<<<<<
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 */
  __pyx_v_c_error.domain = XML_FROM_XSLT;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":681
 * 
 *     c_error.domain = xmlerror.XML_FROM_XSLT
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?             # <<<<<<<<<<<<<<
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 *     c_error.int2   = 0
 */
  __pyx_v_c_error.code = XML_ERR_OK;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":682
 *     c_error.domain = xmlerror.XML_FROM_XSLT
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?             # <<<<<<<<<<<<<<
 *     c_error.int2   = 0
 * 
 */
  __pyx_v_c_error.level = XML_ERR_ERROR;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":683
 *     c_error.code   = xmlerror.XML_ERR_OK    # what else?
 *     c_error.level  = xmlerror.XML_ERR_ERROR # what else?
 *     c_error.int2   = 0             # <<<<<<<<<<<<<<
 * 
 *     _forwardError(c_log_handler, &c_error)
 */
  __pyx_v_c_error.int2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":685
 *     c_error.int2   = 0
 * 
 *     _forwardError(c_log_handler, &c_error)             # <<<<<<<<<<<<<<
 * 
 *     if c_message is not NULL:
 */
  __pyx_f_4lxml_5etree__forwardError(__pyx_v_c_log_handler, (&__pyx_v_c_error));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":687
 *     _forwardError(c_log_handler, &c_error)
 * 
 *     if c_message is not NULL:             # <<<<<<<<<<<<<<
 *         stdlib.free(c_message)
 * 
 */
  __pyx_t_3 = ((__pyx_v_c_message != NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":688
 * 
 *     if c_message is not NULL:
 *         stdlib.free(c_message)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
    free(__pyx_v_c_message);
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":604
 *         _forwardError(c_log_handler, error)
 * 
 * cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil:             # <<<<<<<<<<<<<<
 *     # no Python objects here, may be called without thread context !
 *     cdef xmlerror.xmlError c_error
 */

  /* function exit code */
  __pyx_L0:;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":694
 * ################################################################################
 * 
 * cdef __initErrorConstants():             # <<<<<<<<<<<<<<
 *     u"Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 */

static PyObject *__pyx_f_4lxml_5etree___initErrorConstants(void) {
  PyObject *__pyx_v_find_constants = NULL;
  PyObject *__pyx_v_const_defs = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_v_constant_tuple = NULL;
  PyObject *__pyx_v_reverse_dict = NULL;
  PyObject *__pyx_v_constants = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__initErrorConstants", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":697
 *     u"Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall             # <<<<<<<<<<<<<<
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_findall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_find_constants = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":698
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorLevels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; __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[1]; __pyx_lineno = 698; __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_INCREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":699
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),             # <<<<<<<<<<<<<<
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorDomains); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 699; __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[1]; __pyx_lineno = 699; __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(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":700
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),             # <<<<<<<<<<<<<<
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 *     for cls, constant_tuple in const_defs:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":701
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))             # <<<<<<<<<<<<<<
 *     for cls, constant_tuple in const_defs:
 *         reverse_dict = {}
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGErrorTypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":698
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),             # <<<<<<<<<<<<<<
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_v_const_defs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":702
 *                   (ErrorTypes,           __PARSER_ERROR_TYPES),
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 *     for cls, constant_tuple in const_defs:             # <<<<<<<<<<<<<<
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 */
  __pyx_t_1 = __pyx_v_const_defs; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (likely(__pyx_t_5 != Py_None)) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_XDECREF_SET(__pyx_v_cls, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_constant_tuple, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":703
 *                   (RelaxNGErrorTypes,    __RELAXNG_ERROR_TYPES))
 *     for cls, constant_tuple in const_defs:
 *         reverse_dict = {}             # <<<<<<<<<<<<<<
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 */
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_reverse_dict, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":704
 *     for cls, constant_tuple in const_defs:
 *         reverse_dict = {}
 *         cls._names   = reverse_dict             # <<<<<<<<<<<<<<
 *         cls._getName = reverse_dict.get
 *         for constants in constant_tuple:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_names, __pyx_v_reverse_dict) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":705
 *         reverse_dict = {}
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get             # <<<<<<<<<<<<<<
 *         for constants in constant_tuple:
 *             #print len(constants) + 1
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_reverse_dict, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cls, __pyx_n_s_getName, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":706
 *         cls._names   = reverse_dict
 *         cls._getName = reverse_dict.get
 *         for constants in constant_tuple:             # <<<<<<<<<<<<<<
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):
 */
    if (PyList_CheckExact(__pyx_v_constant_tuple) || PyTuple_CheckExact(__pyx_v_constant_tuple)) {
      __pyx_t_5 = __pyx_v_constant_tuple; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_constant_tuple); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_5)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_5)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_3 = __pyx_t_8(__pyx_t_5);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_constants, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":708
 *         for constants in constant_tuple:
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):             # <<<<<<<<<<<<<<
 *                 value = int(value)
 *                 setattr(cls, name, value)
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_constants);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_constants);
      __Pyx_GIVEREF(__pyx_v_constants);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_find_constants, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_3)) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_3)) {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_4 = __pyx_t_10(__pyx_t_3);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
          PyObject* sequence = __pyx_t_4;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_11);
          #else
          __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          #endif
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
          index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_2);
          index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_11);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_13 = NULL;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L10_unpacking_done;
          __pyx_L9_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_13 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L10_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":709
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):
 *                 value = int(value)             # <<<<<<<<<<<<<<
 *                 setattr(cls, name, value)
 *                 reverse_dict[value] = name
 */
        __pyx_t_4 = PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":710
 *             for name, value in find_constants(constants):
 *                 value = int(value)
 *                 setattr(cls, name, value)             # <<<<<<<<<<<<<<
 *                 reverse_dict[value] = name
 * 
 */
        __pyx_t_14 = PyObject_SetAttr(__pyx_v_cls, __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":711
 *                 value = int(value)
 *                 setattr(cls, name, value)
 *                 reverse_dict[value] = name             # <<<<<<<<<<<<<<
 * 
 *     # discard the global tuple references after use
 */
        if (unlikely(PyDict_SetItem(__pyx_v_reverse_dict, __pyx_v_value, __pyx_v_name) < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":714
 * 
 *     # discard the global tuple references after use
 *     __ERROR_LEVELS = __ERROR_DOMAINS = __PARSER_ERROR_TYPES = __RELAXNG_ERROR_TYPES = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_LEVELS, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_DOMAINS, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES, Py_None);
  __Pyx_GIVEREF(Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":694
 * ################################################################################
 * 
 * cdef __initErrorConstants():             # <<<<<<<<<<<<<<
 *     u"Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree.__initErrorConstants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_find_constants);
  __Pyx_XDECREF(__pyx_v_const_defs);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XDECREF(__pyx_v_constant_tuple);
  __Pyx_XDECREF(__pyx_v_reverse_dict);
  __Pyx_XDECREF(__pyx_v_constants);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":361
 *     cdef _BaseParser _parser
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # if there are no more references to the document, it is safe
 *         # to clean the whole thing up, as all nodes have a reference to
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_9_Document___dealloc__(((struct LxmlDocument *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_9_Document___dealloc__(struct LxmlDocument *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":365
 *         # to clean the whole thing up, as all nodes have a reference to
 *         # the document
 *         tree.xmlFreeDoc(self._c_doc)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  xmlFreeDoc(__pyx_v_self->_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":361
 *     cdef _BaseParser _parser
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # if there are no more references to the document, it is safe
 *         # to clean the whole thing up, as all nodes have a reference to
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":368
 * 
 *     @cython.final
 *     cdef getroot(self):             # <<<<<<<<<<<<<<
 *         # return an element proxy for the document root
 *         cdef xmlNode* c_node
 */

static PyObject *__pyx_f_4lxml_5etree_9_Document_getroot(struct LxmlDocument *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getroot", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":371
 *         # return an element proxy for the document root
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = xmlDocGetRootElement(__pyx_v_self->_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":372
 *         cdef xmlNode* c_node
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":373
 *         c_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":374
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self, c_node)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_self, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":368
 * 
 *     @cython.final
 *     cdef getroot(self):             # <<<<<<<<<<<<<<
 *         # return an element proxy for the document root
 *         cdef xmlNode* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.getroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":377
 * 
 *     @cython.final
 *     cdef bint hasdoctype(self):             # <<<<<<<<<<<<<<
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL
 */

static int __pyx_f_4lxml_5etree_9_Document_hasdoctype(struct LxmlDocument *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("hasdoctype", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":379
 *     cdef bint hasdoctype(self):
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_1 = (__pyx_v_self->_c_doc != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_self->_c_doc->intSubset != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":377
 * 
 *     @cython.final
 *     cdef bint hasdoctype(self):             # <<<<<<<<<<<<<<
 *         # DOCTYPE gets parsed into internal subset (xmlDTD*)
 *         return self._c_doc is not NULL and self._c_doc.intSubset is not NULL
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":382
 * 
 *     @cython.final
 *     cdef getdoctype(self):             # <<<<<<<<<<<<<<
 *         # get doctype info: root tag, public/system ID (or None if not known)
 *         cdef tree.xmlDtd* c_dtd
 */

static PyObject *__pyx_f_4lxml_5etree_9_Document_getdoctype(struct LxmlDocument *__pyx_v_self) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_root_node;
  PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_sys_url = NULL;
  PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDtd *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getdoctype", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":386
 *         cdef tree.xmlDtd* c_dtd
 *         cdef xmlNode* c_root_node
 *         public_id = None             # <<<<<<<<<<<<<<
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_public_id = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":387
 *         cdef xmlNode* c_root_node
 *         public_id = None
 *         sys_url   = None             # <<<<<<<<<<<<<<
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_sys_url = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":388
 *         public_id = None
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:
 */
  __pyx_t_1 = __pyx_v_self->_c_doc->intSubset;
  __pyx_v_c_dtd = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":389
 *         sys_url   = None
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 */
  __pyx_t_2 = ((__pyx_v_c_dtd != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":390
 *         c_dtd = self._c_doc.intSubset
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
 */
    __pyx_t_2 = ((__pyx_v_c_dtd->ExternalID != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":391
 *         if c_dtd is not NULL:
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->ExternalID); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_public_id, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":392
 *             if c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
 */
    __pyx_t_2 = ((__pyx_v_c_dtd->SystemID != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":393
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->SystemID); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_sys_url, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":394
 *             if c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset             # <<<<<<<<<<<<<<
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:
 */
  __pyx_t_1 = __pyx_v_self->_c_doc->extSubset;
  __pyx_v_c_dtd = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":395
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:             # <<<<<<<<<<<<<<
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 */
  __pyx_t_2 = ((__pyx_v_c_dtd != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":396
 *         c_dtd = self._c_doc.extSubset
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:             # <<<<<<<<<<<<<<
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((!__pyx_t_2) != 0);
    if (__pyx_t_4) {
      __pyx_t_2 = ((__pyx_v_c_dtd->ExternalID != NULL) != 0);
      __pyx_t_5 = __pyx_t_2;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":397
 *         if c_dtd is not NULL:
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->ExternalID); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_public_id, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":398
 *             if not public_id and c_dtd.ExternalID is not NULL:
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:             # <<<<<<<<<<<<<<
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_sys_url); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((!__pyx_t_5) != 0);
    if (__pyx_t_4) {
      __pyx_t_5 = ((__pyx_v_c_dtd->SystemID != NULL) != 0);
      __pyx_t_2 = __pyx_t_5;
    } else {
      __pyx_t_2 = __pyx_t_4;
    }
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":399
 *                 public_id = funicode(c_dtd.ExternalID)
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_dtd->SystemID); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_sys_url, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":400
 *             if not sys_url and c_dtd.SystemID is not NULL:
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)             # <<<<<<<<<<<<<<
 *         if c_root_node is NULL:
 *             root_name = None
 */
  __pyx_v_c_root_node = xmlDocGetRootElement(__pyx_v_self->_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":401
 *                 sys_url = funicode(c_dtd.SystemID)
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:             # <<<<<<<<<<<<<<
 *             root_name = None
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_c_root_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":402
 *         c_root_node = tree.xmlDocGetRootElement(self._c_doc)
 *         if c_root_node is NULL:
 *             root_name = None             # <<<<<<<<<<<<<<
 *         else:
 *             root_name = funicode(c_root_node.name)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_root_name = Py_None;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":404
 *             root_name = None
 *         else:
 *             root_name = funicode(c_root_node.name)             # <<<<<<<<<<<<<<
 *         return (root_name, public_id, sys_url)
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_root_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_root_name = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":405
 *         else:
 *             root_name = funicode(c_root_node.name)
 *         return (root_name, public_id, sys_url)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_root_name);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_root_name);
  __Pyx_GIVEREF(__pyx_v_root_name);
  __Pyx_INCREF(__pyx_v_public_id);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  __Pyx_INCREF(__pyx_v_sys_url);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_sys_url);
  __Pyx_GIVEREF(__pyx_v_sys_url);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":382
 * 
 *     @cython.final
 *     cdef getdoctype(self):             # <<<<<<<<<<<<<<
 *         # get doctype info: root tag, public/system ID (or None if not known)
 *         cdef tree.xmlDtd* c_dtd
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Document.getdoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_sys_url);
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":408
 * 
 *     @cython.final
 *     cdef getxmlinfo(self):             # <<<<<<<<<<<<<<
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 */

static PyObject *__pyx_f_4lxml_5etree_9_Document_getxmlinfo(struct LxmlDocument *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_version = NULL;
  PyObject *__pyx_v_encoding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getxmlinfo", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":410
 *     cdef getxmlinfo(self):
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc             # <<<<<<<<<<<<<<
 *         if c_doc.version is NULL:
 *             version = None
 */
  __pyx_t_1 = __pyx_v_self->_c_doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":411
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:             # <<<<<<<<<<<<<<
 *             version = None
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_c_doc->version == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":412
 *         cdef xmlDoc* c_doc = self._c_doc
 *         if c_doc.version is NULL:
 *             version = None             # <<<<<<<<<<<<<<
 *         else:
 *             version = funicode(c_doc.version)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_version = Py_None;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":414
 *             version = None
 *         else:
 *             version = funicode(c_doc.version)             # <<<<<<<<<<<<<<
 *         if c_doc.encoding is NULL:
 *             encoding = None
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->version); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_version = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":415
 *         else:
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:             # <<<<<<<<<<<<<<
 *             encoding = None
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_c_doc->encoding == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":416
 *             version = funicode(c_doc.version)
 *         if c_doc.encoding is NULL:
 *             encoding = None             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = funicode(c_doc.encoding)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_encoding = Py_None;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":418
 *             encoding = None
 *         else:
 *             encoding = funicode(c_doc.encoding)             # <<<<<<<<<<<<<<
 *         return (version, encoding)
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_doc->encoding); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_encoding = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":419
 *         else:
 *             encoding = funicode(c_doc.encoding)
 *         return (version, encoding)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_version);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_version);
  __Pyx_GIVEREF(__pyx_v_version);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":408
 * 
 *     @cython.final
 *     cdef getxmlinfo(self):             # <<<<<<<<<<<<<<
 *         # return XML version and encoding (or None if not known)
 *         cdef xmlDoc* c_doc = self._c_doc
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Document.getxmlinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":422
 * 
 *     @cython.final
 *     cdef isstandalone(self):             # <<<<<<<<<<<<<<
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 */

static PyObject *__pyx_f_4lxml_5etree_9_Document_isstandalone(struct LxmlDocument *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("isstandalone", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":425
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_c_doc->standalone == -1) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":426
 *         # False for "standalone=false", None if not provided
 *         if self._c_doc.standalone == -1:
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":428
 *             return None
 *         else:
 *             return <bint>(self._c_doc.standalone == 1)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_self->_c_doc->standalone == 1) != 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":422
 * 
 *     @cython.final
 *     cdef isstandalone(self):             # <<<<<<<<<<<<<<
 *         # returns True for "standalone=true",
 *         # False for "standalone=false", None if not provided
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Document.isstandalone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":431
 * 
 *     @cython.final
 *     cdef bytes buildNewPrefix(self):             # <<<<<<<<<<<<<<
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 */

static PyObject *__pyx_f_4lxml_5etree_9_Document_buildNewPrefix(struct LxmlDocument *__pyx_v_self) {
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("buildNewPrefix", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":434
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):             # <<<<<<<<<<<<<<
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
 */
  __pyx_t_1 = __pyx_v_4lxml_5etree__PREFIX_CACHE;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((__pyx_v_self->_ns_counter < __pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":435
 *         cdef bytes ns
 *         if self._ns_counter < len(_PREFIX_CACHE):
 *             ns = _PREFIX_CACHE[self._ns_counter]             # <<<<<<<<<<<<<<
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 */
    if (unlikely(__pyx_v_4lxml_5etree__PREFIX_CACHE == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_4lxml_5etree__PREFIX_CACHE, __pyx_v_self->_ns_counter, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ns = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":437
 *             ns = _PREFIX_CACHE[self._ns_counter]
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)             # <<<<<<<<<<<<<<
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail
 */
    __pyx_t_1 = PyBytes_FromFormat(__pyx_k_ns_d, __pyx_v_self->_ns_counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_ns = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":438
 *         else:
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:             # <<<<<<<<<<<<<<
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 */
  __pyx_t_3 = (__pyx_v_self->_prefix_tail != ((PyObject*)Py_None));
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":439
 *             ns = python.PyBytes_FromFormat("ns%d", self._ns_counter)
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail             # <<<<<<<<<<<<<<
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:
 */
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_ns, __pyx_v_self->_prefix_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ns, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":440
 *         if self._prefix_tail is not None:
 *             ns += self._prefix_tail
 *         self._ns_counter += 1             # <<<<<<<<<<<<<<
 *         if self._ns_counter < 0:
 *             # overflow!
 */
  __pyx_v_self->_ns_counter = (__pyx_v_self->_ns_counter + 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":441
 *             ns += self._prefix_tail
 *         self._ns_counter += 1
 *         if self._ns_counter < 0:             # <<<<<<<<<<<<<<
 *             # overflow!
 *             self._ns_counter = 0
 */
  __pyx_t_4 = ((__pyx_v_self->_ns_counter < 0) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":443
 *         if self._ns_counter < 0:
 *             # overflow!
 *             self._ns_counter = 0             # <<<<<<<<<<<<<<
 *             if self._prefix_tail is None:
 *                 self._prefix_tail = b"A"
 */
    __pyx_v_self->_ns_counter = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":444
 *             # overflow!
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_tail = b"A"
 *             else:
 */
    __pyx_t_4 = (__pyx_v_self->_prefix_tail == ((PyObject*)Py_None));
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":445
 *             self._ns_counter = 0
 *             if self._prefix_tail is None:
 *                 self._prefix_tail = b"A"             # <<<<<<<<<<<<<<
 *             else:
 *                 self._prefix_tail += b"A"
 */
      __Pyx_INCREF(__pyx_n_b_A);
      __Pyx_GIVEREF(__pyx_n_b_A);
      __Pyx_GOTREF(__pyx_v_self->_prefix_tail);
      __Pyx_DECREF(__pyx_v_self->_prefix_tail);
      __pyx_v_self->_prefix_tail = __pyx_n_b_A;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":447
 *                 self._prefix_tail = b"A"
 *             else:
 *                 self._prefix_tail += b"A"             # <<<<<<<<<<<<<<
 *         return ns
 * 
 */
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_self->_prefix_tail, __pyx_n_b_A); 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_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_prefix_tail);
      __Pyx_DECREF(__pyx_v_self->_prefix_tail);
      __pyx_v_self->_prefix_tail = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":448
 *             else:
 *                 self._prefix_tail += b"A"
 *         return ns             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ns);
  __pyx_r = __pyx_v_ns;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":431
 * 
 *     @cython.final
 *     cdef bytes buildNewPrefix(self):             # <<<<<<<<<<<<<<
 *         # get a new unique prefix ("nsX") for this document
 *         cdef bytes ns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Document.buildNewPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":451
 * 
 *     @cython.final
 *     cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                    const_xmlChar* c_href, const_xmlChar* c_prefix,
 *                                    bint is_attribute) except NULL:
 */

static xmlNs *__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_prefix, int __pyx_v_is_attribute) {
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_prefix = NULL;
  xmlNs *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findOrBuildNodeNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":460
 *         cdef xmlNs* c_doc_ns
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 u"invalid node type %d, expected %d" % (
 */
  __pyx_t_1 = ((__pyx_v_c_node->type != XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":461
 *         cdef python.PyObject* dict_result
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \             # <<<<<<<<<<<<<<
 *                 u"invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0))) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":463
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 u"invalid node type %d, expected %d" % (
 *                 c_node.type, tree.XML_ELEMENT_NODE)             # <<<<<<<<<<<<<<
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 */
        __pyx_t_2 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyInt_FromLong(XML_ELEMENT_NODE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __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 = 463; __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;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":462
 *         if c_node.type != tree.XML_ELEMENT_NODE:
 *             assert c_node.type == tree.XML_ELEMENT_NODE, \
 *                 u"invalid node type %d, expected %d" % (             # <<<<<<<<<<<<<<
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
 */
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_invalid_node_type_d_expected_d, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    #endif
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":465
 *                 c_node.type, tree.XML_ELEMENT_NODE)
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)             # <<<<<<<<<<<<<<
 *         if c_ns is not NULL:
 *             if is_attribute and c_ns.prefix is NULL:
 */
  __pyx_v_c_ns = __pyx_f_4lxml_5etree__searchNsByHref(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_is_attribute);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":466
 *         # look for existing ns declaration
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:             # <<<<<<<<<<<<<<
 *             if is_attribute and c_ns.prefix is NULL:
 *                 # do not put namespaced attributes into the default
 */
  __pyx_t_1 = ((__pyx_v_c_ns != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":467
 *         c_ns = _searchNsByHref(c_node, c_href, is_attribute)
 *         if c_ns is not NULL:
 *             if is_attribute and c_ns.prefix is NULL:             # <<<<<<<<<<<<<<
 *                 # do not put namespaced attributes into the default
 *                 # namespace as this would break serialisation
 */
    if ((__pyx_v_is_attribute != 0)) {
      __pyx_t_1 = ((__pyx_v_c_ns->prefix == NULL) != 0);
      __pyx_t_5 = __pyx_t_1;
    } else {
      __pyx_t_5 = (__pyx_v_is_attribute != 0);
    }
    if (__pyx_t_5) {
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":472
 *                 pass
 *             else:
 *                 return c_ns             # <<<<<<<<<<<<<<
 * 
 *         # none found => determine a suitable new prefix
 */
      __pyx_r = __pyx_v_c_ns;
      goto __pyx_L0;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":475
 * 
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 */
  __pyx_t_5 = ((__pyx_v_c_prefix == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":477
 *         if c_prefix is NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result
 */
    __pyx_t_3 = __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_href)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":476
 *         # none found => determine a suitable new prefix
 *         if c_prefix is NULL:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:
 */
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_3, __pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":478
 *             dict_result = python.PyDict_GetItem(
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 prefix = <object>dict_result
 *             else:
 */
    __pyx_t_5 = ((__pyx_v_dict_result != NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":479
 *                 _DEFAULT_NAMESPACE_PREFIXES, <unsigned char*>c_href)
 *             if dict_result is not NULL:
 *                 prefix = <object>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 prefix = self.buildNewPrefix()
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":481
 *                 prefix = <object>dict_result
 *             else:
 *                 prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _xcstr(prefix)
 * 
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_buildNewPrefix(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_prefix = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":482
 *             else:
 *                 prefix = self.buildNewPrefix()
 *             c_prefix = _xcstr(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # make sure the prefix is not in use already
 */
    __pyx_v_c_prefix = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":485
 * 
 *         # make sure the prefix is not in use already
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:             # <<<<<<<<<<<<<<
 *             prefix = self.buildNewPrefix()
 *             c_prefix = _xcstr(prefix)
 */
  while (1) {
    __pyx_t_5 = ((xmlSearchNs(__pyx_v_self->_c_doc, __pyx_v_c_node, __pyx_v_c_prefix) != NULL) != 0);
    if (!__pyx_t_5) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":486
 *         # make sure the prefix is not in use already
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:
 *             prefix = self.buildNewPrefix()             # <<<<<<<<<<<<<<
 *             c_prefix = _xcstr(prefix)
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_buildNewPrefix(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":487
 *         while tree.xmlSearchNs(self._c_doc, c_node, c_prefix) is not NULL:
 *             prefix = self.buildNewPrefix()
 *             c_prefix = _xcstr(prefix)             # <<<<<<<<<<<<<<
 * 
 *         # declare the namespace and return it
 */
    __pyx_v_c_prefix = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":490
 * 
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)             # <<<<<<<<<<<<<<
 *         if c_ns is NULL:
 *             raise MemoryError()
 */
  __pyx_v_c_ns = xmlNewNs(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_prefix);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":491
 *         # declare the namespace and return it
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return c_ns
 */
  __pyx_t_5 = ((__pyx_v_c_ns == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":492
 *         c_ns = tree.xmlNewNs(c_node, c_href, c_prefix)
 *         if c_ns is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return c_ns
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":493
 *         if c_ns is NULL:
 *             raise MemoryError()
 *         return c_ns             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = __pyx_v_c_ns;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":451
 * 
 *     @cython.final
 *     cdef xmlNs* _findOrBuildNodeNs(self, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                    const_xmlChar* c_href, const_xmlChar* c_prefix,
 *                                    bint is_attribute) except NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Document._findOrBuildNodeNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":496
 * 
 *     @cython.final
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:             # <<<<<<<<<<<<<<
 *         u"Lookup namespace structure and set it for the node."
 *         c_ns = self._findOrBuildNodeNs(c_node, c_href, NULL, 0)
 */

static int __pyx_f_4lxml_5etree_9_Document__setNodeNs(struct LxmlDocument *__pyx_v_self, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNs *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setNodeNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":498
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:
 *         u"Lookup namespace structure and set it for the node."
 *         c_ns = self._findOrBuildNodeNs(c_node, c_href, NULL, 0)             # <<<<<<<<<<<<<<
 *         tree.xmlSetNs(c_node, c_ns)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_self, __pyx_v_c_node, __pyx_v_c_href, NULL, 0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_ns = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":499
 *         u"Lookup namespace structure and set it for the node."
 *         c_ns = self._findOrBuildNodeNs(c_node, c_href, NULL, 0)
 *         tree.xmlSetNs(c_node, c_ns)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple __initPrefixCache():
 */
  xmlSetNs(__pyx_v_c_node, __pyx_v_c_ns);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":496
 * 
 *     @cython.final
 *     cdef int _setNodeNs(self, xmlNode* c_node, const_xmlChar* c_href) except -1:             # <<<<<<<<<<<<<<
 *         u"Lookup namespace structure and set it for the node."
 *         c_ns = self._findOrBuildNodeNs(c_node, c_href, NULL, 0)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Document._setNodeNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":501
 *         tree.xmlSetNs(c_node, c_ns)
 * 
 * cdef tuple __initPrefixCache():             # <<<<<<<<<<<<<<
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
 */

static PyObject *__pyx_f_4lxml_5etree___initPrefixCache(void) {
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__initPrefixCache", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":503
 * cdef tuple __initPrefixCache():
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)             # <<<<<<<<<<<<<<
 *                    for i in range(30) ])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  for (__pyx_t_2 = 0; __pyx_t_2 < 30; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
    __pyx_t_3 = PyBytes_FromFormat(__pyx_k_ns_d, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":501
 *         tree.xmlSetNs(c_node, c_ns)
 * 
 * cdef tuple __initPrefixCache():             # <<<<<<<<<<<<<<
 *     cdef int i
 *     return tuple([ python.PyBytes_FromFormat("ns%d", i)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__initPrefixCache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":508
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef _Document result
 *     result = _Document.__new__(_Document)
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__documentFactory(xmlDoc *__pyx_v_c_doc, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  struct LxmlDocument *__pyx_v_result = 0;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_documentFactory", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":510
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):
 *     cdef _Document result
 *     result = _Document.__new__(_Document)             # <<<<<<<<<<<<<<
 *     result._c_doc = c_doc
 *     result._ns_counter = 0
 */
  __pyx_t_1 = __pyx_tp_new_4lxml_5etree__Document(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Document)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Document)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_result = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":511
 *     cdef _Document result
 *     result = _Document.__new__(_Document)
 *     result._c_doc = c_doc             # <<<<<<<<<<<<<<
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 */
  __pyx_v_result->_c_doc = __pyx_v_c_doc;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":512
 *     result = _Document.__new__(_Document)
 *     result._c_doc = c_doc
 *     result._ns_counter = 0             # <<<<<<<<<<<<<<
 *     result._prefix_tail = None
 *     if parser is None:
 */
  __pyx_v_result->_ns_counter = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":513
 *     result._c_doc = c_doc
 *     result._ns_counter = 0
 *     result._prefix_tail = None             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_result->_prefix_tail);
  __Pyx_DECREF(__pyx_v_result->_prefix_tail);
  __pyx_v_result->_prefix_tail = ((PyObject*)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":514
 *     result._ns_counter = 0
 *     result._prefix_tail = None
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":515
 *     result._prefix_tail = None
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     result._parser = parser
 *     return result
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":516
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_result->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_parser));
  __pyx_v_result->_parser = __pyx_v_parser;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":517
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     result._parser = parser
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":508
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     cdef _Document result
 *     result = _Document.__new__(_Document)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._documentFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":523
 *     u"Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_tree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.DocInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo___cinit__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), __pyx_v_tree);

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

static int __pyx_pf_4lxml_5etree_7DocInfo___cinit__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_tree) {
  PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_system_url = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":525
 *     def __cinit__(self, tree):
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)             # <<<<<<<<<<<<<<
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":526
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, u"Could not find root node"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":527
 *         self._doc = _documentOrRaise(tree)
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Could not find root node"
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_root_name); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = (!__pyx_t_7);
  if (__pyx_t_8) {
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_7) {
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_7;
    }
    __pyx_t_7 = __pyx_t_10;
  } else {
    __pyx_t_7 = __pyx_t_8;
  }
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":528
 *         root_name, public_id, system_url = self._doc.getdoctype()
 *         if not root_name and (public_id or system_url):
 *             raise ValueError, u"Could not find root node"             # <<<<<<<<<<<<<<
 * 
 *     property root_name:
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Could_not_find_root_node, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":523
 *     u"Document information provided by parser and DTD."
 *     cdef _Document _doc
 *     def __cinit__(self, tree):             # <<<<<<<<<<<<<<
 *         u"Create a DocInfo object for an ElementTree object or root Element."
 *         self._doc = _documentOrRaise(tree)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":532
 *     property root_name:
 *         u"Returns the name of the root node as defined by the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return root_name
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9root_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9root_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9root_name___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_v_root_name = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":533
 *         u"Returns the name of the root node as defined by the DOCTYPE."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return root_name
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":534
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return root_name             # <<<<<<<<<<<<<<
 * 
 *     property public_id:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_root_name);
  __pyx_r = __pyx_v_root_name;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":532
 *     property root_name:
 *         u"Returns the name of the root node as defined by the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return root_name
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.root_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":538
 *     property public_id:
 *         u"Returns the public ID of the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9public_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_9public_id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_9public_id___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_v_public_id = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":539
 *         u"Returns the public ID of the DOCTYPE."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return public_id
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":540
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id             # <<<<<<<<<<<<<<
 * 
 *     property system_url:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_public_id);
  __pyx_r = __pyx_v_public_id;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":538
 *     property public_id:
 *         u"Returns the public ID of the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return public_id
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.public_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":544
 *     property system_url:
 *         u"Returns the system ID of the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10system_url_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10system_url_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10system_url___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_root_name = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":545
 *         u"Returns the system ID of the DOCTYPE."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             return system_url
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":546
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url             # <<<<<<<<<<<<<<
 * 
 *     property xml_version:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_system_url);
  __pyx_r = __pyx_v_system_url;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":544
 *     property system_url:
 *         u"Returns the system ID of the DOCTYPE."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             return system_url
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.system_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":550
 *     property xml_version:
 *         u"Returns the XML version as declared by the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return xml_version
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11xml_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11xml_version_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11xml_version___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_v_xml_version = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_encoding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":551
 *         u"Returns the XML version as declared by the document."
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()             # <<<<<<<<<<<<<<
 *             return xml_version
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getxmlinfo(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_xml_version = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_encoding = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":552
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return xml_version             # <<<<<<<<<<<<<<
 * 
 *     property encoding:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_xml_version);
  __pyx_r = __pyx_v_xml_version;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":550
 *     property xml_version:
 *         u"Returns the XML version as declared by the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return xml_version
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.xml_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xml_version);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":556
 *     property encoding:
 *         u"Returns the encoding name as declared by the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return encoding
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_8encoding_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_8encoding_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_8encoding___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_xml_version = NULL;
  PyObject *__pyx_v_encoding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":557
 *         u"Returns the encoding name as declared by the document."
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()             # <<<<<<<<<<<<<<
 *             return encoding
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getxmlinfo(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_xml_version = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_encoding = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":558
 *         def __get__(self):
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return encoding             # <<<<<<<<<<<<<<
 * 
 *     property standalone:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_encoding);
  __pyx_r = __pyx_v_encoding;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":556
 *     property encoding:
 *         u"Returns the encoding name as declared by the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             xml_version, encoding = self._doc.getxmlinfo()
 *             return encoding
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.DocInfo.encoding.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xml_version);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":568
 *         ``standalone`` flag was set to ``'yes'`` or not.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._doc.isstandalone()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10standalone_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_10standalone_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_10standalone___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":569
 *         """
 *         def __get__(self):
 *             return self._doc.isstandalone()             # <<<<<<<<<<<<<<
 * 
 *     property URL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_isstandalone(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":568
 *         ``standalone`` flag was set to ``'yes'`` or not.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._doc.isstandalone()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.standalone.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":573
 *     property URL:
 *         u"The source URL of the document (or None if unknown)."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3URL_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_3URL_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_3URL___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":574
 *         u"The source URL of the document (or None if unknown)."
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 */
  __pyx_t_1 = ((__pyx_v_self->_doc->_c_doc->URL == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":575
 *         def __get__(self):
 *             if self._doc._c_doc.URL is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":576
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *         def __set__(self, url):
 *             url = _encodeFilename(url)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_doc->_c_doc->URL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":573
 *     property URL:
 *         u"The source URL of the document (or None if unknown)."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._doc._c_doc.URL is NULL:
 *                 return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DocInfo.URL.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":577
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7DocInfo_3URL_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/
static int __pyx_pw_4lxml_5etree_7DocInfo_3URL_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_3URL_2__set__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self), ((PyObject *)__pyx_v_url));

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

static int __pyx_pf_4lxml_5etree_7DocInfo_3URL_2__set__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self, PyObject *__pyx_v_url) {
  const xmlChar *__pyx_v_c_oldurl;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  const xmlChar *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":578
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":579
 *         def __set__(self, url):
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL             # <<<<<<<<<<<<<<
 *             if url is None:
 *                 self._doc._c_doc.URL = NULL
 */
  __pyx_t_2 = __pyx_v_self->_doc->_c_doc->URL;
  __pyx_v_c_oldurl = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":580
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 self._doc._c_doc.URL = NULL
 *             else:
 */
  __pyx_t_3 = (__pyx_v_url == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":581
 *             c_oldurl = self._doc._c_doc.URL
 *             if url is None:
 *                 self._doc._c_doc.URL = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 */
    __pyx_v_self->_doc->_c_doc->URL = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":583
 *                 self._doc._c_doc.URL = NULL
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))             # <<<<<<<<<<<<<<
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(<void*>c_oldurl)
 */
    __pyx_v_self->_doc->_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_url));
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":584
 *             else:
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<void*>c_oldurl)
 * 
 */
  __pyx_t_4 = ((__pyx_v_c_oldurl != NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":585
 *                 self._doc._c_doc.URL = tree.xmlStrdup(_xcstr(url))
 *             if c_oldurl is not NULL:
 *                 tree.xmlFree(<void*>c_oldurl)             # <<<<<<<<<<<<<<
 * 
 *     property doctype:
 */
    xmlFree(((void *)__pyx_v_c_oldurl));
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":577
 *                 return None
 *             return _decodeFilename(self._doc._c_doc.URL)
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             url = _encodeFilename(url)
 *             c_oldurl = self._doc._c_doc.URL
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.URL.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":589
 *     property doctype:
 *         u"Returns a DOCTYPE declaration string for the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_7doctype_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_7doctype_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_7doctype___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_v_root_name = NULL;
  PyObject *__pyx_v_public_id = NULL;
  PyObject *__pyx_v_system_url = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":590
 *         u"Returns a DOCTYPE declaration string for the document."
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()             # <<<<<<<<<<<<<<
 *             if public_id:
 *                 if system_url:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getdoctype(__pyx_v_self->_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_root_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_public_id = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_system_url = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":591
 *         def __get__(self):
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:             # <<<<<<<<<<<<<<
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_public_id); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":592
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:
 *                 if system_url:             # <<<<<<<<<<<<<<
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (
 *                         root_name, public_id, system_url)
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":593
 *             if public_id:
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (             # <<<<<<<<<<<<<<
 *                         root_name, public_id, system_url)
 *                 else:
 */
      __Pyx_XDECREF(__pyx_r);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":594
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (
 *                         root_name, public_id, system_url)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_root_name);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_root_name);
      __Pyx_GIVEREF(__pyx_v_root_name);
      __Pyx_INCREF(__pyx_v_public_id);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_public_id);
      __Pyx_GIVEREF(__pyx_v_public_id);
      __Pyx_INCREF(__pyx_v_system_url);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_system_url);
      __Pyx_GIVEREF(__pyx_v_system_url);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":593
 *             if public_id:
 *                 if system_url:
 *                     return u'<!DOCTYPE %s PUBLIC "%s" "%s">' % (             # <<<<<<<<<<<<<<
 *                         root_name, public_id, system_url)
 *                 else:
 */
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_DOCTYPE_s_PUBLIC_s_s, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":596
 *                         root_name, public_id, system_url)
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (             # <<<<<<<<<<<<<<
 *                         root_name, public_id)
 *             elif system_url:
 */
      __Pyx_XDECREF(__pyx_r);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":597
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (
 *                         root_name, public_id)             # <<<<<<<<<<<<<<
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_root_name);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_root_name);
      __Pyx_GIVEREF(__pyx_v_root_name);
      __Pyx_INCREF(__pyx_v_public_id);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_public_id);
      __Pyx_GIVEREF(__pyx_v_public_id);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":596
 *                         root_name, public_id, system_url)
 *                 else:
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (             # <<<<<<<<<<<<<<
 *                         root_name, public_id)
 *             elif system_url:
 */
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_DOCTYPE_s_PUBLIC_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":598
 *                     return u'<!DOCTYPE %s PUBLIC "%s">' % (
 *                         root_name, public_id)
 *             elif system_url:             # <<<<<<<<<<<<<<
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 *                     root_name, system_url)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_system_url); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":599
 *                         root_name, public_id)
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (             # <<<<<<<<<<<<<<
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":600
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 *                     root_name, system_url)             # <<<<<<<<<<<<<<
 *             elif self._doc.hasdoctype():
 *                 return u'<!DOCTYPE %s>' % root_name
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_root_name);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_root_name);
    __Pyx_GIVEREF(__pyx_v_root_name);
    __Pyx_INCREF(__pyx_v_system_url);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_system_url);
    __Pyx_GIVEREF(__pyx_v_system_url);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":599
 *                         root_name, public_id)
 *             elif system_url:
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (             # <<<<<<<<<<<<<<
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():
 */
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_DOCTYPE_s_SYSTEM_s, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":601
 *                 return u'<!DOCTYPE %s SYSTEM "%s">' % (
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():             # <<<<<<<<<<<<<<
 *                 return u'<!DOCTYPE %s>' % root_name
 *             else:
 */
  __pyx_t_7 = (__pyx_f_4lxml_5etree_9_Document_hasdoctype(__pyx_v_self->_doc) != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":602
 *                     root_name, system_url)
 *             elif self._doc.hasdoctype():
 *                 return u'<!DOCTYPE %s>' % root_name             # <<<<<<<<<<<<<<
 *             else:
 *                 return u""
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_DOCTYPE_s, __pyx_v_root_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":604
 *                 return u'<!DOCTYPE %s>' % root_name
 *             else:
 *                 return u""             # <<<<<<<<<<<<<<
 * 
 *     property internalDTD:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_u__15);
    __pyx_r = __pyx_kp_u__15;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":589
 *     property doctype:
 *         u"Returns a DOCTYPE declaration string for the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             root_name, public_id, system_url = self._doc.getdoctype()
 *             if public_id:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.DocInfo.doctype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root_name);
  __Pyx_XDECREF(__pyx_v_public_id);
  __Pyx_XDECREF(__pyx_v_system_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":608
 *     property internalDTD:
 *         u"Returns a DTD validator based on the internal subset of the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11internalDTD_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11internalDTD_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11internalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":609
 *         u"Returns a DTD validator based on the internal subset of the document."
 *         def __get__(self):
 *             return _dtdFactory(self._doc._c_doc.intSubset)             # <<<<<<<<<<<<<<
 * 
 *     property externalDTD:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__dtdFactory(__pyx_v_self->_doc->_c_doc->intSubset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":608
 *     property internalDTD:
 *         u"Returns a DTD validator based on the internal subset of the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _dtdFactory(self._doc._c_doc.intSubset)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.internalDTD.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":613
 *     property externalDTD:
 *         u"Returns a DTD validator based on the external subset of the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _dtdFactory(self._doc._c_doc.extSubset)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11externalDTD_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7DocInfo_11externalDTD_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(((struct __pyx_obj_4lxml_5etree_DocInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7DocInfo_11externalDTD___get__(struct __pyx_obj_4lxml_5etree_DocInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":614
 *         u"Returns a DTD validator based on the external subset of the document."
 *         def __get__(self):
 *             return _dtdFactory(self._doc._c_doc.extSubset)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__dtdFactory(__pyx_v_self->_doc->_c_doc->extSubset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":613
 *     property externalDTD:
 *         u"Returns a DTD validator based on the external subset of the document."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _dtdFactory(self._doc._c_doc.extSubset)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.DocInfo.externalDTD.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":630
 *     cdef object _tag
 * 
 *     def _init(self):             # <<<<<<<<<<<<<<
 *         u"""_init(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_1_init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element__init[] = "_init(self)\n\n        Called after object initialisation.  Custom subclasses may override\n        this if they recursively call _init() in the superclasses.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_1_init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element__init(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element__init(CYTHON_UNUSED struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init", 0);

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":637
 *         """
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         #print "trying to free node:", <int>self._c_node
 *         #displayNode(self._c_node, 0)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_8_Element_2__dealloc__(((struct LxmlElement *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_8_Element_2__dealloc__(struct LxmlElement *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":640
 *         #print "trying to free node:", <int>self._c_node
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:             # <<<<<<<<<<<<<<
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)
 */
  __pyx_t_1 = ((__pyx_v_self->_c_node != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":641
 *         #displayNode(self._c_node, 0)
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)             # <<<<<<<<<<<<<<
 *             attemptDeallocation(self._c_node)
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__unregisterProxy(__pyx_v_self); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":642
 *         if self._c_node is not NULL:
 *             _unregisterProxy(self)
 *             attemptDeallocation(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
 */
    __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_self->_c_node);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":637
 *         """
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         #print "trying to free node:", <int>self._c_node
 *         #displayNode(self._c_node, 0)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._Element.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":646
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         u"""__setitem__(self, x, value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_4__setitem__[] = "__setitem__(self, x, value)\n\n        Replaces the given subelement index or slice.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__;
#endif
static int __pyx_pw_4lxml_5etree_8_Element_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4__setitem__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_8_Element_4__setitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_value) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  struct LxmlElement *__pyx_v_element = 0;
  int __pyx_v_left_to_right;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_step;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  xmlDoc *__pyx_t_6;
  xmlNode *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":651
 *         Replaces the given subelement index or slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_next
 *         cdef xmlDoc* c_source_doc
 */
  __pyx_v_c_node = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":656
 *         cdef _Element element
 *         cdef bint left_to_right
 *         cdef Py_ssize_t slicelength = 0, step = 0             # <<<<<<<<<<<<<<
 *         _assertValidNode(self)
 *         if value is None:
 */
  __pyx_v_slicelength = 0;
  __pyx_v_step = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":657
 *         cdef bint left_to_right
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if value is None:
 *             raise ValueError, u"cannot assign None"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":658
 *         cdef Py_ssize_t slicelength = 0, step = 0
 *         _assertValidNode(self)
 *         if value is None:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"cannot assign None"
 *         if isinstance(x, slice):
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":659
 *         _assertValidNode(self)
 *         if value is None:
 *             raise ValueError, u"cannot assign None"             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slice assignment
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_cannot_assign_None, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":660
 *         if value is None:
 *             raise ValueError, u"cannot assign None"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
  __pyx_t_3 = PySlice_Check(__pyx_v_x); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":662
 *         if isinstance(x, slice):
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 left_to_right = 1
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":663
 *             # slice assignment
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 left_to_right = 1
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_step > 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":664
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if step > 0:
 *                 left_to_right = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 left_to_right = 0
 */
      __pyx_v_left_to_right = 1;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":666
 *                 left_to_right = 1
 *             else:
 *                 left_to_right = 0             # <<<<<<<<<<<<<<
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 */
      __pyx_v_left_to_right = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":667
 *             else:
 *                 left_to_right = 0
 *                 step = -step             # <<<<<<<<<<<<<<
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return
 */
      __pyx_v_step = (-__pyx_v_step);
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":668
 *                 left_to_right = 0
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__replaceSlice(__pyx_v_self, __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step, __pyx_v_left_to_right, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":669
 *                 step = -step
 *             _replaceSlice(self, c_node, slicelength, step, left_to_right, value)
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             # otherwise: normal item assignment
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":672
 *         else:
 *             # otherwise: normal item assignment
 *             element = value             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 */
    if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_v_value;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_element = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":673
 *             # otherwise: normal item assignment
 *             element = value
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":674
 *             element = value
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 */
    __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":675
 *             _assertValidNode(element)
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"list index out of range"
 *             c_source_doc = element._c_node.doc
 */
    __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":676
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_u_list_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":677
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 *             c_source_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
 */
    __pyx_t_6 = __pyx_v_element->_c_node->doc;
    __pyx_v_c_source_doc = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":678
 *                 raise IndexError, u"list index out of range"
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)
 */
    __pyx_t_7 = __pyx_v_element->_c_node->next;
    __pyx_v_c_next = __pyx_t_7;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":679
 *             c_source_doc = element._c_node.doc
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":680
 *             c_next = element._c_node.next
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 */
    xmlReplaceNode(__pyx_v_c_node, __pyx_v_element->_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":681
 *             _removeText(c_node.next)
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):
 */
    __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":682
 *             tree.xmlReplaceNode(c_node, element._c_node)
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 *             if not attemptDeallocation(c_node):
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":683
 *             _moveTail(c_next, element._c_node)
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):             # <<<<<<<<<<<<<<
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 */
    __pyx_t_2 = ((!(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_node) != 0)) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":684
 *             moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 *             if not attemptDeallocation(c_node):
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, x):
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":646
 *     # MANIPULATORS
 * 
 *     def __setitem__(self, x, value):             # <<<<<<<<<<<<<<
 *         u"""__setitem__(self, x, value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":686
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""__delitem__(self, x)
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_6__delitem__[] = "__delitem__(self, x)\n\n        Deletes the given subelement or a slice.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__;
#endif
static int __pyx_pw_4lxml_5etree_8_Element_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_6__delitem__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static int __pyx_pf_4lxml_5etree_8_Element_6__delitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":691
 *         Deletes the given subelement or a slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step = 0, slicelength = 0
 */
  __pyx_v_c_node = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":693
 *         cdef xmlNode* c_node = NULL
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step = 0, slicelength = 0             # <<<<<<<<<<<<<<
 *         _assertValidNode(self)
 *         if isinstance(x, slice):
 */
  __pyx_v_step = 0;
  __pyx_v_slicelength = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":694
 *         cdef xmlNode* c_next
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slice deletion
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":695
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":697
 *         if isinstance(x, slice):
 *             # slice deletion
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":698
 *             # slice deletion
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):
 */
      __pyx_t_4 = __pyx_v_self->_c_node->children;
      __pyx_v_c_node = __pyx_t_4;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":699
 *             if _isFullSlice(<slice>x):
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
 */
      __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":700
 *                 c_node = self._c_node.children
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
 */
        __pyx_t_2 = ((!(_isElement(__pyx_v_c_node) != 0)) != 0);
        if (__pyx_t_2) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":701
 *                 if c_node is not NULL:
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
 */
          __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
          goto __pyx_L6;
        }
        __pyx_L6:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":702
 *                     if not _isElement(c_node):
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)
 */
        while (1) {
          __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
          if (!__pyx_t_2) break;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":703
 *                         c_node = _nextElement(c_node)
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                         _removeNode(self._doc, c_node)
 *                         c_node = c_next
 */
          __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":704
 *                     while c_node is not NULL:
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                         c_node = c_next
 *             else:
 */
          __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":705
 *                         c_next = _nextElement(c_node)
 *                         _removeNode(self._doc, c_node)
 *                         c_node = c_next             # <<<<<<<<<<<<<<
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
          __pyx_v_c_node = __pyx_v_c_next;
        }
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":707
 *                         c_node = c_next
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *                 _deleteSlice(self._doc, c_node, slicelength, step)
 *         else:
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":708
 *             else:
 *                 _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *                 _deleteSlice(self._doc, c_node, slicelength, step)             # <<<<<<<<<<<<<<
 *         else:
 *             # item deletion
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_1 = __pyx_f_4lxml_5etree__deleteSlice(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node, __pyx_v_slicelength, __pyx_v_step); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":711
 *         else:
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"index out of range: %d" % x
 */
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_6);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":712
 *             # item deletion
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"index out of range: %d" % x
 *             _removeText(c_node.next)
 */
    __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":713
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"index out of range: %d" % x             # <<<<<<<<<<<<<<
 *             _removeText(c_node.next)
 *             _removeNode(self._doc, c_node)
 */
      __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_index_out_of_range_d, __pyx_v_x); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":714
 *             if c_node is NULL:
 *                 raise IndexError, u"index out of range: %d" % x
 *             _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *             _removeNode(self._doc, c_node)
 * 
 */
    __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":715
 *                 raise IndexError, u"index out of range: %d" % x
 *             _removeText(c_node.next)
 *             _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":686
 *                 moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def __delitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""__delitem__(self, x)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":717
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_8__deepcopy__[] = "__deepcopy__(self, memo)";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_memo));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_8__deepcopy__(struct LxmlElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":719
 *     def __deepcopy__(self, memo):
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":717
 *             _removeNode(self._doc, c_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":721
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_11__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_10__copy__[] = "__copy__(self)";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_11__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_10__copy__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_10__copy__(struct LxmlElement *__pyx_v_self) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_new_doc = 0;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlNode *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":726
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":727
 *         cdef _Document new_doc
 *         _assertValidNode(self)
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive             # <<<<<<<<<<<<<<
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_self->_doc->_c_doc, __pyx_v_self->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":728
 *         _assertValidNode(self)
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *         root = new_doc.getroot()
 *         if root is not None:
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_doc->_parser);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":729
 *         c_doc = _copyDocRoot(self._doc._c_doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()             # <<<<<<<<<<<<<<
 *         if root is not None:
 *             return root
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_root = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":730
 *         new_doc = _documentFactory(c_doc, self._doc._parser)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
 */
  __pyx_t_5 = (__pyx_v_root != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":731
 *         root = new_doc.getroot()
 *         if root is not None:
 *             return root             # <<<<<<<<<<<<<<
 *         # Comment/PI
 *         c_node = c_doc.children
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_root);
    __pyx_r = __pyx_v_root;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":733
 *             return root
 *         # Comment/PI
 *         c_node = c_doc.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 */
  __pyx_t_7 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_7;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":734
 *         # Comment/PI
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         if c_node is NULL:
 */
  while (1) {
    __pyx_t_6 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_6) {
      __pyx_t_5 = ((__pyx_v_c_node->type != __pyx_v_self->_c_node->type) != 0);
      __pyx_t_8 = __pyx_t_5;
    } else {
      __pyx_t_8 = __pyx_t_6;
    }
    if (!__pyx_t_8) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":735
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
    __pyx_t_7 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_7;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":736
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
 */
  __pyx_t_8 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_8) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":737
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":738
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(new_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":721
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_doc);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":740
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"""set(self, key, value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_13set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_12set[] = "set(self, key, value)\n\n        Sets an element attribute.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_13set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_12set(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_value);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_12set(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":745
 *         Sets an element attribute.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self, key, value)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":746
 *         """
 *         _assertValidNode(self)
 *         _setAttributeValue(self, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def append(self, _Element element not None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(__pyx_v_self, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":740
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"""set(self, key, value)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":748
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""append(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_15append(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_14append[] = "append(self, element)\n\n        Adds a subelement to the end of this element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_15append(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_14append(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_14append(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":753
 *         Adds a subelement to the end of this element.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         _appendChild(self, element)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":754
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _appendChild(self, element)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":755
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def addnext(self, _Element element not None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":748
 *         _setAttributeValue(self, key, value)
 * 
 *     def append(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""append(self, element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":757
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""addnext(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_17addnext(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_16addnext[] = "addnext(self, element)\n\n        Adds the element as a following sibling directly after this\n        element.\n\n        This is normally used to set a processing instruction or comment after\n        the root node of a document.  Note that tail text is automatically\n        discarded when adding at the root level.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_17addnext(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addnext (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_16addnext(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_16addnext(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addnext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":767
 *         discarded when adding at the root level.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":768
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":769
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = ((__pyx_v_self->_c_node->parent != NULL) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((!(_isElement(__pyx_v_self->_c_node->parent) != 0)) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":770
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 */
    __pyx_t_4 = ((__pyx_v_element->_c_node->type != XML_PI_NODE) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":771
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
      __pyx_t_4 = ((__pyx_v_element->_c_node->type != XML_COMMENT_NODE) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":772
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"             # <<<<<<<<<<<<<<
 *             element.tail = None
 *         _appendSibling(self, element)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Only_processing_instructions_and, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":773
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None             # <<<<<<<<<<<<<<
 *         _appendSibling(self, element)
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_element), __pyx_n_s_tail, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":774
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 *         _appendSibling(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def addprevious(self, _Element element not None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendSibling(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":757
 *         _appendChild(self, element)
 * 
 *     def addnext(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""addnext(self, element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.addnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":776
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""addprevious(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_19addprevious(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_18addprevious[] = "addprevious(self, element)\n\n        Adds the element as a preceding sibling directly before this\n        element.\n\n        This is normally used to set a processing instruction or comment\n        before the root node of a document.  Note that tail text is\n        automatically discarded when adding at the root level.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_19addprevious(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addprevious (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_18addprevious(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_18addprevious(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addprevious", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":786
 *         automatically discarded when adding at the root level.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":787
 *         """
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":788
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):             # <<<<<<<<<<<<<<
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 */
  __pyx_t_2 = ((__pyx_v_self->_c_node->parent != NULL) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((!(_isElement(__pyx_v_self->_c_node->parent) != 0)) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":789
 *         _assertValidNode(element)
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 */
    __pyx_t_4 = ((__pyx_v_element->_c_node->type != XML_PI_NODE) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":790
 *         if self._c_node.parent != NULL and not _isElement(self._c_node.parent):
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 */
      __pyx_t_4 = ((__pyx_v_element->_c_node->type != XML_COMMENT_NODE) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":791
 *             if element._c_node.type != tree.XML_PI_NODE:
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"             # <<<<<<<<<<<<<<
 *             element.tail = None
 *         _prependSibling(self, element)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Only_processing_instructions_and, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":792
 *                 if element._c_node.type != tree.XML_COMMENT_NODE:
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None             # <<<<<<<<<<<<<<
 *         _prependSibling(self, element)
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_element), __pyx_n_s_tail, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":793
 *                     raise TypeError, u"Only processing instructions and comments can be siblings of the root element"
 *             element.tail = None
 *         _prependSibling(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__prependSibling(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":776
 *         _appendSibling(self, element)
 * 
 *     def addprevious(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""addprevious(self, element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.addprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":795
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""extend(self, elements)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_21extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_20extend[] = "extend(self, elements)\n\n        Extends the current children by the elements in the iterable.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_21extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_20extend(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_elements));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_20extend(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_elements) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":801
 *         """
 *         cdef _Element element
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             if element is None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":802
 *         cdef _Element element
 *         _assertValidNode(self)
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             if element is None:
 *                 raise TypeError, u"Node must not be None"
 */
  if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":803
 *         _assertValidNode(self)
 *         for element in elements:
 *             if element is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError, u"Node must not be None"
 *             _assertValidNode(element)
 */
    __pyx_t_6 = (((PyObject *)__pyx_v_element) == Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":804
 *         for element in elements:
 *             if element is None:
 *                 raise TypeError, u"Node must not be None"             # <<<<<<<<<<<<<<
 *             _assertValidNode(element)
 *             _appendChild(self, element)
 */
      __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Node_must_not_be_None, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":805
 *             if element is None:
 *                 raise TypeError, u"Node must not be None"
 *             _assertValidNode(element)             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 * 
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":806
 *                 raise TypeError, u"Node must not be None"
 *             _assertValidNode(element)
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":795
 *         _prependSibling(self, element)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""extend(self, elements)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":808
 *             _appendChild(self, element)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         u"""clear(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_23clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_22clear[] = "clear(self)\n\n        Resets an element.  This function removes all subelements, clears\n        all attributes and sets the text and tail properties to None.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_23clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_22clear(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_22clear(struct LxmlElement *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  xmlAttr *__pyx_v_c_attr_next;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_node_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":818
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_node_next
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         c_node = self._c_node
 *         # remove self.text and self.tail
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":819
 *         cdef xmlNode* c_node_next
 *         _assertValidNode(self)
 *         c_node = self._c_node             # <<<<<<<<<<<<<<
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 */
  __pyx_t_2 = __pyx_v_self->_c_node;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":821
 *         c_node = self._c_node
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)             # <<<<<<<<<<<<<<
 *         _removeText(c_node.next)
 *         # remove all attributes
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->children);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":822
 *         # remove self.text and self.tail
 *         _removeText(c_node.children)
 *         _removeText(c_node.next)             # <<<<<<<<<<<<<<
 *         # remove all attributes
 *         c_attr = c_node.properties
 */
  __pyx_f_4lxml_5etree__removeText(__pyx_v_c_node->next);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":824
 *         _removeText(c_node.next)
 *         # remove all attributes
 *         c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             c_attr_next = c_attr.next
 */
  __pyx_t_3 = __pyx_v_c_node->properties;
  __pyx_v_c_attr = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":825
 *         # remove all attributes
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             c_attr_next = c_attr.next
 *             tree.xmlRemoveProp(c_attr)
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_c_attr != NULL) != 0);
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":826
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
 *             c_attr_next = c_attr.next             # <<<<<<<<<<<<<<
 *             tree.xmlRemoveProp(c_attr)
 *             c_attr = c_attr_next
 */
    __pyx_t_3 = __pyx_v_c_attr->next;
    __pyx_v_c_attr_next = __pyx_t_3;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":827
 *         while c_attr is not NULL:
 *             c_attr_next = c_attr.next
 *             tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *             c_attr = c_attr_next
 *         # remove all subelements
 */
    xmlRemoveProp(__pyx_v_c_attr);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":828
 *             c_attr_next = c_attr.next
 *             tree.xmlRemoveProp(c_attr)
 *             c_attr = c_attr_next             # <<<<<<<<<<<<<<
 *         # remove all subelements
 *         c_node = c_node.children
 */
    __pyx_v_c_attr = __pyx_v_c_attr_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":830
 *             c_attr = c_attr_next
 *         # remove all subelements
 *         c_node = c_node.children             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             if not _isElement(c_node):
 */
  __pyx_t_2 = __pyx_v_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":831
 *         # remove all subelements
 *         c_node = c_node.children
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if not _isElement(c_node):
 *                 c_node = _nextElement(c_node)
 */
  __pyx_t_4 = ((__pyx_v_c_node != NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":832
 *         c_node = c_node.children
 *         if c_node is not NULL:
 *             if not _isElement(c_node):             # <<<<<<<<<<<<<<
 *                 c_node = _nextElement(c_node)
 *             while c_node is not NULL:
 */
    __pyx_t_4 = ((!(_isElement(__pyx_v_c_node) != 0)) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":833
 *         if c_node is not NULL:
 *             if not _isElement(c_node):
 *                 c_node = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *             while c_node is not NULL:
 *                 c_node_next = _nextElement(c_node)
 */
      __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":834
 *             if not _isElement(c_node):
 *                 c_node = _nextElement(c_node)
 *             while c_node is not NULL:             # <<<<<<<<<<<<<<
 *                 c_node_next = _nextElement(c_node)
 *                 _removeNode(self._doc, c_node)
 */
    while (1) {
      __pyx_t_4 = ((__pyx_v_c_node != NULL) != 0);
      if (!__pyx_t_4) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":835
 *                 c_node = _nextElement(c_node)
 *             while c_node is not NULL:
 *                 c_node_next = _nextElement(c_node)             # <<<<<<<<<<<<<<
 *                 _removeNode(self._doc, c_node)
 *                 c_node = c_node_next
 */
      __pyx_v_c_node_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":836
 *             while c_node is not NULL:
 *                 c_node_next = _nextElement(c_node)
 *                 _removeNode(self._doc, c_node)             # <<<<<<<<<<<<<<
 *                 c_node = c_node_next
 * 
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_1 = __pyx_f_4lxml_5etree__removeNode(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":837
 *                 c_node_next = _nextElement(c_node)
 *                 _removeNode(self._doc, c_node)
 *                 c_node = c_node_next             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index, _Element element not None):
 */
      __pyx_v_c_node = __pyx_v_c_node_next;
    }
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":808
 *             _appendChild(self, element)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         u"""clear(self)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":839
 *                 c_node = c_node_next
 * 
 *     def insert(self, index, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""insert(self, index, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_25insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_24insert[] = "insert(self, index, element)\n\n        Inserts a subelement at the given position in this element\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_25insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  struct LxmlElement *__pyx_v_element = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_element,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = values[0];
    __pyx_v_element = ((struct LxmlElement *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_24insert(((struct LxmlElement *)__pyx_v_self), __pyx_v_index, __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_24insert(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_index, struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  xmlDoc *__pyx_v_c_source_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  xmlNode *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":847
 *         cdef xmlNode* c_next
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":848
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":849
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             _appendChild(self, element)
 */
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":850
 *         _assertValidNode(element)
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             _appendChild(self, element)
 *             return
 */
  __pyx_t_3 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":851
 *         c_node = _findChild(self._c_node, index)
 *         if c_node is NULL:
 *             _appendChild(self, element)             # <<<<<<<<<<<<<<
 *             return
 *         c_source_doc = c_node.doc
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_self, __pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":852
 *         if c_node is NULL:
 *             _appendChild(self, element)
 *             return             # <<<<<<<<<<<<<<
 *         c_source_doc = c_node.doc
 *         c_next = element._c_node.next
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":853
 *             _appendChild(self, element)
 *             return
 *         c_source_doc = c_node.doc             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 */
  __pyx_t_4 = __pyx_v_c_node->doc;
  __pyx_v_c_source_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":854
 *             return
 *         c_source_doc = c_node.doc
 *         c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)
 */
  __pyx_t_5 = __pyx_v_element->_c_node->next;
  __pyx_v_c_next = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":855
 *         c_source_doc = c_node.doc
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, element._c_node)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 */
  xmlAddPrevSibling(__pyx_v_c_node, __pyx_v_element->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":856
 *         c_next = element._c_node.next
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_element->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":857
 *         tree.xmlAddPrevSibling(c_node, element._c_node)
 *         _moveTail(c_next, element._c_node)
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, _Element element not None):
 */
  __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_source_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":839
 *                 c_node = c_node_next
 * 
 *     def insert(self, index, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""insert(self, index, element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":859
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""remove(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_27remove(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_26remove[] = "remove(self, element)\n\n        Removes a matching subelement. Unlike the find methods, this\n        method compares elements based on identity, not on tag value\n        or contents.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_27remove(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_26remove(((struct LxmlElement *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_26remove(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":868
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_next
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         c_node = element._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":869
 *         cdef xmlNode* c_next
 *         _assertValidNode(self)
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":870
 *         _assertValidNode(self)
 *         _assertValidNode(element)
 *         c_node = element._c_node             # <<<<<<<<<<<<<<
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 */
  __pyx_t_2 = __pyx_v_element->_c_node;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":871
 *         _assertValidNode(element)
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not a child of this node."
 *         c_next = element._c_node.next
 */
  __pyx_t_3 = ((__pyx_v_c_node->parent != __pyx_v_self->_c_node) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":872
 *         c_node = element._c_node
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":873
 *         if c_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 *         c_next = element._c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlUnlinkNode(c_node)
 *         _moveTail(c_next, c_node)
 */
  __pyx_t_2 = __pyx_v_element->_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":874
 *             raise ValueError, u"Element is not a child of this node."
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 *         # fix namespace declarations
 */
  xmlUnlinkNode(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":875
 *         c_next = element._c_node.next
 *         tree.xmlUnlinkNode(c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":877
 *         _moveTail(c_next, c_node)
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, _Element old_element not None,
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node->doc, __pyx_v_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":859
 *         moveNodeToDocument(self._doc, c_source_doc, element._c_node)
 * 
 *     def remove(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""remove(self, element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":879
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         u"""replace(self, old_element, new_element)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_29replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_28replace[] = "replace(self, old_element, new_element)\n\n        Replaces a subelement with the element passed as second argument.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_29replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_old_element = 0;
  struct LxmlElement *__pyx_v_new_element = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_old_element,&__pyx_n_s_new_element,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_old_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_new_element)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_old_element = ((struct LxmlElement *)values[0]);
    __pyx_v_new_element = ((struct LxmlElement *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_element), __pyx_ptype_4lxml_5etree__Element, 0, "old_element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_element), __pyx_ptype_4lxml_5etree__Element, 0, "new_element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_28replace(((struct LxmlElement *)__pyx_v_self), __pyx_v_old_element, __pyx_v_new_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_28replace(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_old_element, struct LxmlElement *__pyx_v_new_element) {
  xmlNode *__pyx_v_c_old_node;
  xmlNode *__pyx_v_c_old_next;
  xmlNode *__pyx_v_c_new_node;
  xmlNode *__pyx_v_c_new_next;
  xmlDoc *__pyx_v_c_source_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":890
 *         cdef xmlNode* c_new_next
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":891
 *         cdef xmlDoc* c_source_doc
 *         _assertValidNode(self)
 *         _assertValidNode(old_element)             # <<<<<<<<<<<<<<
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_old_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":892
 *         _assertValidNode(self)
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)             # <<<<<<<<<<<<<<
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_new_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":893
 *         _assertValidNode(old_element)
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node             # <<<<<<<<<<<<<<
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 */
  __pyx_t_2 = __pyx_v_old_element->_c_node;
  __pyx_v_c_old_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":894
 *         _assertValidNode(new_element)
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not a child of this node."
 *         c_old_next = c_old_node.next
 */
  __pyx_t_3 = ((__pyx_v_c_old_node->parent != __pyx_v_self->_c_node) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":895
 *         c_old_node = old_element._c_node
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."             # <<<<<<<<<<<<<<
 *         c_old_next = c_old_node.next
 *         c_new_node = new_element._c_node
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":896
 *         if c_old_node.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 *         c_old_next = c_old_node.next             # <<<<<<<<<<<<<<
 *         c_new_node = new_element._c_node
 *         c_new_next = c_new_node.next
 */
  __pyx_t_2 = __pyx_v_c_old_node->next;
  __pyx_v_c_old_next = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":897
 *             raise ValueError, u"Element is not a child of this node."
 *         c_old_next = c_old_node.next
 *         c_new_node = new_element._c_node             # <<<<<<<<<<<<<<
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
 */
  __pyx_t_2 = __pyx_v_new_element->_c_node;
  __pyx_v_c_new_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":898
 *         c_old_next = c_old_node.next
 *         c_new_node = new_element._c_node
 *         c_new_next = c_new_node.next             # <<<<<<<<<<<<<<
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 */
  __pyx_t_2 = __pyx_v_c_new_node->next;
  __pyx_v_c_new_next = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":899
 *         c_new_node = new_element._c_node
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc             # <<<<<<<<<<<<<<
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)
 */
  __pyx_t_4 = __pyx_v_c_new_node->doc;
  __pyx_v_c_source_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":900
 *         c_new_next = c_new_node.next
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)
 */
  xmlReplaceNode(__pyx_v_c_old_node, __pyx_v_c_new_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":901
 *         c_source_doc = c_new_node.doc
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_old_next, c_old_node)
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_new_next, __pyx_v_c_new_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":902
 *         tree.xmlReplaceNode(c_old_node, c_new_node)
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)             # <<<<<<<<<<<<<<
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 *         # fix namespace declarations
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_old_next, __pyx_v_c_old_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":903
 *         _moveTail(c_new_next, c_new_node)
 *         _moveTail(c_old_next, c_old_node)
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)             # <<<<<<<<<<<<<<
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_old_node.doc, c_old_node)
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_source_doc, __pyx_v_c_new_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":905
 *         moveNodeToDocument(self._doc, c_source_doc, c_new_node)
 *         # fix namespace declarations
 *         moveNodeToDocument(self._doc, c_old_node.doc, c_old_node)             # <<<<<<<<<<<<<<
 * 
 *     # PROPERTIES
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_f_4lxml_5etree_moveNodeToDocument(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_old_node->doc, __pyx_v_c_old_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":879
 *         moveNodeToDocument(self._doc, c_node.doc, c_node)
 * 
 *     def replace(self, _Element old_element not None,             # <<<<<<<<<<<<<<
 *                 _Element new_element not None):
 *         u"""replace(self, old_element, new_element)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":911
 *         u"""Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._tag is not None:
 *                 return self._tag
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_3tag_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_3tag___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_3tag___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":912
 *         """
 *         def __get__(self):
 *             if self._tag is not None:             # <<<<<<<<<<<<<<
 *                 return self._tag
 *             _assertValidNode(self)
 */
  __pyx_t_1 = (__pyx_v_self->_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":913
 *         def __get__(self):
 *             if self._tag is not None:
 *                 return self._tag             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_tag);
    __pyx_r = __pyx_v_self->_tag;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":914
 *             if self._tag is not None:
 *                 return self._tag
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":915
 *                 return self._tag
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *             return self._tag
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_tag);
  __Pyx_DECREF(__pyx_v_self->_tag);
  __pyx_v_self->_tag = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":916
 *             _assertValidNode(self)
 *             self._tag = _namespacedName(self._c_node)
 *             return self._tag             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_tag);
  __pyx_r = __pyx_v_self->_tag;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":911
 *         u"""Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._tag is not None:
 *                 return self._tag
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":918
 *             return self._tag
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_3tag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_3tag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_3tag_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_8_Element_3tag_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":920
 *         def __set__(self, value):
 *             cdef _BaseParser parser
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":921
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
 *             ns, name = _getNsTag(value)             # <<<<<<<<<<<<<<
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_name = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":922
 *             _assertValidNode(self)
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser             # <<<<<<<<<<<<<<
 *             if parser is not None and parser._for_html:
 *                 _htmlTagValidOrRaise(name)
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc->_parser);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":923
 *             ns, name = _getNsTag(value)
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:             # <<<<<<<<<<<<<<
 *                 _htmlTagValidOrRaise(name)
 *             else:
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_parser) != Py_None);
  if ((__pyx_t_5 != 0)) {
    __pyx_t_6 = (__pyx_v_parser->_for_html != 0);
  } else {
    __pyx_t_6 = (__pyx_t_5 != 0);
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":924
 *             parser = self._doc._parser
 *             if parser is not None and parser._for_html:
 *                 _htmlTagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             else:
 *                 _tagValidOrRaise(name)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__htmlTagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":926
 *                 _htmlTagValidOrRaise(name)
 *             else:
 *                 _tagValidOrRaise(name)             # <<<<<<<<<<<<<<
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_name); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":927
 *             else:
 *                 _tagValidOrRaise(name)
 *             self._tag = value             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:
 */
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->_tag);
  __Pyx_DECREF(__pyx_v_self->_tag);
  __pyx_v_self->_tag = __pyx_v_value;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":928
 *                 _tagValidOrRaise(name)
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))             # <<<<<<<<<<<<<<
 *             if ns is None:
 *                 self._c_node.ns = NULL
 */
  xmlNodeSetName(__pyx_v_self->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":929
 *             self._tag = value
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:             # <<<<<<<<<<<<<<
 *                 self._c_node.ns = NULL
 *             else:
 */
  __pyx_t_6 = (__pyx_v_ns == Py_None);
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":930
 *             tree.xmlNodeSetName(self._c_node, _xcstr(name))
 *             if ns is None:
 *                 self._c_node.ns = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))
 */
    __pyx_v_self->_c_node->ns = NULL;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":932
 *                 self._c_node.ns = NULL
 *             else:
 *                 self._doc._setNodeNs(self._c_node, _xcstr(ns))             # <<<<<<<<<<<<<<
 * 
 *     property attrib:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document__setNodeNs(__pyx_v_self->_doc, __pyx_v_self->_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":918
 *             return self._tag
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef _BaseParser parser
 *             _assertValidNode(self)
 */

  /* function exit code */
  __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("lxml.etree._Element.tag.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":938
 *         keys(), values() and items() to access element attributes.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _Attrib.__new__(_Attrib, self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6attrib_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_6attrib___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6attrib___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":939
 *         """
 *         def __get__(self):
 *             return _Attrib.__new__(_Attrib, self)             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __pyx_tp_new_4lxml_5etree__Attrib(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Attrib)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":938
 *         keys(), values() and items() to access element attributes.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return _Attrib.__new__(_Attrib, self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":945
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4text___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4text___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":946
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":947
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":945
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.children)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":949
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4text_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_8_Element_4text_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":950
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":951
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":952
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__resolveQNameText(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_t_4 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __Pyx_decode_bytes(__pyx_t_4, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":953
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 *         # using 'del el.text' is the wrong thing to do
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->_c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":949
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if isinstance(value, QName):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":964
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4tail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4tail_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4tail___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4tail___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":965
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.next)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":966
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":964
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return _collectText(self._c_node.next)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":968
 *             return _collectText(self._c_node.next)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_4tail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_4tail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4tail_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_8_Element_4tail_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":969
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             _setTailText(self._c_node, value)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":970
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 *         # using 'del el.tail' is the wrong thing to do
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_self->_c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":968
 *             return _collectText(self._c_node.next)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             _setTailText(self._c_node, value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.tail.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":980
 *         u"""Namespace prefix or None.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_6prefix___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_6prefix___get__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":981
 *         """
 *         def __get__(self):
 *             if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 */
  __pyx_t_1 = ((__pyx_v_self->_c_node->ns != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":982
 *         def __get__(self):
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                     return funicode(self._c_node.ns.prefix)
 *             return None
 */
    __pyx_t_1 = ((__pyx_v_self->_c_node->ns->prefix != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":983
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->ns->prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __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;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":984
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":980
 *         u"""Namespace prefix or None.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":990
 *         u"""Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             _assertValidNode(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_10sourceline_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_10sourceline_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_10sourceline___get__(struct LxmlElement *__pyx_v_self) {
  long __pyx_v_line;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":992
 *         def __get__(self):
 *             cdef long line
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             line = tree.xmlGetLineNo(self._c_node)
 *             return line if line > 0 else None
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":993
 *             cdef long line
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)             # <<<<<<<<<<<<<<
 *             return line if line > 0 else None
 * 
 */
  __pyx_v_line = xmlGetLineNo(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":994
 *             _assertValidNode(self)
 *             line = tree.xmlGetLineNo(self._c_node)
 *             return line if line > 0 else None             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, line):
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_line > 0) != 0)) {
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":990
 *         u"""Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             _assertValidNode(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.sourceline.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":996
 *             return line if line > 0 else None
 * 
 *         def __set__(self, line):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if line <= 0:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_10sourceline_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_10sourceline_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_10sourceline_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_line));

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

static int __pyx_pf_4lxml_5etree_8_Element_10sourceline_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_line) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  unsigned short __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":997
 * 
 *         def __set__(self, line):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if line <= 0:
 *                 self._c_node.line = 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":998
 *         def __set__(self, line):
 *             _assertValidNode(self)
 *             if line <= 0:             # <<<<<<<<<<<<<<
 *                 self._c_node.line = 0
 *             else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_line, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":999
 *             _assertValidNode(self)
 *             if line <= 0:
 *                 self._c_node.line = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 self._c_node.line = line
 */
    __pyx_v_self->_c_node->line = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1001
 *                 self._c_node.line = 0
 *             else:
 *                 self._c_node.line = line             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
    __pyx_t_4 = __Pyx_PyInt_As_unsigned_short(__pyx_v_line); if (unlikely((__pyx_t_4 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->_c_node->line = __pyx_t_4;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":996
 *             return line if line > 0 else None
 * 
 *         def __set__(self, line):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if line <= 0:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.sourceline.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1011
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef xmlNode* c_node
 *             cdef xmlNs* c_ns
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_5nsmap_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_5nsmap_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_5nsmap___get__(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  xmlNs *__pyx_v_c_ns;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlNs *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1014
 *             cdef xmlNode* c_node
 *             cdef xmlNs* c_ns
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             nsmap = {}
 *             c_node = self._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1015
 *             cdef xmlNs* c_ns
 *             _assertValidNode(self)
 *             nsmap = {}             # <<<<<<<<<<<<<<
 *             c_node = self._c_node
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_nsmap = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1016
 *             _assertValidNode(self)
 *             nsmap = {}
 *             c_node = self._c_node             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *                 c_ns = c_node.nsDef
 */
  __pyx_t_3 = __pyx_v_self->_c_node;
  __pyx_v_c_node = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1017
 *             nsmap = {}
 *             c_node = self._c_node
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 c_ns = c_node.nsDef
 *                 while c_ns is not NULL:
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_4) {
      __pyx_t_5 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_4;
    }
    if (!__pyx_t_6) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1018
 *             c_node = self._c_node
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *                 c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *                 while c_ns is not NULL:
 *                     prefix = funicodeOrNone(c_ns.prefix)
 */
    __pyx_t_7 = __pyx_v_c_node->nsDef;
    __pyx_v_c_ns = __pyx_t_7;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1019
 *             while c_node is not NULL and c_node.type == tree.XML_ELEMENT_NODE:
 *                 c_ns = c_node.nsDef
 *                 while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *                     prefix = funicodeOrNone(c_ns.prefix)
 *                     if prefix not in nsmap:
 */
    while (1) {
      __pyx_t_6 = ((__pyx_v_c_ns != NULL) != 0);
      if (!__pyx_t_6) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1020
 *                 c_ns = c_node.nsDef
 *                 while c_ns is not NULL:
 *                     prefix = funicodeOrNone(c_ns.prefix)             # <<<<<<<<<<<<<<
 *                     if prefix not in nsmap:
 *                         nsmap[prefix] = funicodeOrNone(c_ns.href)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1021
 *                 while c_ns is not NULL:
 *                     prefix = funicodeOrNone(c_ns.prefix)
 *                     if prefix not in nsmap:             # <<<<<<<<<<<<<<
 *                         nsmap[prefix] = funicodeOrNone(c_ns.href)
 *                     c_ns = c_ns.next
 */
      __pyx_t_6 = (__Pyx_PyDict_Contains(__pyx_v_prefix, __pyx_v_nsmap, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = (__pyx_t_6 != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1022
 *                     prefix = funicodeOrNone(c_ns.prefix)
 *                     if prefix not in nsmap:
 *                         nsmap[prefix] = funicodeOrNone(c_ns.href)             # <<<<<<<<<<<<<<
 *                     c_ns = c_ns.next
 *                 c_node = c_node.parent
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(PyDict_SetItem(__pyx_v_nsmap, __pyx_v_prefix, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1023
 *                     if prefix not in nsmap:
 *                         nsmap[prefix] = funicodeOrNone(c_ns.href)
 *                     c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *                 c_node = c_node.parent
 *             return nsmap
 */
      __pyx_t_7 = __pyx_v_c_ns->next;
      __pyx_v_c_ns = __pyx_t_7;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1024
 *                         nsmap[prefix] = funicodeOrNone(c_ns.href)
 *                     c_ns = c_ns.next
 *                 c_node = c_node.parent             # <<<<<<<<<<<<<<
 *             return nsmap
 * 
 */
    __pyx_t_3 = __pyx_v_c_node->parent;
    __pyx_v_c_node = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1025
 *                     c_ns = c_ns.next
 *                 c_node = c_node.parent
 *             return nsmap             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nsmap);
  __pyx_r = __pyx_v_nsmap;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1011
 *         Note that changing the returned dict has no effect on the Element.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef xmlNode* c_node
 *             cdef xmlNs* c_ns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.nsmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1039
 *         Element, regardless of the document type (XML or HTML).
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Element_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4base___get__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_4base___get__(struct LxmlElement *__pyx_v_self) {
  xmlChar *__pyx_v_c_base;
  PyObject *__pyx_v_base = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1040
 *         """
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1041
 *         def __get__(self):
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:
 */
  __pyx_v_c_base = xmlNodeGetBase(__pyx_v_self->_doc->_c_doc, __pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1042
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:             # <<<<<<<<<<<<<<
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
 */
  __pyx_t_2 = ((__pyx_v_c_base == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1043
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
 */
    __pyx_t_2 = ((__pyx_v_self->_doc->_c_doc->URL == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1044
 *             if c_base is NULL:
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None             # <<<<<<<<<<<<<<
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1045
 *                 if self._doc._c_doc.URL is NULL:
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *             try:
 *                 base = _decodeFilename(c_base)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_self->_doc->_c_doc->URL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1046
 *                     return None
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:             # <<<<<<<<<<<<<<
 *                 base = _decodeFilename(c_base)
 *             finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1047
 *                 return _decodeFilename(self._doc._c_doc.URL)
 *             try:
 *                 base = _decodeFilename(c_base)             # <<<<<<<<<<<<<<
 *             finally:
 *                 tree.xmlFree(c_base)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_base); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_base = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1049
 *                 base = _decodeFilename(c_base)
 *             finally:
 *                 tree.xmlFree(c_base)             # <<<<<<<<<<<<<<
 *             return base
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_base);
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_1 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_base);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1050
 *             finally:
 *                 tree.xmlFree(c_base)
 *             return base             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, url):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_base);
  __pyx_r = __pyx_v_base;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1039
 *         Element, regardless of the document type (XML or HTML).
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             c_base = tree.xmlNodeGetBase(self._doc._c_doc, self._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_base);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1052
 *             return base
 * 
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if url is None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_4base_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_4base_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_4base_2__set__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_url));

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

static int __pyx_pf_4lxml_5etree_8_Element_4base_2__set__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_url) {
  const xmlChar *__pyx_v_c_base;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1053
 * 
 *         def __set__(self, url):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if url is None:
 *                 c_base = <const_xmlChar*>NULL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1054
 *         def __set__(self, url):
 *             _assertValidNode(self)
 *             if url is None:             # <<<<<<<<<<<<<<
 *                 c_base = <const_xmlChar*>NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_url == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1055
 *             _assertValidNode(self)
 *             if url is None:
 *                 c_base = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 url = _encodeFilename(url)
 */
    __pyx_v_c_base = ((const xmlChar *)NULL);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1057
 *                 c_base = <const_xmlChar*>NULL
 *             else:
 *                 url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *                 c_base = _xcstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1058
 *             else:
 *                 url = _encodeFilename(url)
 *                 c_base = _xcstr(url)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetBase(self._c_node, c_base)
 * 
 */
    __pyx_v_c_base = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_url);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1059
 *                 url = _encodeFilename(url)
 *                 c_base = _xcstr(url)
 *             tree.xmlNodeSetBase(self._c_node, c_base)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
  xmlNodeSetBase(__pyx_v_self->_c_node, __pyx_v_c_base);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1052
 *             return base
 * 
 *         def __set__(self, url):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             if url is None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.base.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1062
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         u"__repr__(self)"
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_31__repr__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_30__repr__[] = "__repr__(self)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8_Element_31__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_30__repr__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_30__repr__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1064
 *     def __repr__(self):
 *         u"__repr__(self)"
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __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 = 1064; __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 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __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_t_3 = PyUnicode_Format(__pyx_kp_u_Element_s_at_0x_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __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;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1062
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         u"__repr__(self)"
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1066
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""Returns the subelement at the given position or the requested
 *         slice.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_33__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_32__getitem__[] = "Returns the subelement at the given position or the requested\n        slice.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8_Element_33__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_32__getitem__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_32__getitem__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_c;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1070
 *         slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         cdef Py_ssize_t c, i
 */
  __pyx_v_c_node = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1071
 *         """
 *         cdef xmlNode* c_node = NULL
 *         cdef Py_ssize_t step = 0, slicelength = 0             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t c, i
 *         cdef _node_to_node_function next_element
 */
  __pyx_v_step = 0;
  __pyx_v_slicelength = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1075
 *         cdef _node_to_node_function next_element
 *         cdef list result
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slicing
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1076
 *         cdef list result
 *         _assertValidNode(self)
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1078
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1079
 *             # slicing
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)             # <<<<<<<<<<<<<<
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_f_4lxml_5etree__collectChildren(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1080
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 return []
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1081
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
 */
    __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1082
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 *                 return []             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 next_element = _nextElement
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1083
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_step > 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1084
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1086
 *                 next_element = _nextElement
 *             else:
 *                 step = -step             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
 */
      __pyx_v_step = (-__pyx_v_step);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1087
 *             else:
 *                 step = -step
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1088
 *                 step = -step
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_result = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1089
 *                 next_element = _previousElement
 *             result = []
 *             c = 0             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))
 */
    __pyx_v_c = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1090
 *             result = []
 *             c = 0
 *             while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1
 */
    while (1) {
      __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
      if (__pyx_t_2) {
        __pyx_t_3 = ((__pyx_v_c < __pyx_v_slicelength) != 0);
        __pyx_t_5 = __pyx_t_3;
      } else {
        __pyx_t_5 = __pyx_t_2;
      }
      if (!__pyx_t_5) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1091
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))             # <<<<<<<<<<<<<<
 *                 c += 1
 *                 for i in range(step):
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1092
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1             # <<<<<<<<<<<<<<
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 */
      __pyx_v_c = (__pyx_v_c + 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1093
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c += 1
 *                 for i in range(step):             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             return result
 */
      __pyx_t_8 = __pyx_v_step;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
        __pyx_v_i = __pyx_t_9;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1094
 *                 c += 1
 *                 for i in range(step):
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             return result
 *         else:
 */
        __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
      }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1095
 *                 for i in range(step):
 *                     c_node = next_element(c_node)
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1098
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 */
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_8);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1099
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"list index out of range"
 *             return _elementFactory(self._doc, c_node)
 */
    __pyx_t_5 = ((__pyx_v_c_node == NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1100
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 *             return _elementFactory(self._doc, c_node)
 * 
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_u_list_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1101
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 *             return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1066
 *         return u"<Element %s at 0x%x>" % (self.tag, id(self))
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""Returns the subelement at the given position or the requested
 *         slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Element.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1103
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"""__len__(self)
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_8_Element_35__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_34__len__[] = "__len__(self)\n\n        Returns the number of subelements.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_34__len__;
#endif
static Py_ssize_t __pyx_pw_4lxml_5etree_8_Element_35__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_34__len__(((struct LxmlElement *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_4lxml_5etree_8_Element_34__len__(struct LxmlElement *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1108
 *         Returns the number of subelements.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _countElements(self._c_node.children)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1109
 *         """
 *         _assertValidNode(self)
 *         return _countElements(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_r = __pyx_f_4lxml_5etree__countElements(__pyx_v_self->_c_node->children);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1103
 *             return _elementFactory(self._doc, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"""__len__(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._Element.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1111
 *         return _countElements(self._c_node.children)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_37__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_8_Element_37__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_36__nonzero__(((struct LxmlElement *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_8_Element_36__nonzero__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_v_warnings = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1113
 *     def __nonzero__(self):
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings             # <<<<<<<<<<<<<<
 *         warnings.warn(
 *             u"The behavior of this method will change in future versions. "
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1114
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             u"The behavior of this method will change in future versions. "
 *             u"Use specific 'len(elem)' or 'elem is not None' test instead.",
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1118
 *             u"Use specific 'len(elem)' or 'elem is not None' test instead.",
 *             FutureWarning
 *             )             # <<<<<<<<<<<<<<
 *         # emulate old behaviour
 *         _assertValidNode(self)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u_The_behavior_of_this_method_will);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_The_behavior_of_this_method_will);
  __Pyx_GIVEREF(__pyx_kp_u_The_behavior_of_this_method_will);
  __Pyx_INCREF(__pyx_builtin_FutureWarning);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_FutureWarning);
  __Pyx_GIVEREF(__pyx_builtin_FutureWarning);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1114
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings
 *         warnings.warn(             # <<<<<<<<<<<<<<
 *             u"The behavior of this method will change in future versions. "
 *             u"Use specific 'len(elem)' or 'elem is not None' test instead.",
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1120
 *             )
 *         # emulate old behaviour
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _hasChild(self._c_node)
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1121
 *         # emulate old behaviour
 *         _assertValidNode(self)
 *         return _hasChild(self._c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, element):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasChild(__pyx_v_self->_c_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1111
 *         return _countElements(self._c_node.children)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         #u"__nonzero__(self)" # currently fails in Py3.1
 *         import warnings
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1123
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         u"__contains__(self, element)"
 *         cdef xmlNode* c_node
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8_Element_39__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_38__contains__[] = "__contains__(self, element)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__;
#endif
static int __pyx_pw_4lxml_5etree_8_Element_39__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_38__contains__(((struct LxmlElement *)__pyx_v_self), ((PyObject *)__pyx_v_element));

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

static int __pyx_pf_4lxml_5etree_8_Element_38__contains__(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1126
 *         u"__contains__(self, element)"
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if not isinstance(element, _Element):
 *             return 0
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1127
 *         cdef xmlNode* c_node
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             return 0
 *         c_node = (<_Element>element)._c_node
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1128
 *         _assertValidNode(self)
 *         if not isinstance(element, _Element):
 *             return 0             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *         return c_node is not NULL and c_node.parent is self._c_node
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1129
 *         if not isinstance(element, _Element):
 *             return 0
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 */
  __pyx_t_4 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
  __pyx_v_c_node = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1130
 *             return 0
 *         c_node = (<_Element>element)._c_node
 *         return c_node is not NULL and c_node.parent is self._c_node             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_3 = (__pyx_v_c_node != NULL);
  if (__pyx_t_3) {
    __pyx_t_2 = (__pyx_v_c_node->parent == __pyx_v_self->_c_node);
    __pyx_t_5 = __pyx_t_2;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1123
 *         return _hasChild(self._c_node)
 * 
 *     def __contains__(self, element):             # <<<<<<<<<<<<<<
 *         u"__contains__(self, element)"
 *         cdef xmlNode* c_node
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1132
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         u"__iter__(self)"
 *         return ElementChildIterator(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_41__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_40__iter__[] = "__iter__(self)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8_Element_41__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_40__iter__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_40__iter__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1134
 *     def __iter__(self):
 *         u"__iter__(self)"
 *         return ElementChildIterator(self)             # <<<<<<<<<<<<<<
 * 
 *     def __reversed__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1132
 *         return c_node is not NULL and c_node.parent is self._c_node
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         u"__iter__(self)"
 *         return ElementChildIterator(self)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1136
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         u"__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_43__reversed__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_42__reversed__[] = "__reversed__(self)";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_43__reversed__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reversed__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_42__reversed__(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_42__reversed__(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reversed__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1138
 *     def __reversed__(self):
 *         u"__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)             # <<<<<<<<<<<<<<
 * 
 *     def index(self, _Element child not None, start=None, stop=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reversed, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1136
 *         return ElementChildIterator(self)
 * 
 *     def __reversed__(self):             # <<<<<<<<<<<<<<
 *         u"__reversed__(self)"
 *         return ElementChildIterator(self, reversed=True)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1140
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, _Element child not None, start=None, stop=None):             # <<<<<<<<<<<<<<
 *         u"""index(self, child, start=None, stop=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_45index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_44index[] = "index(self, child, start=None, stop=None)\n\n        Find the position of the child within the parent.\n\n        This method is not part of the original ElementTree API.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_45index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_child = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_child,&__pyx_n_s_start,&__pyx_n_s_stop,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_child)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_child = ((struct LxmlElement *)values[0]);
    __pyx_v_start = values[1];
    __pyx_v_stop = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("index", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child), __pyx_ptype_4lxml_5etree__Element, 0, "child", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_44index(((struct LxmlElement *)__pyx_v_self), __pyx_v_child, __pyx_v_start, __pyx_v_stop);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8_Element_44index(struct LxmlElement *__pyx_v_self, struct LxmlElement *__pyx_v_child, PyObject *__pyx_v_start, PyObject *__pyx_v_stop) {
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_l;
  Py_ssize_t __pyx_v_c_start;
  Py_ssize_t __pyx_v_c_stop;
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_start_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1151
 *         cdef xmlNode* c_child
 *         cdef xmlNode* c_start_node
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         _assertValidNode(child)
 *         c_child = child._c_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1152
 *         cdef xmlNode* c_start_node
 *         _assertValidNode(self)
 *         _assertValidNode(child)             # <<<<<<<<<<<<<<
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_child); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1153
 *         _assertValidNode(self)
 *         _assertValidNode(child)
 *         c_child = child._c_node             # <<<<<<<<<<<<<<
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."
 */
  __pyx_t_2 = __pyx_v_child->_c_node;
  __pyx_v_c_child = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1154
 *         _assertValidNode(child)
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not a child of this node."
 * 
 */
  __pyx_t_3 = ((__pyx_v_c_child->parent != __pyx_v_self->_c_node) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1155
 *         c_child = child._c_node
 *         if c_child.parent is not self._c_node:
 *             raise ValueError, u"Element is not a child of this node."             # <<<<<<<<<<<<<<
 * 
 *         # handle the unbounded search straight away (normal case)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_a_child_of_this_n, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1158
 * 
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):             # <<<<<<<<<<<<<<
 *             k = 0
 *             c_child = c_child.prev
 */
  __pyx_t_3 = (__pyx_v_stop == Py_None);
  if (__pyx_t_3) {
    __pyx_t_4 = (__pyx_v_start == Py_None);
    if (!__pyx_t_4) {
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_4;
    }
    __pyx_t_4 = __pyx_t_7;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1159
 *         # handle the unbounded search straight away (normal case)
 *         if stop is None and (start is None or start == 0):
 *             k = 0             # <<<<<<<<<<<<<<
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 */
    __pyx_v_k = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1160
 *         if stop is None and (start is None or start == 0):
 *             k = 0
 *             c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             while c_child is not NULL:
 *                 if _isElement(c_child):
 */
    __pyx_t_2 = __pyx_v_c_child->prev;
    __pyx_v_c_child = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1161
 *             k = 0
 *             c_child = c_child.prev
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k += 1
 */
    while (1) {
      __pyx_t_4 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_4) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1162
 *             c_child = c_child.prev
 *             while c_child is not NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
 */
      __pyx_t_4 = (_isElement(__pyx_v_c_child) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1163
 *             while c_child is not NULL:
 *                 if _isElement(c_child):
 *                     k += 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             return k
 */
        __pyx_v_k = (__pyx_v_k + 1);
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1164
 *                 if _isElement(c_child):
 *                     k += 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             return k
 * 
 */
      __pyx_t_2 = __pyx_v_c_child->prev;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1165
 *                     k += 1
 *                 c_child = c_child.prev
 *             return k             # <<<<<<<<<<<<<<
 * 
 *         # check indices
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1168
 * 
 *         # check indices
 *         if start is None:             # <<<<<<<<<<<<<<
 *             c_start = 0
 *         else:
 */
  __pyx_t_4 = (__pyx_v_start == Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1169
 *         # check indices
 *         if start is None:
 *             c_start = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_start = start
 */
    __pyx_v_c_start = 0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1171
 *             c_start = 0
 *         else:
 *             c_start = start             # <<<<<<<<<<<<<<
 *         if stop is None:
 *             c_stop = 0
 */
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_start = __pyx_t_8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1172
 *         else:
 *             c_start = start
 *         if stop is None:             # <<<<<<<<<<<<<<
 *             c_stop = 0
 *         else:
 */
  __pyx_t_3 = (__pyx_v_stop == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1173
 *             c_start = start
 *         if stop is None:
 *             c_stop = 0             # <<<<<<<<<<<<<<
 *         else:
 *             c_stop = stop
 */
    __pyx_v_c_stop = 0;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1175
 *             c_stop = 0
 *         else:
 *             c_stop = stop             # <<<<<<<<<<<<<<
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 */
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_stop); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_stop = __pyx_t_8;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1176
 *         else:
 *             c_stop = stop
 *             if c_stop == 0 or \             # <<<<<<<<<<<<<<
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, u"list.index(x): x not in slice"
 */
    __pyx_t_4 = ((__pyx_v_c_stop == 0) != 0);
    if (!__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1177
 *             c_stop = stop
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"list.index(x): x not in slice"
 * 
 */
      __pyx_t_3 = ((__pyx_v_c_start >= __pyx_v_c_stop) != 0);
      if (__pyx_t_3) {
        __pyx_t_7 = ((__pyx_v_c_stop > 0) != 0);
        if (!__pyx_t_7) {
          __pyx_t_6 = ((__pyx_v_c_start < 0) != 0);
          __pyx_t_9 = __pyx_t_6;
        } else {
          __pyx_t_9 = __pyx_t_7;
        }
        __pyx_t_7 = __pyx_t_9;
      } else {
        __pyx_t_7 = __pyx_t_3;
      }
      __pyx_t_3 = __pyx_t_7;
    } else {
      __pyx_t_3 = __pyx_t_4;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1178
 *             if c_stop == 0 or \
 *                    c_start >= c_stop and (c_stop > 0 or c_start < 0):
 *                 raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 * 
 *         # for negative slice indices, check slice before searching index
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1181
 * 
 *         # for negative slice indices, check slice before searching index
 *         if c_start < 0 or c_stop < 0:             # <<<<<<<<<<<<<<
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
 */
  __pyx_t_3 = ((__pyx_v_c_start < 0) != 0);
  if (!__pyx_t_3) {
    __pyx_t_4 = ((__pyx_v_c_stop < 0) != 0);
    __pyx_t_7 = __pyx_t_4;
  } else {
    __pyx_t_7 = __pyx_t_3;
  }
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1183
 *         if c_start < 0 or c_stop < 0:
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:             # <<<<<<<<<<<<<<
 *                 k = -c_start
 *             else:
 */
    __pyx_t_7 = ((__pyx_v_c_start < __pyx_v_c_stop) != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1184
 *             # start from right, at most up to leftmost(c_start, c_stop)
 *             if c_start < c_stop:
 *                 k = -c_start             # <<<<<<<<<<<<<<
 *             else:
 *                 k = -c_stop
 */
      __pyx_v_k = (-__pyx_v_c_start);
      goto __pyx_L12;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1186
 *                 k = -c_start
 *             else:
 *                 k = -c_stop             # <<<<<<<<<<<<<<
 *             c_start_node = self._c_node.last
 *             l = 1
 */
      __pyx_v_k = (-__pyx_v_c_stop);
    }
    __pyx_L12:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1187
 *             else:
 *                 k = -c_stop
 *             c_start_node = self._c_node.last             # <<<<<<<<<<<<<<
 *             l = 1
 *             while c_start_node != c_child and l < k:
 */
    __pyx_t_2 = __pyx_v_self->_c_node->last;
    __pyx_v_c_start_node = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1188
 *                 k = -c_stop
 *             c_start_node = self._c_node.last
 *             l = 1             # <<<<<<<<<<<<<<
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):
 */
    __pyx_v_l = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1189
 *             c_start_node = self._c_node.last
 *             l = 1
 *             while c_start_node != c_child and l < k:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_start_node):
 *                     l += 1
 */
    while (1) {
      __pyx_t_7 = ((__pyx_v_c_start_node != __pyx_v_c_child) != 0);
      if (__pyx_t_7) {
        __pyx_t_3 = ((__pyx_v_l < __pyx_v_k) != 0);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_7;
      }
      if (!__pyx_t_4) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1190
 *             l = 1
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):             # <<<<<<<<<<<<<<
 *                     l += 1
 *                 c_start_node = c_start_node.prev
 */
      __pyx_t_4 = (_isElement(__pyx_v_c_start_node) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1191
 *             while c_start_node != c_child and l < k:
 *                 if _isElement(c_start_node):
 *                     l += 1             # <<<<<<<<<<<<<<
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:
 */
        __pyx_v_l = (__pyx_v_l + 1);
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1192
 *                 if _isElement(c_start_node):
 *                     l += 1
 *                 c_start_node = c_start_node.prev             # <<<<<<<<<<<<<<
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 */
      __pyx_t_2 = __pyx_v_c_start_node->prev;
      __pyx_v_c_start_node = __pyx_t_2;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1193
 *                     l += 1
 *                 c_start_node = c_start_node.prev
 *             if c_start_node == c_child:             # <<<<<<<<<<<<<<
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
 */
    __pyx_t_4 = ((__pyx_v_c_start_node == __pyx_v_c_child) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1195
 *             if c_start_node == c_child:
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:             # <<<<<<<<<<<<<<
 *                     raise ValueError, u"list.index(x): x not in slice"
 *             elif c_start < 0:
 */
      __pyx_t_4 = ((__pyx_v_c_stop < 0) != 0);
      if (__pyx_t_4) {
        __pyx_t_7 = ((__pyx_v_l <= (-__pyx_v_c_stop)) != 0);
        __pyx_t_3 = __pyx_t_7;
      } else {
        __pyx_t_3 = __pyx_t_4;
      }
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1196
 *                 # found! before slice end?
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *             elif c_start < 0:
 *                 raise ValueError, u"list.index(x): x not in slice"
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L16;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1197
 *                 if c_stop < 0 and l <= -c_stop:
 *                     raise ValueError, u"list.index(x): x not in slice"
 *             elif c_start < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"list.index(x): x not in slice"
 * 
 */
    __pyx_t_3 = ((__pyx_v_c_start < 0) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1198
 *                     raise ValueError, u"list.index(x): x not in slice"
 *             elif c_start < 0:
 *                 raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 * 
 *         # now determine the index backwards from child
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L16:;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1201
 * 
 *         # now determine the index backwards from child
 *         c_child = c_child.prev             # <<<<<<<<<<<<<<
 *         k = 0
 *         if c_stop > 0:
 */
  __pyx_t_2 = __pyx_v_c_child->prev;
  __pyx_v_c_child = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1202
 *         # now determine the index backwards from child
 *         c_child = c_child.prev
 *         k = 0             # <<<<<<<<<<<<<<
 *         if c_stop > 0:
 *             # we can optimize: stop after c_stop elements if not found
 */
  __pyx_v_k = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1203
 *         c_child = c_child.prev
 *         k = 0
 *         if c_stop > 0:             # <<<<<<<<<<<<<<
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
 */
  __pyx_t_3 = ((__pyx_v_c_stop > 0) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1205
 *         if c_stop > 0:
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k += 1
 */
    while (1) {
      __pyx_t_3 = ((__pyx_v_c_child != NULL) != 0);
      if (__pyx_t_3) {
        __pyx_t_4 = ((__pyx_v_k < __pyx_v_c_stop) != 0);
        __pyx_t_7 = __pyx_t_4;
      } else {
        __pyx_t_7 = __pyx_t_3;
      }
      if (!__pyx_t_7) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1206
 *             # we can optimize: stop after c_stop elements if not found
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k += 1
 *                 c_child = c_child.prev
 */
      __pyx_t_7 = (_isElement(__pyx_v_c_child) != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1207
 *             while c_child != NULL and k < c_stop:
 *                 if _isElement(c_child):
 *                     k += 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             if k < c_stop:
 */
        __pyx_v_k = (__pyx_v_k + 1);
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1208
 *                 if _isElement(c_child):
 *                     k += 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             if k < c_stop:
 *                 return k
 */
      __pyx_t_2 = __pyx_v_c_child->prev;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1209
 *                     k += 1
 *                 c_child = c_child.prev
 *             if k < c_stop:             # <<<<<<<<<<<<<<
 *                 return k
 *         else:
 */
    __pyx_t_7 = ((__pyx_v_k < __pyx_v_c_stop) != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1210
 *                 c_child = c_child.prev
 *             if k < c_stop:
 *                 return k             # <<<<<<<<<<<<<<
 *         else:
 *             # traverse all
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    goto __pyx_L18;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1213
 *         else:
 *             # traverse all
 *             while c_child != NULL:             # <<<<<<<<<<<<<<
 *                 if _isElement(c_child):
 *                     k = k + 1
 */
    while (1) {
      __pyx_t_7 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_7) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1214
 *             # traverse all
 *             while c_child != NULL:
 *                 if _isElement(c_child):             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *                 c_child = c_child.prev
 */
      __pyx_t_7 = (_isElement(__pyx_v_c_child) != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1215
 *             while c_child != NULL:
 *                 if _isElement(c_child):
 *                     k = k + 1             # <<<<<<<<<<<<<<
 *                 c_child = c_child.prev
 *             if c_start > 0:
 */
        __pyx_v_k = (__pyx_v_k + 1);
        goto __pyx_L25;
      }
      __pyx_L25:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1216
 *                 if _isElement(c_child):
 *                     k = k + 1
 *                 c_child = c_child.prev             # <<<<<<<<<<<<<<
 *             if c_start > 0:
 *                 if k >= c_start:
 */
      __pyx_t_2 = __pyx_v_c_child->prev;
      __pyx_v_c_child = __pyx_t_2;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1217
 *                     k = k + 1
 *                 c_child = c_child.prev
 *             if c_start > 0:             # <<<<<<<<<<<<<<
 *                 if k >= c_start:
 *                     return k
 */
    __pyx_t_7 = ((__pyx_v_c_start > 0) != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1218
 *                 c_child = c_child.prev
 *             if c_start > 0:
 *                 if k >= c_start:             # <<<<<<<<<<<<<<
 *                     return k
 *             else:
 */
      __pyx_t_7 = ((__pyx_v_k >= __pyx_v_c_start) != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1219
 *             if c_start > 0:
 *                 if k >= c_start:
 *                     return k             # <<<<<<<<<<<<<<
 *             else:
 *                 return k
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L0;
      }
      goto __pyx_L26;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1221
 *                     return k
 *             else:
 *                 return k             # <<<<<<<<<<<<<<
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, u"list.index(x): x not in slice"
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    __pyx_L26:;
  }
  __pyx_L18:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1222
 *             else:
 *                 return k
 *         if c_start != 0 or c_stop != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"list.index(x): x not in slice"
 *         else:
 */
  __pyx_t_7 = ((__pyx_v_c_start != 0) != 0);
  if (!__pyx_t_7) {
    __pyx_t_3 = ((__pyx_v_c_stop != 0) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_7;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1223
 *                 return k
 *         if c_start != 0 or c_stop != 0:
 *             raise ValueError, u"list.index(x): x not in slice"             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, u"list.index(x): x not in list"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_list_index_x_x_not_in_slice, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1225
 *             raise ValueError, u"list.index(x): x not in slice"
 *         else:
 *             raise ValueError, u"list.index(x): x not in list"             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_list_index_x_x_not_in_list, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1140
 *         return ElementChildIterator(self, reversed=True)
 * 
 *     def index(self, _Element child not None, start=None, stop=None):             # <<<<<<<<<<<<<<
 *         u"""index(self, child, start=None, stop=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1227
 *             raise ValueError, u"list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""get(self, key, default=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_47get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_46get[] = "get(self, key, default=None)\n\n        Gets an element attribute.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_47get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_46get(((struct LxmlElement *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_46get(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1232
 *         Gets an element attribute.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _getAttributeValue(self, key, default)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1233
 *         """
 *         _assertValidNode(self)
 *         return _getAttributeValue(self, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(__pyx_v_self, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1227
 *             raise ValueError, u"list.index(x): x not in list"
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""get(self, key, default=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1235
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"""keys(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_49keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_48keys[] = "keys(self)\n\n        Gets a list of attribute names.  The names are returned in an\n        arbitrary order (just like for an ordinary Python dictionary).\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_49keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_48keys(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_48keys(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1241
 *         arbitrary order (just like for an ordinary Python dictionary).
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 1)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1242
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_c_node, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1235
 *         return _getAttributeValue(self, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"""keys(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1244
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"""values(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_51values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_50values[] = "values(self)\n\n        Gets element attribute values as a sequence of strings.  The\n        attributes are returned in an arbitrary order.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_51values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_50values(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_50values(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1250
 *         attributes are returned in an arbitrary order.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 2)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1251
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_c_node, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1244
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"""values(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1253
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"""items(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_53items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_52items[] = "items(self)\n\n        Gets element attributes, as a sequence. The attributes are returned in\n        an arbitrary order.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_53items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_52items(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_52items(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1259
 *         an arbitrary order.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 3)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1260
 *         """
 *         _assertValidNode(self)
 *         return _collectAttributes(self._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 *     def getchildren(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_c_node, 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1253
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"""items(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1262
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""getchildren(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_55getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_54getchildren[] = "getchildren(self)\n\n        Returns all direct children.  The elements are returned in document\n        order.\n\n        :deprecated: Note that this method has been deprecated as of\n          ElementTree 1.3 and lxml 2.0.  New code should use\n          ``list(element)`` or simply iterate over elements.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_55getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getchildren (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_54getchildren(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_54getchildren(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getchildren", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1272
 *           ``list(element)`` or simply iterate over elements.
 *         """
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         return _collectChildren(self)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1273
 *         """
 *         _assertValidNode(self)
 *         return _collectChildren(self)             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectChildren(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1262
 *         return _collectAttributes(self._c_node, 3)
 * 
 *     def getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""getchildren(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Element.getchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1275
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         u"""getparent(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_57getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_56getparent[] = "getparent(self)\n\n        Returns the parent of this element or None for the root element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_57getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_56getparent(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_56getparent(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getparent", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1282
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__parentElement(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1283
 *         #_assertValidNode(self) # not needed
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1284
 *         c_node = _parentElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1285
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __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;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1275
 *         return _collectChildren(self)
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         u"""getparent(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getparent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1287
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         u"""getnext(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_59getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_58getnext[] = "getnext(self)\n\n        Returns the following sibling of this element or None.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_59getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getnext (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_58getnext(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_58getnext(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getnext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1294
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1295
 *         #_assertValidNode(self) # not needed
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1296
 *         c_node = _nextElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1297
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def getprevious(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1297; __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;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1287
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         u"""getnext(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1299
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         u"""getprevious(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_61getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_60getprevious[] = "getprevious(self)\n\n        Returns the preceding sibling of this element or None.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_61getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getprevious (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_60getprevious(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_60getprevious(struct LxmlElement *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getprevious", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1306
 *         cdef xmlNode* c_node
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__previousElement(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1307
 *         #_assertValidNode(self) # not needed
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1308
 *         c_node = _previousElement(self._c_node)
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1309
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1299
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         u"""getprevious(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1311
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         u"""itersiblings(self, tag=None, *tags, preceding=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_63itersiblings(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_62itersiblings[] = "itersiblings(self, tag=None, *tags, preceding=False)\n\n        Iterate over the following or preceding siblings of this element.\n\n        The direction is determined by the 'preceding' keyword which\n        defaults to False, i.e. forward iteration over the following\n        siblings.  When True, the iterator yields the preceding\n        siblings in reverse document order, i.e. starting right before\n        the current element and going backwards.\n\n        Can be restricted to find only elements with a specific tag,\n        see `iter`.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_63itersiblings(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_preceding = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itersiblings (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_preceding,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "itersiblings") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_preceding = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.itersiblings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_62itersiblings(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_preceding, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_62itersiblings(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_preceding, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itersiblings", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1325
 *         see `iter`.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1326
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1327
 *         if tag is not None:
 *             tags += (tag,)
 *         return SiblingsIterator(self, tags, preceding=preceding)             # <<<<<<<<<<<<<<
 * 
 *     def iterancestors(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_preceding, __pyx_v_preceding) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_SiblingsIterator)), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1311
 *         return _elementFactory(self._doc, c_node)
 * 
 *     def itersiblings(self, tag=None, *tags, preceding=False):             # <<<<<<<<<<<<<<
 *         u"""itersiblings(self, tag=None, *tags, preceding=False)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.itersiblings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1329
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iterancestors(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_65iterancestors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_64iterancestors[] = "iterancestors(self, tag=None, *tags)\n\n        Iterate over the ancestors of this element (from parent to parent).\n\n        Can be restricted to find only elements with a specific tag,\n        see `iter`.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_65iterancestors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterancestors (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "iterancestors") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iterancestors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_64iterancestors(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_64iterancestors(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterancestors", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1337
 *         see `iter`.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1338
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return AncestorsIterator(self, tags)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1339
 *         if tag is not None:
 *             tags += (tag,)
 *         return AncestorsIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def iterdescendants(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_AncestorsIterator)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1329
 *         return SiblingsIterator(self, tags, preceding=preceding)
 * 
 *     def iterancestors(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iterancestors(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.iterancestors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1341
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iterdescendants(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_67iterdescendants(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_66iterdescendants[] = "iterdescendants(self, tag=None, *tags)\n\n        Iterate over the descendants of this element in document order.\n\n        As opposed to ``el.iter()``, this iterator does not yield the element\n        itself.  The returned elements can be restricted to find only elements\n        with a specific tag, see `iter`.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_67iterdescendants(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterdescendants (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "iterdescendants") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iterdescendants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_66iterdescendants(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_66iterdescendants(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterdescendants", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1350
 *         with a specific tag, see `iter`.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1351
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1352
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)             # <<<<<<<<<<<<<<
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_inclusive, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1341
 *         return AncestorsIterator(self, tags)
 * 
 *     def iterdescendants(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iterdescendants(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.iterdescendants", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1354
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, *tags, reversed=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_69iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_68iterchildren[] = "iterchildren(self, tag=None, *tags, reversed=False)\n\n        Iterate over the children of this element.\n\n        As opposed to using normal iteration on this element, the returned\n        elements can be reversed with the 'reversed' keyword and restricted\n        to find only elements with a specific tag, see `iter`.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_69iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterchildren (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_reversed,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "iterchildren") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_68iterchildren(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_reversed, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_68iterchildren(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterchildren", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1363
 *         to find only elements with a specific tag, see `iter`.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1364
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1365
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementChildIterator(self, tags, reversed=reversed)             # <<<<<<<<<<<<<<
 * 
 *     def getroottree(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_reversed, __pyx_v_reversed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementChildIterator)), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1354
 *         return ElementDepthFirstIterator(self, tags, inclusive=False)
 * 
 *     def iterchildren(self, tag=None, *tags, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, *tags, reversed=False)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1367
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         u"""getroottree(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_71getroottree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_70getroottree[] = "getroottree(self)\n\n        Return an ElementTree for the root node of the document that\n        contains this element.\n\n        This is the same as following element.getparent() up the tree until it\n        returns None (for the root element) and then build an ElementTree for\n        the last parent that was returned.";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_71getroottree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroottree (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_70getroottree(((struct LxmlElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_70getroottree(struct LxmlElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getroottree", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1376
 *         returns None (for the root element) and then build an ElementTree for
 *         the last parent that was returned."""
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, None)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1377
 *         the last parent that was returned."""
 *         _assertValidDoc(self._doc)
 *         return _elementTreeFactory(self._doc, None)             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_1), ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1367
 *         return ElementChildIterator(self, tags, reversed=reversed)
 * 
 *     def getroottree(self):             # <<<<<<<<<<<<<<
 *         u"""getroottree(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.getroottree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1379
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""getiterator(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_73getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_72getiterator[] = "getiterator(self, tag=None, *tags)\n\n        Returns a sequence or iterator of all elements in the subtree in\n        document order (depth first pre-order), starting with this\n        element.\n\n        Can be restricted to find only elements with a specific tag,\n        see `iter`.\n\n        :deprecated: Note that this method is deprecated as of\n          ElementTree 1.3 and lxml 2.0.  It returns an iterator in\n          lxml, which diverges from the original ElementTree\n          behaviour.  If you want an efficient iterator, use the\n          ``element.iter()`` method instead.  You should only use this\n          method in new code if you require backwards compatibility\n          with older versions of lxml or ElementTree.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_73getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getiterator (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "getiterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_72getiterator(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_72getiterator(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getiterator", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1397
 *           with older versions of lxml or ElementTree.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1398
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); 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_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1399
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1379
 *         return _elementTreeFactory(self._doc, None)
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""getiterator(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1401
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iter(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_75iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_74iter[] = "iter(self, tag=None, *tags)\n\n        Iterate over all elements in the subtree in document order (depth\n        first pre-order), starting with this element.\n\n        Can be restricted to find only elements with a specific tag:\n        pass ``\"{ns}localname\"`` as tag. Either or both of ``ns`` and\n        ``localname`` can be ``*`` for a wildcard; ``ns`` can be empty\n        for no namespace. ``\"localname\"`` is equivalent to ``\"{}localname\"``\n        (i.e. no namespace) but ``\"*\"`` is ``\"{*}*\"`` (any or no namespace),\n        not ``\"{}*\"``.\n\n        You can also pass the Element, Comment, ProcessingInstruction and\n        Entity factory functions to look only for the specific element type.\n\n        Passing more than one tag will let the iterator return all elements\n        matching any of these tags, in document order.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_75iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "iter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_74iter(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_74iter(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iter", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1420
 *         matching any of these tags, in document order.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1421
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementDepthFirstIterator(self, tags)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1422
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementDepthFirstIterator(self, tags)             # <<<<<<<<<<<<<<
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementDepthFirstIterator)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1401
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iter(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Element.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1424
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         u"""itertext(self, tag=None, *tags, with_tail=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_77itertext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_76itertext[] = "itertext(self, tag=None, *tags, with_tail=True)\n\n        Iterates over the text content of a subtree.\n\n        You can pass a tag name to restrict text content to specific elements,\n        see `iter`.\n\n        You can set the ``with_tail`` keyword argument to ``False`` to skip\n        over tail text.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_77itertext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itertext (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_with_tail,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "itertext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_with_tail = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._Element.itertext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_76itertext(((struct LxmlElement *)__pyx_v_self), __pyx_v_tag, __pyx_v_with_tail, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_76itertext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itertext", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1435
 *         over tail text.
 *         """
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1436
 *         """
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1437
 *         if tag is not None:
 *             tags += (tag,)
 *         return ElementTextIterator(self, tags, with_tail=with_tail)             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_with_tail, __pyx_v_with_tail) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementTextIterator)), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1424
 *         return ElementDepthFirstIterator(self, tags)
 * 
 *     def itertext(self, tag=None, *tags, with_tail=True):             # <<<<<<<<<<<<<<
 *         u"""itertext(self, tag=None, *tags, with_tail=True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.itertext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1439
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_79makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_78makeelement[] = "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with the same document.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_79makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeelement (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrib);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, pos_args, "makeelement") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._Element.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_78makeelement(((struct LxmlElement *)__pyx_v_self), __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_78makeelement(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeelement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1444
 *         Creates a new element associated with the same document.
 *         """
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,
 *                             attrib, nsmap, _extra)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1445
 *         """
 *         _assertValidDoc(self._doc)
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1446
 *         _assertValidDoc(self._doc)
 *         return _makeElement(_tag, NULL, self._doc, None, None, None,
 *                             attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)__pyx_t_1), ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1439
 *         return ElementTextIterator(self, tags, with_tail=with_tail)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1448
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""find(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_81find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_80find[] = "find(self, path, namespaces=None)\n\n        Finds the first matching subelement, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_81find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_80find(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_80find(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1457
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1458
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.find(self, path, namespaces)
 * 
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1459
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.find(self, path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_find); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __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 = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1448
 *                             attrib, nsmap, _extra)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""find(self, path, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1461
 *         return _elementpath.find(self, path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findtext(self, path, default=None, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_83findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_82findtext[] = "findtext(self, path, default=None, namespaces=None)\n\n        Finds text for the first matching subelement, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_83findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findtext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_default,&__pyx_n_s_namespaces,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_default = values[1];
    __pyx_v_namespaces = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_82findtext(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_default, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_82findtext(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findtext", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1470
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1471
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findtext(self, path, default, namespaces)
 * 
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1472
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findtext(self, path, default, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_findtext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_default);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_default);
  __Pyx_GIVEREF(__pyx_v_default);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1461
 *         return _elementpath.find(self, path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findtext(self, path, default=None, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1474
 *         return _elementpath.findtext(self, path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findall(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_85findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_84findall[] = "findall(self, path, namespaces=None)\n\n        Finds all matching subelements, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_85findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findall") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_84findall(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_84findall(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findall", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1483
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1484
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.findall(self, path, namespaces)
 * 
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1485
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.findall(self, path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_findall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __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 = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1474
 *         return _elementpath.findtext(self, path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findall(self, path, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1487
 *         return _elementpath.findall(self, path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""iterfind(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_87iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_86iterfind[] = "iterfind(self, path, namespaces=None)\n\n        Iterates over all matching subelements, by tag name or path.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_87iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterfind (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterfind") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Element.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_86iterfind(((struct LxmlElement *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_86iterfind(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterfind", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1496
 *         prefixes in the path expression.
 *         """
 *         if isinstance(path, QName):             # <<<<<<<<<<<<<<
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_path, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1497
 *         """
 *         if isinstance(path, QName):
 *             path = (<QName>path).text             # <<<<<<<<<<<<<<
 *         return _elementpath.iterfind(self, path, namespaces)
 * 
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_path)->text;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1498
 *         if isinstance(path, QName):
 *             path = (<QName>path).text
 *         return _elementpath.iterfind(self, path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__elementpath, __pyx_n_s_iterfind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __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 = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1487
 *         return _elementpath.findall(self, path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""iterfind(self, path, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Element.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1500
 *         return _elementpath.iterfind(self, path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Element_89xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8_Element_88xpath[] = "xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)\n\n        Evaluate an xpath expression using the element as context node.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8_Element_89xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v__variables = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xpath (wrapper)", 0);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_smart_strings,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1501
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
    values[3] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && (kw_args <= 3)) {
        Py_ssize_t index;
        for (index = 1; index < 4 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, pos_args, "xpath") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree._Element.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8_Element_88xpath(((struct LxmlElement *)__pyx_v_self), __pyx_v__path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_smart_strings, __pyx_v__variables);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1500
 *         return _elementpath.iterfind(self, path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

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

static PyObject *__pyx_pf_4lxml_5etree_8_Element_88xpath(struct LxmlElement *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_evaluator = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xpath", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1506
 *         Evaluate an xpath expression using the element as context node.
 *         """
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1507
 *         """
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,
 *                                           extensions=extensions,             # <<<<<<<<<<<<<<
 *                                           smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1508
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *         return evaluator(_path, **_variables)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1506
 *         Evaluate an xpath expression using the element as context node.
 *         """
 *         evaluator = XPathElementEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_evaluator = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1509
 *                                           extensions=extensions,
 *                                           smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v__path);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__path);
  __Pyx_GIVEREF(__pyx_v__path);
  __pyx_t_2 = __pyx_v__variables;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_evaluator), __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1500
 *         return _elementpath.iterfind(self, path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Element.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_evaluator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1516
 *     cdef object NEW_ELEMENT "PY_NEW" (object t)
 * 
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _Element result
 *     result = getProxy(c_node)
 */

static struct LxmlElement *__pyx_f_4lxml_5etree__elementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_v_result = 0;
  PyObject *__pyx_v_element_class = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_elementFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1518
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):
 *     cdef _Element result
 *     result = getProxy(c_node)             # <<<<<<<<<<<<<<
 *     if result is not None:
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1519
 *     cdef _Element result
 *     result = getProxy(c_node)
 *     if result is not None:             # <<<<<<<<<<<<<<
 *         return result
 *     if c_node is NULL:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_result) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1520
 *     result = getProxy(c_node)
 *     if result is not None:
 *         return result             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1521
 *     if result is not None:
 *         return result
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_3 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1522
 *         return result
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct LxmlElement *)Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1525
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 */
  __pyx_t_1 = __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE;
  __Pyx_INCREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1524
 *         return None
 * 
 *     element_class = LOOKUP_ELEMENT_CLASS(             # <<<<<<<<<<<<<<
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if hasProxy(c_node):
 */
  __pyx_t_4 = __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS(__pyx_t_1, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_element_class = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1526
 *     element_class = LOOKUP_ELEMENT_CLASS(
 *         ELEMENT_CLASS_LOOKUP_STATE, doc, c_node)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
 */
  __pyx_t_3 = (__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1528
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)             # <<<<<<<<<<<<<<
 *     result = NEW_ELEMENT(element_class)
 *     if hasProxy(c_node):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1529
 *         # prevent re-entry race condition - we just called into Python
 *         return getProxy(c_node)
 *     result = NEW_ELEMENT(element_class)             # <<<<<<<<<<<<<<
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 */
  __pyx_t_4 = PY_NEW(__pyx_v_element_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_result, ((struct LxmlElement *)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1530
 *         return getProxy(c_node)
 *     result = NEW_ELEMENT(element_class)
 *     if hasProxy(c_node):             # <<<<<<<<<<<<<<
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
 */
  __pyx_t_3 = (__pyx_f_4lxml_5etree_hasProxy(__pyx_v_c_node) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1532
 *     if hasProxy(c_node):
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL             # <<<<<<<<<<<<<<
 *         return getProxy(c_node)
 * 
 */
    __pyx_v_result->_c_node = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1533
 *         # prevent re-entry race condition - we just called into Python
 *         result._c_node = NULL
 *         return getProxy(c_node)             # <<<<<<<<<<<<<<
 * 
 *     _registerProxy(result, doc, c_node)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree_getProxy(__pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1535
 *         return getProxy(c_node)
 * 
 *     _registerProxy(result, doc, c_node)             # <<<<<<<<<<<<<<
 *     if element_class is not _Element:
 *         result._init()
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__registerProxy(__pyx_v_result, __pyx_v_doc, __pyx_v_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1536
 * 
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:             # <<<<<<<<<<<<<<
 *         result._init()
 *     return result
 */
  __pyx_t_3 = (__pyx_v_element_class != ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1537
 *     _registerProxy(result, doc, c_node)
 *     if element_class is not _Element:
 *         result._init()             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_init_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1538
 *     if element_class is not _Element:
 *         result._init()
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1516
 *     cdef object NEW_ELEMENT "PY_NEW" (object t)
 * 
 * cdef _Element _elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _Element result
 *     result = getProxy(c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._elementFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_element_class);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1543
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"this element does not have children or attributes"
 * 
 */

static int __pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raiseImmutable", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1544
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:
 *         raise TypeError, u"this element does not have children or attributes"             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_this_element_does_not_have_child, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1543
 * @cython.internal
 * cdef class __ContentOnlyElement(_Element):
 *     cdef int _raiseImmutable(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"this element does not have children or attributes"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement._raiseImmutable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1546
 *         raise TypeError, u"this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"set(self, key, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_set[] = "set(self, key, value)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_key, __pyx_v_value);

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_set(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1548
 *     def set(self, key, value):
 *         u"set(self, key, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def append(self, value):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1546
 *         raise TypeError, u"this element does not have children or attributes"
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"set(self, key, value)"
 *         self._raiseImmutable()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1550
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         u"append(self, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append[] = "append(self, value)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_2append(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1552
 *     def append(self, value):
 *         u"append(self, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, index, value):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1550
 *         self._raiseImmutable()
 * 
 *     def append(self, value):             # <<<<<<<<<<<<<<
 *         u"append(self, value)"
 *         self._raiseImmutable()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1554
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         u"insert(self, index, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert[] = "insert(self, index, value)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_index = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4insert(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_index, __pyx_v_value);

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4insert(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1556
 *     def insert(self, index, value):
 *         u"insert(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1554
 *         self._raiseImmutable()
 * 
 *     def insert(self, index, value):             # <<<<<<<<<<<<<<
 *         u"insert(self, index, value)"
 *         self._raiseImmutable()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1558
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         u"__setitem__(self, index, value)"
 *         self._raiseImmutable()
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_6__setitem__[] = "__setitem__(self, index, value)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__;
#endif
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6__setitem__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6__setitem__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_index, CYTHON_UNUSED PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1560
 *     def __setitem__(self, index, value):
 *         u"__setitem__(self, index, value)"
 *         self._raiseImmutable()             # <<<<<<<<<<<<<<
 * 
 *     property attrib:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement *)__pyx_v_self->__pyx_vtab)->_raiseImmutable(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1558
 *         self._raiseImmutable()
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         u"__setitem__(self, index, value)"
 *         self._raiseImmutable()
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1563
 * 
 *     property attrib:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return IMMUTABLE_EMPTY_MAPPING
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_6attrib_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_6attrib___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1564
 *     property attrib:
 *         def __get__(self):
 *             return IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  __pyx_r = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1563
 * 
 *     property attrib:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return IMMUTABLE_EMPTY_MAPPING
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1567
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicodeOrEmpty(self._c_node.content)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text___get__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1568
 *     property text:
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicodeOrEmpty(self._c_node.content)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1569
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicodeOrEmpty(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_self->__pyx_base._c_node->content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1567
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicodeOrEmpty(self._c_node.content)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1571
 *             return funicodeOrEmpty(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_2__set__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_20__ContentOnlyElement_4text_2__set__(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1573
 *         def __set__(self, value):
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1574
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1575
 *             _assertValidNode(self)
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
 */
    __pyx_v_c_text = ((const xmlChar *)NULL);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1577
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1578
 *             else:
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 */
    __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1579
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
  xmlNodeSetContent(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1571
 *             return funicodeOrEmpty(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             _assertValidNode(self)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1582
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"__getitem__(self, x)"
 *         if isinstance(x, slice):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_8__getitem__[] = "__getitem__(self, x)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_8__getitem__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_8__getitem__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1584
 *     def __getitem__(self, x):
 *         u"__getitem__(self, x)"
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
 */
  __pyx_t_1 = PySlice_Check(__pyx_v_x); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1585
 *         u"__getitem__(self, x)"
 *         if isinstance(x, slice):
 *             return []             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, u"list index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1587
 *             return []
 *         else:
 *             raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_u_list_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1582
 * 
 *     # ACCESSORS
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"__getitem__(self, x)"
 *         if isinstance(x, slice):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1589
 *             raise IndexError, u"list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"__len__(self)"
 *         return 0
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_10__len__[] = "__len__(self)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__;
#endif
static Py_ssize_t __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_10__len__(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_4lxml_5etree_20__ContentOnlyElement_10__len__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1591
 *     def __len__(self):
 *         u"__len__(self)"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1589
 *             raise IndexError, u"list index out of range"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"__len__(self)"
 *         return 0
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1593
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"get(self, key, default=None)"
 *         return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get[] = "get(self, key, default=None)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_key = 0;
  CYTHON_UNUSED PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_12get(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_12get(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1595
 *     def get(self, key, default=None):
 *         u"get(self, key, default=None)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1593
 *         return 0
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"get(self, key, default=None)"
 *         return None
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1597
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"keys(self)"
 *         return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys[] = "keys(self)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_14keys(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_14keys(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1599
 *     def keys(self):
 *         u"keys(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1597
 *         return None
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"keys(self)"
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1601
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"items(self)"
 *         return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items[] = "items(self)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_16items(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_16items(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1603
 *     def items(self):
 *         u"items(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1601
 *         return []
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"items(self)"
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1605
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"values(self)"
 *         return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values[] = "values(self)";
static PyObject *__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20__ContentOnlyElement_18values(((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20__ContentOnlyElement_18values(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree___ContentOnlyElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1607
 *     def values(self):
 *         u"values(self)"
 *         return []             # <<<<<<<<<<<<<<
 * 
 * cdef class _Comment(__ContentOnlyElement):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1605
 *         return []
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"values(self)"
 *         return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.__ContentOnlyElement.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1611
 * cdef class _Comment(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return Comment
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_3tag_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Comment_3tag___get__(((struct __pyx_obj_4lxml_5etree__Comment *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Comment_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1612
 *     property tag:
 *         def __get__(self):
 *             return Comment             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1611
 * cdef class _Comment(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return Comment
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Comment.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1614
 *             return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"<!--%s-->" % self.text
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8_Comment_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8_Comment___repr__(((struct __pyx_obj_4lxml_5etree__Comment *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8_Comment___repr__(struct __pyx_obj_4lxml_5etree__Comment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1615
 * 
 *     def __repr__(self):
 *         return u"<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 * 
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1614
 *             return Comment
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"<!--%s-->" % self.text
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Comment.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1619
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ProcessingInstruction
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3tag_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1620
 *     property tag:
 *         def __get__(self):
 *             return ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 *     property target:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1619
 * cdef class _ProcessingInstruction(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return ProcessingInstruction
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1624
 *     property target:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1625
 *         # not in ElementTree
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1626
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1624
 *     property target:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1628
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value = _utf8(value)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_2__set__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6target_2__set__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1629
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1630
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1631
 *             _assertValidNode(self)
 *             value = _utf8(value)
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1632
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1628
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value = _utf8(value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.target.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1634
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         text = self.text
 *         if text:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction___repr__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1635
 * 
 *     def __repr__(self):
 *         text = self.text             # <<<<<<<<<<<<<<
 *         if text:
 *             return u"<?%s %s?>" % (self.target, text)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_text = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1636
 *     def __repr__(self):
 *         text = self.text
 *         if text:             # <<<<<<<<<<<<<<
 *             return u"<?%s %s?>" % (self.target, text)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1637
 *         text = self.text
 *         if text:
 *             return u"<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *         else:
 *             return u"<?%s?>" % self.target
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __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 = 1637; __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(__pyx_v_text);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_text);
    __Pyx_GIVEREF(__pyx_v_text);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_s_s_3, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1639
 *             return u"<?%s %s?>" % (self.target, text)
 *         else:
 *             return u"<?%s?>" % self.target             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1634
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         text = self.text
 *         if text:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1641
 *             return u"<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""get(self, key, default=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22_ProcessingInstruction_2get[] = "get(self, key, default=None)\n\n        Try to parse pseudo-attributes from the text content of the\n        processing instruction, search for one with the given key as\n        name and return its associated value.\n\n        Note that this is only a convenience method for the most\n        common case that all text content is structured in\n        attribute-like name-value pairs with properly quoted values.\n        It is not guaranteed to work for all possible text content.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_2get(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_2get(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1653
 *         It is not guaranteed to work for all possible text content.
 *         """
 *         return self.attrib.get(key, default)             # <<<<<<<<<<<<<<
 * 
 *     property attrib:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attrib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_key);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
  __Pyx_GIVEREF(__pyx_v_key);
  __Pyx_INCREF(__pyx_v_default);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_default);
  __Pyx_GIVEREF(__pyx_v_default);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __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_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1641
 *             return u"<?%s?>" % self.target
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""get(self, key, default=None)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1661
 *         XML node, although this is not guaranteed to stay this way.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return { attr : (value1 or value2)
 *                      for attr, value1, value2 in _FIND_PI_ATTRIBUTES(u' ' + self.text) }
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_ProcessingInstruction_6attrib_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_ProcessingInstruction_6attrib___get__(((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_ProcessingInstruction_6attrib___get__(struct __pyx_obj_4lxml_5etree__ProcessingInstruction *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1662
 *         """
 *         def __get__(self):
 *             return { attr : (value1 or value2)             # <<<<<<<<<<<<<<
 *                      for attr, value1, value2 in _FIND_PI_ATTRIBUTES(u' ' + self.text) }
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    PyObject *__pyx_7genexpr__pyx_v_attr = NULL;
    PyObject *__pyx_7genexpr__pyx_v_value1 = NULL;
    PyObject *__pyx_7genexpr__pyx_v_value2 = NULL;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1663
 *         def __get__(self):
 *             return { attr : (value1 or value2)
 *                      for attr, value1, value2 in _FIND_PI_ATTRIBUTES(u' ' + self.text) }             # <<<<<<<<<<<<<<
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(ur'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_kp_u__14, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_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[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_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 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __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_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        #endif
      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        #endif
      } else {
        __pyx_t_3 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_attr, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_value1, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_value2, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1662
 *         """
 *         def __get__(self):
 *             return { attr : (value1 or value2)             # <<<<<<<<<<<<<<
 *                      for attr, value1, value2 in _FIND_PI_ATTRIBUTES(u' ' + self.text) }
 * 
 */
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_7genexpr__pyx_v_value1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      if (!__pyx_t_11) {
        __Pyx_INCREF(__pyx_7genexpr__pyx_v_value2);
        __pyx_t_3 = __pyx_7genexpr__pyx_v_value2;
      } else {
        __Pyx_INCREF(__pyx_7genexpr__pyx_v_value1);
        __pyx_t_3 = __pyx_7genexpr__pyx_v_value1;
      }
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_attr, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_attr);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value1);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value2);
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_attr);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value1);
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_value2);
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1661
 *         XML node, although this is not guaranteed to stay this way.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return { attr : (value1 or value2)
 *                      for attr, value1, value2 in _FIND_PI_ATTRIBUTES(u' ' + self.text) }
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._ProcessingInstruction.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1669
 * cdef class _Entity(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return Entity
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_3tag_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_3tag___get__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_3tag___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1670
 *     property tag:
 *         def __get__(self):
 *             return Entity             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Entity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1669
 * cdef class _Entity(__ContentOnlyElement):
 *     property tag:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return Entity
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Entity.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1674
 *     property name:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_4name___get__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4name___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1675
 *         # not in ElementTree
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1676
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1674
 *     property name:
 *         # not in ElementTree
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return funicode(self._c_node.name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1678
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Entity_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Entity_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_4name_2__set__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_7_Entity_4name_2__set__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_value_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1679
 * 
 *         def __set__(self, value):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1680
 *         def __set__(self, value):
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError(u"Invalid entity name '%s'" % value)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1681
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"Invalid entity name '%s'" % value)
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 */
  __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_kp_b__24, __pyx_v_value_utf, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(__pyx_t_3 != 0)) {
    __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_kp_b__25, __pyx_v_value_utf, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (__pyx_t_4 != 0);
  } else {
    __pyx_t_5 = (__pyx_t_3 != 0);
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1682
 *             value_utf = _utf8(value)
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError(u"Invalid entity name '%s'" % value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 */
    __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_Invalid_entity_name_s, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __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, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1683
 *             if b'&' in value_utf or b';' in value_utf:
 *                 raise ValueError(u"Invalid entity name '%s'" % value)
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1678
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             value_utf = _utf8(value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Entity.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1688
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 *         # entity value ?
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return u'&%s;' % funicode(self._c_node.name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity_4text___get__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Entity_4text___get__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1689
 *         # entity value ?
 *         def __get__(self):
 *             _assertValidNode(self)             # <<<<<<<<<<<<<<
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1690
 *         def __get__(self):
 *             _assertValidNode(self)
 *             return u'&%s;' % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s_3, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __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;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1688
 *         # FIXME: should this be None or '&[VALUE];' or the resolved
 *         # entity value ?
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidNode(self)
 *             return u'&%s;' % funicode(self._c_node.name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Entity.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1692
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"&%s;" % self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Entity_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Entity___repr__(((struct __pyx_obj_4lxml_5etree__Entity *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Entity___repr__(struct __pyx_obj_4lxml_5etree__Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1693
 * 
 *     def __repr__(self):
 *         return u"&%s;" % self.name             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_s_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1692
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"&%s;" % self.name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Entity.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1719
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5QName_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5QName_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text_or_uri_or_element = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text_or_uri_or_element,&__pyx_n_s_tag,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text_or_uri_or_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text_or_uri_or_element = values[0];
    __pyx_v_tag = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.QName.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5QName___init__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self), __pyx_v_text_or_uri_or_element, __pyx_v_tag);

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

static int __pyx_pf_4lxml_5etree_5QName___init__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self, PyObject *__pyx_v_text_or_uri_or_element, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_tag_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_text_or_uri_or_element);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1720
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 */
  __pyx_t_1 = ((!(_isString(__pyx_v_text_or_uri_or_element) != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1721
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1722
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag             # <<<<<<<<<<<<<<
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_text_or_uri_or_element, __pyx_n_s_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1723
 *             if isinstance(text_or_uri_or_element, _Element):
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):             # <<<<<<<<<<<<<<
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 *                                        type(text_or_uri_or_element))
 */
      __pyx_t_2 = ((!(_isString(__pyx_v_text_or_uri_or_element) != 0)) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1724
 *                 text_or_uri_or_element = (<_Element>text_or_uri_or_element).tag
 *                 if not _isString(text_or_uri_or_element):
 *                     raise ValueError, (u"Invalid input tag of type %r" %             # <<<<<<<<<<<<<<
 *                                        type(text_or_uri_or_element))
 *             elif isinstance(text_or_uri_or_element, QName):
 */
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Invalid_input_tag_of_type_r, ((PyObject *)Py_TYPE(__pyx_v_text_or_uri_or_element))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L4;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1726
 *                     raise ValueError, (u"Invalid input tag of type %r" %
 *                                        type(text_or_uri_or_element))
 *             elif isinstance(text_or_uri_or_element, QName):             # <<<<<<<<<<<<<<
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             else:
 */
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_text_or_uri_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1727
 *                                        type(text_or_uri_or_element))
 *             elif isinstance(text_or_uri_or_element, QName):
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text             # <<<<<<<<<<<<<<
 *             else:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 */
      __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_text_or_uri_or_element)->text;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1729
 *                 text_or_uri_or_element = (<QName>text_or_uri_or_element).text
 *             else:
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_text_or_uri_or_element);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_text_or_uri_or_element);
      __Pyx_GIVEREF(__pyx_v_text_or_uri_or_element);
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_text_or_uri_or_element, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1731
 *                 text_or_uri_or_element = unicode(text_or_uri_or_element)
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_text_or_uri_or_element); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(__pyx_t_4 != Py_None)) {
    PyObject* sequence = __pyx_t_4;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns_utf = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_tag_utf = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1732
 * 
 *         ns_utf, tag_utf = _getNsTag(text_or_uri_or_element)
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
 */
  __pyx_t_1 = (__pyx_v_tag != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1734
 *         if tag is not None:
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:             # <<<<<<<<<<<<<<
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
 */
    __pyx_t_2 = (__pyx_v_ns_utf == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1735
 *             # either ('ns', 'tag') or ('{ns}oldtag', 'newtag')
 *             if ns_utf is None:
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name             # <<<<<<<<<<<<<<
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)
 */
      __Pyx_INCREF(__pyx_v_tag_utf);
      __Pyx_DECREF_SET(__pyx_v_ns_utf, __pyx_v_tag_utf);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1736
 *             if ns_utf is None:
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)             # <<<<<<<<<<<<<<
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_tag_utf, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1737
 *                 ns_utf = tag_utf # case 1: namespace ended up as tag name
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)             # <<<<<<<<<<<<<<
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__tagValidOrRaise(__pyx_v_tag_utf); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1738
 *             tag_utf = _utf8(tag)
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')             # <<<<<<<<<<<<<<
 *         if ns_utf is None:
 *             self.namespace = None
 */
  if (unlikely(__pyx_v_tag_utf == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = __Pyx_decode_bytes(((PyObject*)__pyx_v_tag_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->localname);
  __Pyx_DECREF(__pyx_v_self->localname);
  __pyx_v_self->localname = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1739
 *         _tagValidOrRaise(tag_utf)
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:             # <<<<<<<<<<<<<<
 *             self.namespace = None
 *             self.text = self.localname
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1740
 *         self.localname = (<bytes>tag_utf).decode('utf8')
 *         if ns_utf is None:
 *             self.namespace = None             # <<<<<<<<<<<<<<
 *             self.text = self.localname
 *         else:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->namespace);
    __Pyx_DECREF(__pyx_v_self->namespace);
    __pyx_v_self->namespace = ((PyObject*)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1741
 *         if ns_utf is None:
 *             self.namespace = None
 *             self.text = self.localname             # <<<<<<<<<<<<<<
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 */
    __pyx_t_4 = __pyx_v_self->localname;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->text);
    __Pyx_DECREF(__pyx_v_self->text);
    __pyx_v_self->text = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1743
 *             self.text = self.localname
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')             # <<<<<<<<<<<<<<
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
 */
    if (unlikely(__pyx_v_ns_utf == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_decode_bytes(((PyObject*)__pyx_v_ns_utf), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->namespace);
    __Pyx_DECREF(__pyx_v_self->namespace);
    __pyx_v_self->namespace = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1744
 *         else:
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return self.text
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_self->namespace);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->namespace);
    __Pyx_GIVEREF(__pyx_v_self->namespace);
    __Pyx_INCREF(__pyx_v_self->localname);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->localname);
    __Pyx_GIVEREF(__pyx_v_self->localname);
    __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_s_s_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->text);
    __Pyx_DECREF(__pyx_v_self->text);
    __pyx_v_self->text = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1719
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):             # <<<<<<<<<<<<<<
 *         if not _isString(text_or_uri_or_element):
 *             if isinstance(text_or_uri_or_element, _Element):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.QName.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_tag_utf);
  __Pyx_XDECREF(__pyx_v_text_or_uri_or_element);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1745
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.text
 *     def __hash__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_3__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_2__str__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_5QName_2__str__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1746
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):
 *         return self.text             # <<<<<<<<<<<<<<
 *     def __hash__(self):
 *         return hash(self.text)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->text);
  __pyx_r = __pyx_v_self->text;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1745
 *             self.namespace = (<bytes>ns_utf).decode('utf8')
 *             self.text = u"{%s}%s" % (self.namespace, self.localname)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.text
 *     def __hash__(self):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1747
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self.text)
 *     def __richcmp__(one, other, int op):
 */

/* Python wrapper */
static Py_hash_t __pyx_pw_4lxml_5etree_5QName_5__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_4lxml_5etree_5QName_5__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_4__hash__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

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

static Py_hash_t __pyx_pf_4lxml_5etree_5QName_4__hash__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_hash_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1748
 *         return self.text
 *     def __hash__(self):
 *         return hash(self.text)             # <<<<<<<<<<<<<<
 *     def __richcmp__(one, other, int op):
 *         try:
 */
  __pyx_t_1 = __pyx_v_self->text;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1747
 *     def __str__(self):
 *         return self.text
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self.text)
 *     def __richcmp__(one, other, int op):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.QName.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1749
 *     def __hash__(self):
 *         return hash(self.text)
 *     def __richcmp__(one, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if type(one) is QName:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_7__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_7__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_6__richcmp__(((PyObject *)__pyx_v_one), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

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

static PyObject *__pyx_pf_4lxml_5etree_5QName_6__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_INCREF(__pyx_v_one);
  __Pyx_INCREF(__pyx_v_other);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1750
 *         return hash(self.text)
 *     def __richcmp__(one, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if type(one) is QName:
 *                 one = (<QName>one).text
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1751
 *     def __richcmp__(one, other, int op):
 *         try:
 *             if type(one) is QName:             # <<<<<<<<<<<<<<
 *                 one = (<QName>one).text
 *             elif not isinstance(one, unicode):
 */
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_one)) == ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName)));
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1752
 *         try:
 *             if type(one) is QName:
 *                 one = (<QName>one).text             # <<<<<<<<<<<<<<
 *             elif not isinstance(one, unicode):
 *                 one = unicode(one)
 */
        __pyx_t_6 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_one)->text;
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF_SET(__pyx_v_one, __pyx_t_6);
        __pyx_t_6 = 0;
        goto __pyx_L11;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1753
 *             if type(one) is QName:
 *                 one = (<QName>one).text
 *             elif not isinstance(one, unicode):             # <<<<<<<<<<<<<<
 *                 one = unicode(one)
 *             if type(other) is QName:
 */
      __pyx_t_5 = PyUnicode_Check(__pyx_v_one); 
      __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1754
 *                 one = (<QName>one).text
 *             elif not isinstance(one, unicode):
 *                 one = unicode(one)             # <<<<<<<<<<<<<<
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 */
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_one);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_one);
        __Pyx_GIVEREF(__pyx_v_one);
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_one, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1755
 *             elif not isinstance(one, unicode):
 *                 one = unicode(one)
 *             if type(other) is QName:             # <<<<<<<<<<<<<<
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
 */
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_other)) == ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_QName)));
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1756
 *                 one = unicode(one)
 *             if type(other) is QName:
 *                 other = (<QName>other).text             # <<<<<<<<<<<<<<
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)
 */
        __pyx_t_7 = ((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_other)->text;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L12;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1757
 *             if type(other) is QName:
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):             # <<<<<<<<<<<<<<
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
 */
      __pyx_t_5 = PyUnicode_Check(__pyx_v_other); 
      __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1758
 *                 other = (<QName>other).text
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)             # <<<<<<<<<<<<<<
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented
 */
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_other);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_other);
        __Pyx_GIVEREF(__pyx_v_other);
        __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_6);
        __pyx_t_6 = 0;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1759
 *             elif not isinstance(other, unicode):
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_ValueError) || PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree.QName.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1760
 *                 other = unicode(other)
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(one, other, op)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1761
 *         except (ValueError, UnicodeDecodeError):
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyObject_RichCompare(__pyx_v_one, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1749
 *     def __hash__(self):
 *         return hash(self.text)
 *     def __richcmp__(one, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if type(one) is QName:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.QName.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_one);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1716
 *     their text content.
 *     """
 *     cdef readonly unicode text             # <<<<<<<<<<<<<<
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_4text___get__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_5QName_4text___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->text);
  __pyx_r = __pyx_v_self->text;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1717
 *     """
 *     cdef readonly unicode text
 *     cdef readonly unicode localname             # <<<<<<<<<<<<<<
 *     cdef readonly unicode namespace
 *     def __init__(self, text_or_uri_or_element, tag=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_9localname_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_9localname_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_9localname___get__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_5QName_9localname___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->localname);
  __pyx_r = __pyx_v_self->localname;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1718
 *     cdef readonly unicode text
 *     cdef readonly unicode localname
 *     cdef readonly unicode namespace             # <<<<<<<<<<<<<<
 *     def __init__(self, text_or_uri_or_element, tag=None):
 *         if not _isString(text_or_uri_or_element):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5QName_9namespace_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5QName_9namespace_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5QName_9namespace___get__(((struct __pyx_obj_4lxml_5etree_QName *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_5QName_9namespace___get__(struct __pyx_obj_4lxml_5etree_QName *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->namespace);
  __pyx_r = __pyx_v_self->namespace;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1774
 * 
 *     @cython.final
 *     cdef int _assertHasRoot(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""We have to take care here: the document may not have a root node!
 *         This can happen if ElementTree() is called without any argument and
 */

static int __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(struct LxmlElementTree *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertHasRoot", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1780
 *         the caller program.
 *         """
 *         assert self._context_node is not None, \             # <<<<<<<<<<<<<<
 *                u"ElementTree not initialized, missing root"
 *         return 0
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_ElementTree_not_initialized_miss);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1782
 *         assert self._context_node is not None, \
 *                u"ElementTree not initialized, missing root"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1774
 * 
 *     @cython.final
 *     cdef int _assertHasRoot(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""We have to take care here: the document may not have a root node!
 *         This can happen if ElementTree() is called without any argument and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree._assertHasRoot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1784
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""parse(self, source, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_1parse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_parse[] = "parse(self, source, parser=None, base_url=None)\n\n        Updates self with the content of source and returns its root\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_1parse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_parse(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_parse(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1789
 *         Updates self with the content of source and returns its root
 *         """
 *         cdef _Document doc = None             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1790
 *         """
 *         cdef _Document doc = None
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(source, parser, base_url)
 *             self._context_node = doc.getroot()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1791
 *         cdef _Document doc = None
 *         try:
 *             doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *             self._context_node = doc.getroot()
 *             if self._context_node is None:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, __pyx_v_parser, __pyx_v_base_url)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1792
 *         try:
 *             doc = _parseDocument(source, parser, base_url)
 *             self._context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *             if self._context_node is None:
 *                 self._doc = doc
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_context_node);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_context_node));
      __pyx_v_self->_context_node = ((struct LxmlElement *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1793
 *             doc = _parseDocument(source, parser, base_url)
 *             self._context_node = doc.getroot()
 *             if self._context_node is None:             # <<<<<<<<<<<<<<
 *                 self._doc = doc
 *         except _TargetParserResult as result_container:
 */
      __pyx_t_5 = (((PyObject *)__pyx_v_self->_context_node) == Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1794
 *             self._context_node = doc.getroot()
 *             if self._context_node is None:
 *                 self._doc = doc             # <<<<<<<<<<<<<<
 *         except _TargetParserResult as result_container:
 *             # raises a TypeError if we don't get an _Element
 */
        __Pyx_INCREF(((PyObject *)__pyx_v_doc));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
        __Pyx_GOTREF(__pyx_v_self->_doc);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
        __pyx_v_self->_doc = __pyx_v_doc;
        goto __pyx_L11;
      }
      __pyx_L11:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1795
 *             if self._context_node is None:
 *                 self._doc = doc
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_result_container = __pyx_t_8;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1797
 *         except _TargetParserResult as result_container:
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result             # <<<<<<<<<<<<<<
 *         return self._context_node
 * 
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->_context_node);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_context_node));
      __pyx_v_self->_context_node = ((struct LxmlElement *)__pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1798
 *             # raises a TypeError if we don't get an _Element
 *             self._context_node = result_container.result
 *         return self._context_node             # <<<<<<<<<<<<<<
 * 
 *     def _setroot(self, _Element root not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_context_node));
  __pyx_r = ((PyObject *)__pyx_v_self->_context_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1784
 *         return 0
 * 
 *     def parse(self, source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""parse(self, source, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._ElementTree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1800
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         u"""_setroot(self, root)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot(PyObject *__pyx_v_self, PyObject *__pyx_v_root); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_2_setroot[] = "_setroot(self, root)\n\n        Relocate the ElementTree to a new root node.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot(PyObject *__pyx_v_self, PyObject *__pyx_v_root) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setroot (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root), __pyx_ptype_4lxml_5etree__Element, 0, "root", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(((struct LxmlElementTree *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_root));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_2_setroot(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_root) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setroot", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1805
 *         Relocate the ElementTree to a new root node.
 *         """
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1806
 *         """
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 *         self._context_node = root
 */
  __pyx_t_2 = ((__pyx_v_root->_c_node->type != XML_ELEMENT_NODE) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1807
 *         _assertValidNode(root)
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, u"Only elements can be the root of an ElementTree"             # <<<<<<<<<<<<<<
 *         self._context_node = root
 *         self._doc = None
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Only_elements_can_be_the_root_of, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1808
 *         if root._c_node.type != tree.XML_ELEMENT_NODE:
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 *         self._context_node = root             # <<<<<<<<<<<<<<
 *         self._doc = None
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_root));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
  __Pyx_GOTREF(__pyx_v_self->_context_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_context_node));
  __pyx_v_self->_context_node = __pyx_v_root;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1809
 *             raise TypeError, u"Only elements can be the root of an ElementTree"
 *         self._context_node = root
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     def getroot(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1800
 *         return self._context_node
 * 
 *     def _setroot(self, _Element root not None):             # <<<<<<<<<<<<<<
 *         u"""_setroot(self, root)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree._setroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1811
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         u"""getroot(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_5getroot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_4getroot[] = "getroot(self)\n\n        Gets the root element for this tree.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_5getroot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroot (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_4getroot(((struct LxmlElementTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_4getroot(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getroot", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1816
 *         Gets the root element for this tree.
 *         """
 *         return self._context_node             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_context_node));
  __pyx_r = ((PyObject *)__pyx_v_self->_context_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1811
 *         self._doc = None
 * 
 *     def getroot(self):             # <<<<<<<<<<<<<<
 *         u"""getroot(self)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1818
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_6__copy__(((struct LxmlElementTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6__copy__(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1819
 * 
 *     def __copy__(self):
 *         return _elementTreeFactory(self._doc, self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_1), ((struct LxmlElement *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1818
 *         return self._context_node
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1821
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(((struct LxmlElementTree *)__pyx_v_self), ((PyObject *)__pyx_v_memo));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_8__deepcopy__(struct LxmlElementTree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  struct LxmlElement *__pyx_v_root = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  xmlDtd *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1825
 *         cdef _Document doc
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node.__copy__()
 *             assert root is not None
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1826
 *         cdef xmlDoc* c_doc
 *         if self._context_node is not None:
 *             root = self._context_node.__copy__()             # <<<<<<<<<<<<<<
 *             assert root is not None
 *             _assertValidNode(root)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_context_node), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1827
 *         if self._context_node is not None:
 *             root = self._context_node.__copy__()
 *             assert root is not None             # <<<<<<<<<<<<<<
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = (((PyObject *)__pyx_v_root) != Py_None);
      if (unlikely(!(__pyx_t_2 != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    #endif

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1828
 *             root = self._context_node.__copy__()
 *             assert root is not None
 *             _assertValidNode(root)             # <<<<<<<<<<<<<<
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             doc = root._doc
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1829
 *             assert root is not None
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)             # <<<<<<<<<<<<<<
 *             doc = root._doc
 *             c_doc = self._context_node._doc._c_doc
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__copyNonElementSiblings(__pyx_v_self->_context_node->_c_node, __pyx_v_root->_c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1830
 *             _assertValidNode(root)
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             doc = root._doc             # <<<<<<<<<<<<<<
 *             c_doc = self._context_node._doc._c_doc
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_root->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1831
 *             _copyNonElementSiblings(self._context_node._c_node, root._c_node)
 *             doc = root._doc
 *             c_doc = self._context_node._doc._c_doc             # <<<<<<<<<<<<<<
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 *                 doc._c_doc.intSubset = _copyDtd(c_doc.intSubset)
 */
    __pyx_t_6 = __pyx_v_self->_context_node->_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1832
 *             doc = root._doc
 *             c_doc = self._context_node._doc._c_doc
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:             # <<<<<<<<<<<<<<
 *                 doc._c_doc.intSubset = _copyDtd(c_doc.intSubset)
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 */
    __pyx_t_2 = ((__pyx_v_c_doc->intSubset != NULL) != 0);
    if (__pyx_t_2) {
      __pyx_t_1 = ((__pyx_v_doc->_c_doc->intSubset == NULL) != 0);
      __pyx_t_7 = __pyx_t_1;
    } else {
      __pyx_t_7 = __pyx_t_2;
    }
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1833
 *             c_doc = self._context_node._doc._c_doc
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 *                 doc._c_doc.intSubset = _copyDtd(c_doc.intSubset)             # <<<<<<<<<<<<<<
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 *                 doc._c_doc.extSubset = _copyDtd(c_doc.extSubset)
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__copyDtd(__pyx_v_c_doc->intSubset); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_doc->_c_doc->intSubset = __pyx_t_8;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1834
 *             if c_doc.intSubset is not NULL and doc._c_doc.intSubset is NULL:
 *                 doc._c_doc.intSubset = _copyDtd(c_doc.intSubset)
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:             # <<<<<<<<<<<<<<
 *                 doc._c_doc.extSubset = _copyDtd(c_doc.extSubset)
 *             return _elementTreeFactory(None, root)
 */
    __pyx_t_7 = ((__pyx_v_c_doc->extSubset != NULL) != 0);
    if (__pyx_t_7) {
      __pyx_t_2 = ((__pyx_v_doc->_c_doc->extSubset != NULL) != 0);
      __pyx_t_1 = __pyx_t_2;
    } else {
      __pyx_t_1 = __pyx_t_7;
    }
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1835
 *                 doc._c_doc.intSubset = _copyDtd(c_doc.intSubset)
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 *                 doc._c_doc.extSubset = _copyDtd(c_doc.extSubset)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__copyDtd(__pyx_v_c_doc->extSubset); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_doc->_c_doc->extSubset = __pyx_t_8;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1836
 *             if c_doc.extSubset is not NULL and not doc._c_doc.extSubset is NULL:
 *                 doc._c_doc.extSubset = _copyDtd(c_doc.extSubset)
 *             return _elementTreeFactory(None, root)             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)Py_None), __pyx_v_root)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1837
 *                 doc._c_doc.extSubset = _copyDtd(c_doc.extSubset)
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  __pyx_t_7 = (__pyx_t_1 != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1838
 *             return _elementTreeFactory(None, root)
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1839
 *         elif self._doc is not None:
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             if c_doc is NULL:
 *                 raise MemoryError()
 */
    __pyx_v_c_doc = xmlCopyDoc(__pyx_v_self->_doc->_c_doc, 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1840
 *             _assertValidDoc(self._doc)
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)
 */
    __pyx_t_7 = ((__pyx_v_c_doc == NULL) != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1841
 *             c_doc = tree.xmlCopyDoc(self._doc._c_doc, 1)
 *             if c_doc is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             doc = _documentFactory(c_doc, self._doc._parser)
 *             return _elementTreeFactory(doc, None)
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1842
 *             if c_doc is NULL:
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(doc, None)
 *         else:
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc->_parser);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_4))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1843
 *                 raise MemoryError()
 *             doc = _documentFactory(c_doc, self._doc._parser)
 *             return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 *         else:
 *             # so what ...
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1846
 *         else:
 *             # so what ...
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1821
 *         return _elementTreeFactory(self._doc, self._context_node)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef _Document doc
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1855
 *         not for trees that were built manually.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertHasRoot()
 *             return DocInfo(self._context_node._doc)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7docinfo_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_7docinfo_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(((struct LxmlElementTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_7docinfo___get__(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1856
 *         """
 *         def __get__(self):
 *             self._assertHasRoot()             # <<<<<<<<<<<<<<
 *             return DocInfo(self._context_node._doc)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1857
 *         def __get__(self):
 *             self._assertHasRoot()
 *             return DocInfo(self._context_node._doc)             # <<<<<<<<<<<<<<
 * 
 *     # not in ElementTree, read-only
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_context_node->_doc));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->_context_node->_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_context_node->_doc));
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_DocInfo)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __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;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1855
 *         not for trees that were built manually.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertHasRoot()
 *             return DocInfo(self._context_node._doc)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTree.docinfo.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1863
 *         u"""The parser that was used to parse the document in this ElementTree.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_6parser_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_6parser_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(((struct LxmlElementTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_6parser___get__(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1864
 *         """
 *         def __get__(self):
 *             if self._context_node is not None and \             # <<<<<<<<<<<<<<
 *                    self._context_node._doc is not None:
 *                 return self._context_node._doc._parser
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  if ((__pyx_t_1 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1865
 *         def __get__(self):
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:             # <<<<<<<<<<<<<<
 *                 return self._context_node._doc._parser
 *             if self._doc is not None:
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node->_doc) != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1866
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:
 *                 return self._context_node._doc._parser             # <<<<<<<<<<<<<<
 *             if self._doc is not None:
 *                 return self._doc._parser
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->_context_node->_doc->_parser));
    __pyx_r = ((PyObject *)__pyx_v_self->_context_node->_doc->_parser);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1867
 *                    self._context_node._doc is not None:
 *                 return self._context_node._doc._parser
 *             if self._doc is not None:             # <<<<<<<<<<<<<<
 *                 return self._doc._parser
 *             return None
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1868
 *                 return self._context_node._doc._parser
 *             if self._doc is not None:
 *                 return self._doc._parser             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->_doc->_parser));
    __pyx_r = ((PyObject *)__pyx_v_self->_doc->_parser);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1869
 *             if self._doc is not None:
 *                 return self._doc._parser
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1863
 *         u"""The parser that was used to parse the document in this ElementTree.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._context_node is not None and \
 *                    self._context_node._doc is not None:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1871
 *             return None
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_11write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_10write[] = "write(self, file, encoding=None, method=\"xml\",\n                  pretty_print=False, xml_declaration=None, with_tail=True,\n                  standalone=None, compression=0,\n                  exclusive=False, with_comments=True, inclusive_ns_prefixes=None)\n\n        Write the tree to a filename, file or file-like object.\n\n        Defaults to ASCII encoding and writing a declaration as needed.\n\n        The keyword argument 'method' selects the output method:\n        'xml', 'html', 'text' or 'c14n'.  Default is 'xml'.\n\n        The ``exclusive`` and ``with_comments`` arguments are only\n        used with C14N output, where they request exclusive and\n        uncommented C14N serialisation respectively.\n\n        Passing a boolean value to the ``standalone`` option will\n        output an XML declaration with the corresponding\n        ``standalone`` flag.\n\n        The ``compression`` option enables GZip compression level 1-9.\n\n        The ``inclusive_ns_prefixes`` should be a list of namespace strings\n        (i.e. ['xs', 'xsi']) that will be promoted to the top-level element\n        during exclusive C14N serialisation.  This parameter is ignored if\n        exclusive mode=False.\n\n        If exclusive=True and no list is provided, a namespace will only be\n        rendered if it is used by the immediate parent or one of its attributes\n        and its prefix and values have not already been rendered by an ancestor\n        of the namespace node's parent element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_11write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_pretty_print = 0;
  PyObject *__pyx_v_xml_declaration = 0;
  PyObject *__pyx_v_with_tail = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_docstring = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_exclusive = 0;
  PyObject *__pyx_v_with_comments = 0;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,&__pyx_n_s_encoding,&__pyx_n_s_method,&__pyx_n_s_pretty_print,&__pyx_n_s_xml_declaration,&__pyx_n_s_with_tail,&__pyx_n_s_standalone,&__pyx_n_s_docstring,&__pyx_n_s_compression,&__pyx_n_s_exclusive,&__pyx_n_s_with_comments,&__pyx_n_s_inclusive_ns_prefixes,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_n_u_xml);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1872
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,             # <<<<<<<<<<<<<<
 *               standalone=None, docstring=None, compression=0,
 *               exclusive=False, with_comments=True, inclusive_ns_prefixes=None):
 */
    values[3] = ((PyObject *)Py_False);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1873
 *     def write(self, file, *, encoding=None, method=u"xml",
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,             # <<<<<<<<<<<<<<
 *               exclusive=False, with_comments=True, inclusive_ns_prefixes=None):
 *         u"""write(self, file, encoding=None, method="xml",
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)__pyx_int_0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1874
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 *               exclusive=False, with_comments=True, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *         u"""write(self, file, encoding=None, method="xml",
 *                   pretty_print=False, xml_declaration=None, with_tail=True,
 */
    values[9] = ((PyObject *)Py_False);
    values[10] = ((PyObject *)Py_True);
    values[11] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 11)) {
        Py_ssize_t index;
        for (index = 1; index < 12 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_file = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    __pyx_v_pretty_print = values[3];
    __pyx_v_xml_declaration = values[4];
    __pyx_v_with_tail = values[5];
    __pyx_v_standalone = values[6];
    __pyx_v_docstring = values[7];
    __pyx_v_compression = values[8];
    __pyx_v_exclusive = values[9];
    __pyx_v_with_comments = values[10];
    __pyx_v_inclusive_ns_prefixes = values[11];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_10write(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_file, __pyx_v_encoding, __pyx_v_method, __pyx_v_pretty_print, __pyx_v_xml_declaration, __pyx_v_with_tail, __pyx_v_standalone, __pyx_v_docstring, __pyx_v_compression, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_inclusive_ns_prefixes);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1871
 *             return None
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 */

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_10write(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, PyObject *__pyx_v_pretty_print, PyObject *__pyx_v_xml_declaration, PyObject *__pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_docstring, PyObject *__pyx_v_compression, PyObject *__pyx_v_exclusive, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_inclusive_ns_prefixes) {
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_compression);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1910
 *         cdef int is_standalone
 * 
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1911
 * 
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)             # <<<<<<<<<<<<<<
 *         if compression is None or compression < 0:
 *             compression = 0
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1912
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
 */
  __pyx_t_3 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_3) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1913
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 *             compression = 0             # <<<<<<<<<<<<<<
 * 
 *         # C14N serialisation
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_compression, __pyx_int_0);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1916
 * 
 *         # C14N serialisation
 *         if method == 'c14n':             # <<<<<<<<<<<<<<
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 */
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_c14n, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1917
 *         # C14N serialisation
 *         if method == 'c14n':
 *             if encoding is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 */
    __pyx_t_5 = (__pyx_v_encoding != Py_None);
    __pyx_t_3 = (__pyx_t_5 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1918
 *         if method == 'c14n':
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, 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);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1919
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1920
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 * 
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1922
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                             compression, inclusive_ns_prefixes)
 *             return
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_exclusive); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1923
 * 
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                             compression, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *             return
 *         if not with_comments:
 */
    __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1922
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 * 
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                             compression, inclusive_ns_prefixes)
 *             return
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_2), __pyx_t_3, __pyx_t_5, __pyx_t_1, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1922; __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;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1924
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                             compression, inclusive_ns_prefixes)
 *             return             # <<<<<<<<<<<<<<
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1925
 *                             compression, inclusive_ns_prefixes)
 *             return
 *         if not with_comments:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((!__pyx_t_5) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1926
 *             return
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1928
 *             raise ValueError("Can only discard comments in C14N serialisation")
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:             # <<<<<<<<<<<<<<
 *             write_declaration = xml_declaration
 *             if encoding is None:
 */
  __pyx_t_3 = (__pyx_v_xml_declaration != Py_None);
  __pyx_t_5 = (__pyx_t_3 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1929
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *             if encoding is None:
 *                 encoding = u'ASCII'
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_write_declaration = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1930
 *         if xml_declaration is not None:
 *             write_declaration = xml_declaration
 *             if encoding is None:             # <<<<<<<<<<<<<<
 *                 encoding = u'ASCII'
 *             else:
 */
    __pyx_t_5 = (__pyx_v_encoding == Py_None);
    __pyx_t_3 = (__pyx_t_5 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1931
 *             write_declaration = xml_declaration
 *             if encoding is None:
 *                 encoding = u'ASCII'             # <<<<<<<<<<<<<<
 *             else:
 *                 encoding = encoding.upper()
 */
      __Pyx_INCREF(__pyx_n_u_ASCII);
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_u_ASCII);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1933
 *                 encoding = u'ASCII'
 *             else:
 *                 encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *         elif encoding is None:
 *             encoding = u'ASCII'
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1934
 *             else:
 *                 encoding = encoding.upper()
 *         elif encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = u'ASCII'
 *             write_declaration = 0
 */
  __pyx_t_3 = (__pyx_v_encoding == Py_None);
  __pyx_t_5 = (__pyx_t_3 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1935
 *                 encoding = encoding.upper()
 *         elif encoding is None:
 *             encoding = u'ASCII'             # <<<<<<<<<<<<<<
 *             write_declaration = 0
 *         else:
 */
    __Pyx_INCREF(__pyx_n_u_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_u_ASCII);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1936
 *         elif encoding is None:
 *             encoding = u'ASCII'
 *             write_declaration = 0             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = encoding.upper()
 */
    __pyx_v_write_declaration = 0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1938
 *             write_declaration = 0
 *         else:
 *             encoding = encoding.upper()             # <<<<<<<<<<<<<<
 *             write_declaration = encoding not in \
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1939
 *         else:
 *             encoding = encoding.upper()
 *             write_declaration = encoding not in \             # <<<<<<<<<<<<<<
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 *         if standalone is None:
 */
    __Pyx_INCREF(__pyx_v_encoding);
    __pyx_t_6 = __pyx_v_encoding;
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u_US_ASCII, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {
      __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_n_u_ASCII, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_5;
    }
    if (__pyx_t_4) {
      __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_n_u_UTF8, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = __pyx_t_5;
    } else {
      __pyx_t_3 = __pyx_t_4;
    }
    if (__pyx_t_3) {
      __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u_UTF_8, Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_write_declaration = __pyx_t_5;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1941
 *             write_declaration = encoding not in \
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             is_standalone = -1
 *         elif standalone:
 */
  __pyx_t_5 = (__pyx_v_standalone == Py_None);
  __pyx_t_3 = (__pyx_t_5 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1942
 *                                   (u'US-ASCII', u'ASCII', u'UTF8', u'UTF-8')
 *         if standalone is None:
 *             is_standalone = -1             # <<<<<<<<<<<<<<
 *         elif standalone:
 *             write_declaration = 1
 */
    __pyx_v_is_standalone = -1;
    goto __pyx_L10;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1943
 *         if standalone is None:
 *             is_standalone = -1
 *         elif standalone:             # <<<<<<<<<<<<<<
 *             write_declaration = 1
 *             is_standalone = 1
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1944
 *             is_standalone = -1
 *         elif standalone:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 1
 *         else:
 */
    __pyx_v_write_declaration = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1945
 *         elif standalone:
 *             write_declaration = 1
 *             is_standalone = 1             # <<<<<<<<<<<<<<
 *         else:
 *             write_declaration = 1
 */
    __pyx_v_is_standalone = 1;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1947
 *             is_standalone = 1
 *         else:
 *             write_declaration = 1             # <<<<<<<<<<<<<<
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 */
    __pyx_v_write_declaration = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1948
 *         else:
 *             write_declaration = 1
 *             is_standalone = 0             # <<<<<<<<<<<<<<
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 *                     write_declaration, 1, pretty_print, with_tail,
 */
    __pyx_v_is_standalone = 0;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1949
 *             write_declaration = 1
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
 */
  __pyx_t_6 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1950
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 *                     write_declaration, 1, pretty_print, with_tail,             # <<<<<<<<<<<<<<
 *                     is_standalone, compression)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_pretty_print); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_with_tail); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1951
 *         _tofilelike(file, self._context_node, encoding, docstring, method,
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)             # <<<<<<<<<<<<<<
 * 
 *     def getpath(self, _Element element not None):
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1949
 *             write_declaration = 1
 *             is_standalone = 0
 *         _tofilelike(file, self._context_node, encoding, docstring, method,             # <<<<<<<<<<<<<<
 *                     write_declaration, 1, pretty_print, with_tail,
 *                     is_standalone, compression)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__tofilelike(__pyx_v_file, ((struct LxmlElement *)__pyx_t_6), __pyx_v_encoding, __pyx_v_docstring, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_t_3, __pyx_t_5, __pyx_v_is_standalone, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1871
 *             return None
 * 
 *     def write(self, file, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *               pretty_print=False, xml_declaration=None, with_tail=True,
 *               standalone=None, docstring=None, compression=0,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1953
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""getpath(self, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_13getpath(PyObject *__pyx_v_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_12getpath[] = "getpath(self, element)\n\n        Returns a structural, absolute XPath expression to find that element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_13getpath(PyObject *__pyx_v_self, PyObject *__pyx_v_element) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getpath (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_12getpath(((struct LxmlElementTree *)__pyx_v_self), ((struct LxmlElement *)__pyx_v_element));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_12getpath(struct LxmlElementTree *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlChar *__pyx_v_c_path;
  PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getpath", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1961
 *         cdef _Element root
 *         cdef xmlDoc* c_doc
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if self._context_node is not None:
 *             root = self._context_node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1962
 *         cdef xmlDoc* c_doc
 *         _assertValidNode(element)
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             root = self._context_node
 *             doc = root._doc
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_context_node) != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1963
 *         _assertValidNode(element)
 *         if self._context_node is not None:
 *             root = self._context_node             # <<<<<<<<<<<<<<
 *             doc = root._doc
 *         elif self._doc is not None:
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_context_node);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1964
 *         if self._context_node is not None:
 *             root = self._context_node
 *             doc = root._doc             # <<<<<<<<<<<<<<
 *         elif self._doc is not None:
 *             doc = self._doc
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_root->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1965
 *             root = self._context_node
 *             doc = root._doc
 *         elif self._doc is not None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             root = doc.getroot()
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1966
 *             doc = root._doc
 *         elif self._doc is not None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             root = doc.getroot()
 *         else:
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1967
 *         elif self._doc is not None:
 *             doc = self._doc
 *             root = doc.getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, u"Element is not in this tree."
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1969
 *             root = doc.getroot()
 *         else:
 *             raise ValueError, u"Element is not in this tree."             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1970
 *         else:
 *             raise ValueError, u"Element is not in this tree."
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         _assertValidNode(root)
 *         if element._doc is not doc:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1971
 *             raise ValueError, u"Element is not in this tree."
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)             # <<<<<<<<<<<<<<
 *         if element._doc is not doc:
 *             raise ValueError, u"Element is not in this tree."
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_root); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1972
 *         _assertValidDoc(doc)
 *         _assertValidNode(root)
 *         if element._doc is not doc:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Element is not in this tree."
 * 
 */
  __pyx_t_2 = (__pyx_v_element->_doc != __pyx_v_doc);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1973
 *         _assertValidNode(root)
 *         if element._doc is not doc:
 *             raise ValueError, u"Element is not in this tree."             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Element_is_not_in_this_tree, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1975
 *             raise ValueError, u"Element is not in this tree."
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)             # <<<<<<<<<<<<<<
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root->_c_node); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1976
 * 
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 *         c_path = tree.xmlGetNodePath(element._c_node)             # <<<<<<<<<<<<<<
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
 */
  __pyx_v_c_path = xmlGetNodePath(__pyx_v_element->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1977
 *         c_doc = _fakeRootDoc(doc._c_doc, root._c_node)
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_path is NULL:
 *             raise MemoryError()
 */
  __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1978
 *         c_path = tree.xmlGetNodePath(element._c_node)
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         path = funicode(c_path)
 */
  __pyx_t_3 = ((__pyx_v_c_path == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1979
 *         _destroyFakeDoc(doc._c_doc, c_doc)
 *         if c_path is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1980
 *         if c_path is NULL:
 *             raise MemoryError()
 *         path = funicode(c_path)             # <<<<<<<<<<<<<<
 *         tree.xmlFree(c_path)
 *         return path
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_path); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_path = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1981
 *             raise MemoryError()
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)             # <<<<<<<<<<<<<<
 *         return path
 * 
 */
  xmlFree(__pyx_v_c_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1982
 *         path = funicode(c_path)
 *         tree.xmlFree(c_path)
 *         return path             # <<<<<<<<<<<<<<
 * 
 *     def getiterator(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_path);
  __pyx_r = __pyx_v_path;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1953
 *                     is_standalone, compression)
 * 
 *     def getpath(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         u"""getpath(self, element)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1984
 *         return path
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""getiterator(self, *tags, tag=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_15getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_14getiterator[] = "getiterator(self, *tags, tag=None)\n\n        Returns a sequence or iterator of all elements in document order\n        (depth first pre-order), starting with the root element.\n\n        Can be restricted to find only elements with a specific tag,\n        see `_Element.iter`.\n\n        :deprecated: Note that this method is deprecated as of\n          ElementTree 1.3 and lxml 2.0.  It returns an iterator in\n          lxml, which diverges from the original ElementTree\n          behaviour.  If you want an efficient iterator, use the\n          ``tree.iter()`` method instead.  You should only use this\n          method in new code if you require backwards compatibility\n          with older versions of lxml or ElementTree.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_15getiterator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getiterator (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "getiterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_14getiterator(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_14getiterator(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getiterator", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2001
 *           with older versions of lxml or ElementTree.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ITER_EMPTY
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2002
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_3 = (__pyx_v_root == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2003
 *         root = self.getroot()
 *         if root is None:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2004
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.getiterator(*tags)
 */
  __pyx_t_4 = (__pyx_v_tag != Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2005
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return root.getiterator(*tags)
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2006
 *         if tag is not None:
 *             tags += (tag,)
 *         return root.getiterator(*tags)             # <<<<<<<<<<<<<<
 * 
 *     def iter(self, tag=None, *tags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_getiterator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_Tuple(__pyx_v_tags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1984
 *         return path
 * 
 *     def getiterator(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""getiterator(self, *tags, tag=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.getiterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2008
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iter(self, tag=None, *tags)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_17iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_16iter[] = "iter(self, tag=None, *tags)\n\n        Creates an iterator for the root element.  The iterator loops over\n        all elements in this tree, in document order.\n\n        Can be restricted to find only elements with a specific tag,\n        see `_Element.iter`.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_17iter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iter (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tags = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tags)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tags);
  } else {
    __pyx_v_tags = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "iter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
    }
    __pyx_v_tag = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tags); __pyx_v_tags = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_16iter(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_tag, __pyx_v_tags);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_16iter(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_tags) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iter", 0);
  __Pyx_INCREF(__pyx_v_tags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2017
 *         see `_Element.iter`.
 *         """
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if root is None:
 *             return ITER_EMPTY
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_root = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2018
 *         """
 *         root = self.getroot()
 *         if root is None:             # <<<<<<<<<<<<<<
 *             return ITER_EMPTY
 *         if tag is not None:
 */
  __pyx_t_3 = (__pyx_v_root == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2019
 *         root = self.getroot()
 *         if root is None:
 *             return ITER_EMPTY             # <<<<<<<<<<<<<<
 *         if tag is not None:
 *             tags += (tag,)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2020
 *         if root is None:
 *             return ITER_EMPTY
 *         if tag is not None:             # <<<<<<<<<<<<<<
 *             tags += (tag,)
 *         return root.iter(*tags)
 */
  __pyx_t_4 = (__pyx_v_tag != Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2021
 *             return ITER_EMPTY
 *         if tag is not None:
 *             tags += (tag,)             # <<<<<<<<<<<<<<
 *         return root.iter(*tags)
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_tags, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2022
 *         if tag is not None:
 *             tags += (tag,)
 *         return root.iter(*tags)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_iter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_Tuple(__pyx_v_tags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2008
 *         return root.getiterator(*tags)
 * 
 *     def iter(self, tag=None, *tags):             # <<<<<<<<<<<<<<
 *         u"""iter(self, tag=None, *tags)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tags);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2024
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""find(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_19find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_18find[] = "find(self, path, namespaces=None)\n\n        Finds the first toplevel element with given tag.  Same as\n        ``tree.getroot().find(path)``.\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_19find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_18find(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_18find(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2034
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2035
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, 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_2); __pyx_t_2 = 0;
  __pyx_v_root = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2036
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_4 = (_isString(__pyx_v_path) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2037
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.find(path, namespaces)
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__29, 0, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s__30, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2038
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *         return root.find(path, namespaces)
 * 
 */
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s__4, __pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2039
 *             if path[:1] == "/":
 *                 path = "." + path
 *         return root.find(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findtext(self, path, default=None, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_find); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2024
 *         return root.iter(*tags)
 * 
 *     def find(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""find(self, path, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2041
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findtext(self, path, default=None, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_21findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_20findtext[] = "findtext(self, path, default=None, namespaces=None)\n\n        Finds the text for the first element matching the ElementPath\n        expression.  Same as getroot().findtext(path)\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_21findtext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findtext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_default,&__pyx_n_s_namespaces,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findtext") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_default = values[1];
    __pyx_v_namespaces = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findtext", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_20findtext(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_default, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_20findtext(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findtext", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2051
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2052
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_root = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2053
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_4 = (_isString(__pyx_v_path) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2054
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.findtext(path, default, namespaces)
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__31, 0, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s__30, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2055
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *         return root.findtext(path, default, namespaces)
 * 
 */
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s__4, __pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2056
 *             if path[:1] == "/":
 *                 path = "." + path
 *         return root.findtext(path, default, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def findall(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_findtext); 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_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_default);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_default);
  __Pyx_GIVEREF(__pyx_v_default);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2041
 *         return root.find(path, namespaces)
 * 
 *     def findtext(self, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findtext(self, path, default=None, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2058
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findall(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_23findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_22findall[] = "findall(self, path, namespaces=None)\n\n        Finds all elements matching the ElementPath expression.  Same as\n        getroot().findall(path).\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_23findall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findall") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_22findall(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_22findall(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findall", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2068
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2069
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_root = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2070
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_4 = (_isString(__pyx_v_path) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2071
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.findall(path, namespaces)
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__32, 0, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s__30, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2072
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *         return root.findall(path, namespaces)
 * 
 */
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s__4, __pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2073
 *             if path[:1] == "/":
 *                 path = "." + path
 *         return root.findall(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def iterfind(self, path, namespaces=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_findall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2058
 *         return root.findtext(path, default, namespaces)
 * 
 *     def findall(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""findall(self, path, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2075
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""iterfind(self, path, namespaces=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_25iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_24iterfind[] = "iterfind(self, path, namespaces=None)\n\n        Iterates over all elements matching the ElementPath expression.\n        Same as getroot().iterfind(path).\n\n        The optional ``namespaces`` argument accepts a\n        prefix-to-namespace mapping that allows the usage of XPath\n        prefixes in the path expression.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_25iterfind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterfind (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterfind") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterfind", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_24iterfind(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_24iterfind(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterfind", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2085
 *         prefixes in the path expression.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         root = self.getroot()
 *         if _isString(path):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2086
 *         """
 *         self._assertHasRoot()
 *         root = self.getroot()             # <<<<<<<<<<<<<<
 *         if _isString(path):
 *             if path[:1] == "/":
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getroot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_root = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2087
 *         self._assertHasRoot()
 *         root = self.getroot()
 *         if _isString(path):             # <<<<<<<<<<<<<<
 *             if path[:1] == "/":
 *                 path = "." + path
 */
  __pyx_t_4 = (_isString(__pyx_v_path) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2088
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.iterfind(path, namespaces)
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__33, 0, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s__30, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2089
 *         if _isString(path):
 *             if path[:1] == "/":
 *                 path = "." + path             # <<<<<<<<<<<<<<
 *         return root.iterfind(path, namespaces)
 * 
 */
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s__4, __pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2090
 *             if path[:1] == "/":
 *                 path = "." + path
 *         return root.iterfind(path, namespaces)             # <<<<<<<<<<<<<<
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_root, __pyx_n_s_iterfind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2075
 *         return root.findall(path, namespaces)
 * 
 *     def iterfind(self, path, namespaces=None):             # <<<<<<<<<<<<<<
 *         u"""iterfind(self, path, namespaces=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ElementTree.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2092
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_27xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_26xpath[] = "xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)\n\n        XPath evaluate in context of document.\n\n        ``namespaces`` is an optional dictionary with prefix to namespace URI\n        mappings, used by XPath.  ``extensions`` defines additional extension\n        functions.\n        \n        Returns a list (nodeset), or bool, float or string.\n\n        In case of a list result, return Element for element nodes,\n        string for text and attribute values.\n\n        Note: if you are going to apply multiple XPath expressions\n        against the same document, it is more efficient to use\n        XPathEvaluator directly.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_27xpath(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_smart_strings = 0;
  PyObject *__pyx_v__variables = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xpath (wrapper)", 0);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_smart_strings,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2093
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,
 *               smart_strings=True, **_variables):             # <<<<<<<<<<<<<<
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 * 
 */
    values[3] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && (kw_args <= 3)) {
        Py_ssize_t index;
        for (index = 1; index < 4 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, pos_args, "xpath") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xpath", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_26xpath(((struct LxmlElementTree *)__pyx_v_self), __pyx_v__path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_smart_strings, __pyx_v__variables);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2092
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_26xpath(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_smart_strings, PyObject *__pyx_v__variables) {
  struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_evaluator = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xpath", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2111
 *         XPathEvaluator directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2112
 *         """
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2113
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,             # <<<<<<<<<<<<<<
 *                                            smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2114
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *         return evaluator(_path, **_variables)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2112
 *         """
 *         self._assertHasRoot()
 *         evaluator = XPathDocumentEvaluator(self, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_evaluator = ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2115
 *                                            extensions=extensions,
 *                                            smart_strings=smart_strings)
 *         return evaluator(_path, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v__path);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__path);
  __Pyx_GIVEREF(__pyx_v__path);
  __pyx_t_3 = __pyx_v__variables;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_evaluator), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2092
 *         return root.iterfind(path, namespaces)
 * 
 *     def xpath(self, _path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *               smart_strings=True, **_variables):
 *         u"""xpath(self, _path, namespaces=None, extensions=None, smart_strings=True, **_variables)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_evaluator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2117
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         u"""xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_29xslt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_28xslt[] = "xslt(self, _xslt, extensions=None, access_control=None, **_kw)\n\n        Transform this document using other document.\n\n        xslt is a tree that should be XSLT\n        keyword parameters are XSLT transformation parameters.\n\n        Returns the transformed tree.\n\n        Note: if you are going to apply the same XSLT stylesheet against\n        multiple documents, it is more efficient to use the XSLT\n        class directly.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_29xslt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__xslt = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_access_control = 0;
  PyObject *__pyx_v__kw = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xslt (wrapper)", 0);
  __pyx_v__kw = PyDict_New(); if (unlikely(!__pyx_v__kw)) return NULL;
  __Pyx_GOTREF(__pyx_v__kw);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xslt_2,&__pyx_n_s_extensions,&__pyx_n_s_access_control,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xslt_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_extensions);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_access_control);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__kw, values, pos_args, "xslt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v__xslt = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_access_control = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xslt", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__kw); __pyx_v__kw = 0;
  __Pyx_AddTraceback("lxml.etree._ElementTree.xslt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_28xslt(((struct LxmlElementTree *)__pyx_v_self), __pyx_v__xslt, __pyx_v_extensions, __pyx_v_access_control, __pyx_v__kw);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_28xslt(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v__xslt, PyObject *__pyx_v_extensions, PyObject *__pyx_v_access_control, PyObject *__pyx_v__kw) {
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_style = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xslt", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2131
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2132
 *         """
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,             # <<<<<<<<<<<<<<
 *                      access_control=access_control)
 *         return style(self, **_kw)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v__xslt);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__xslt);
  __Pyx_GIVEREF(__pyx_v__xslt);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2133
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)             # <<<<<<<<<<<<<<
 *         return style(self, **_kw)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_access_control, __pyx_v_access_control) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2132
 *         """
 *         self._assertHasRoot()
 *         style = XSLT(_xslt, extensions=extensions,             # <<<<<<<<<<<<<<
 *                      access_control=access_control)
 *         return style(self, **_kw)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLT)), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_style = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2134
 *         style = XSLT(_xslt, extensions=extensions,
 *                      access_control=access_control)
 *         return style(self, **_kw)             # <<<<<<<<<<<<<<
 * 
 *     def relaxng(self, relaxng):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_3 = __pyx_v__kw;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_style), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2117
 *         return evaluator(_path, **_variables)
 * 
 *     def xslt(self, _xslt, extensions=None, access_control=None, **_kw):             # <<<<<<<<<<<<<<
 *         u"""xslt(self, _xslt, extensions=None, access_control=None, **_kw)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xslt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_style);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2136
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         u"""relaxng(self, relaxng)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_31relaxng(PyObject *__pyx_v_self, PyObject *__pyx_v_relaxng); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_30relaxng[] = "relaxng(self, relaxng)\n\n        Validate this document using other document.\n\n        The relaxng argument is a tree that should contain a Relax NG schema.\n\n        Returns True or False, depending on whether validation\n        succeeded.\n\n        Note: if you are going to apply the same Relax NG schema against\n        multiple documents, it is more efficient to use the RelaxNG\n        class directly.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_31relaxng(PyObject *__pyx_v_self, PyObject *__pyx_v_relaxng) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("relaxng (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_30relaxng(((struct LxmlElementTree *)__pyx_v_self), ((PyObject *)__pyx_v_relaxng));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_30relaxng(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_relaxng) {
  struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_schema = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("relaxng", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2150
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         schema = RelaxNG(relaxng)
 *         return schema.validate(self)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2151
 *         """
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_relaxng);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_relaxng);
  __Pyx_GIVEREF(__pyx_v_relaxng);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_RelaxNG)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2152
 *         self._assertHasRoot()
 *         schema = RelaxNG(relaxng)
 *         return schema.validate(self)             # <<<<<<<<<<<<<<
 * 
 *     def xmlschema(self, xmlschema):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_schema), __pyx_n_s_validate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __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 = 2152; __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_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __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_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2136
 *         return style(self, **_kw)
 * 
 *     def relaxng(self, relaxng):             # <<<<<<<<<<<<<<
 *         u"""relaxng(self, relaxng)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.relaxng", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_schema);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2154
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         u"""xmlschema(self, xmlschema)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_33xmlschema(PyObject *__pyx_v_self, PyObject *__pyx_v_xmlschema); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_32xmlschema[] = "xmlschema(self, xmlschema)\n\n        Validate this document using other document.\n\n        The xmlschema argument is a tree that should contain an XML Schema.\n\n        Returns True or False, depending on whether validation\n        succeeded.\n\n        Note: If you are going to apply the same XML Schema against\n        multiple documents, it is more efficient to use the XMLSchema\n        class directly.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_33xmlschema(PyObject *__pyx_v_self, PyObject *__pyx_v_xmlschema) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xmlschema (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_32xmlschema(((struct LxmlElementTree *)__pyx_v_self), ((PyObject *)__pyx_v_xmlschema));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_32xmlschema(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_xmlschema) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xmlschema", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2168
 *         class directly.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         schema = XMLSchema(xmlschema)
 *         return schema.validate(self)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2169
 *         """
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)             # <<<<<<<<<<<<<<
 *         return schema.validate(self)
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_xmlschema);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xmlschema);
  __Pyx_GIVEREF(__pyx_v_xmlschema);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLSchema)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2170
 *         self._assertHasRoot()
 *         schema = XMLSchema(xmlschema)
 *         return schema.validate(self)             # <<<<<<<<<<<<<<
 * 
 *     def xinclude(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_schema), __pyx_n_s_validate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2170; __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 = 2170; __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_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2170; __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_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2154
 *         return schema.validate(self)
 * 
 *     def xmlschema(self, xmlschema):             # <<<<<<<<<<<<<<
 *         u"""xmlschema(self, xmlschema)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xmlschema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_schema);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2172
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         u"""xinclude(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_35xinclude(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_34xinclude[] = "xinclude(self)\n\n        Process the XInclude nodes in this document and include the\n        referenced XML fragments.\n\n        There is support for loading files through the file system, HTTP and\n        FTP.\n\n        Note that XInclude does not support custom resolvers in Python space\n        due to restrictions of libxml2 <= 2.6.29.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_35xinclude(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xinclude (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_34xinclude(((struct LxmlElementTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_34xinclude(struct LxmlElementTree *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xinclude", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2184
 *         due to restrictions of libxml2 <= 2.6.29.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         XInclude()(self._context_node)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2185
 *         """
 *         self._assertHasRoot()
 *         XInclude()(self._context_node)             # <<<<<<<<<<<<<<
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XInclude)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __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 = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_context_node));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->_context_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_context_node));
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2172
 *         return schema.validate(self)
 * 
 *     def xinclude(self):             # <<<<<<<<<<<<<<
 *         u"""xinclude(self)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ElementTree.xinclude", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2187
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         u"""write_c14n(self, file, exclusive=False, with_comments=True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_37write_c14n(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_12_ElementTree_36write_c14n[] = "write_c14n(self, file, exclusive=False, with_comments=True,\n                       compression=0, inclusive_ns_prefixes=None)\n\n        C14N write of document. Always writes UTF-8.\n\n        The ``compression`` option enables GZip compression level 1-9.\n\n        The ``inclusive_ns_prefixes`` should be a list of namespace strings\n        (i.e. ['xs', 'xsi']) that will be promoted to the top-level element\n        during exclusive C14N serialisation.  This parameter is ignored if\n        exclusive mode=False.\n\n        If exclusive=True and no list is provided, a namespace will only be\n        rendered if it is used by the immediate parent or one of its attributes\n        and its prefix and values have not already been rendered by an ancestor\n        of the namespace node's parent element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_12_ElementTree_37write_c14n(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_exclusive = 0;
  PyObject *__pyx_v_with_comments = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_c14n (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,&__pyx_n_s_exclusive,&__pyx_n_s_with_comments,&__pyx_n_s_compression,&__pyx_n_s_inclusive_ns_prefixes,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_False);
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)__pyx_int_0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2188
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,
 *                    compression=0, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *         u"""write_c14n(self, file, exclusive=False, with_comments=True,
 *                        compression=0, inclusive_ns_prefixes=None)
 */
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 4)) {
        Py_ssize_t index;
        for (index = 1; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_c14n") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_file = values[0];
    __pyx_v_exclusive = values[1];
    __pyx_v_with_comments = values[2];
    __pyx_v_compression = values[3];
    __pyx_v_inclusive_ns_prefixes = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_c14n", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ElementTree_36write_c14n(((struct LxmlElementTree *)__pyx_v_self), __pyx_v_file, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_compression, __pyx_v_inclusive_ns_prefixes);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2187
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         u"""write_c14n(self, file, exclusive=False, with_comments=True,
 */

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

static PyObject *__pyx_pf_4lxml_5etree_12_ElementTree_36write_c14n(struct LxmlElementTree *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_exclusive, PyObject *__pyx_v_with_comments, PyObject *__pyx_v_compression, PyObject *__pyx_v_inclusive_ns_prefixes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_c14n", 0);
  __Pyx_INCREF(__pyx_v_compression);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2206
 *         of the namespace node's parent element.
 *         """
 *         self._assertHasRoot()             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2207
 *         """
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)             # <<<<<<<<<<<<<<
 *         if compression is None or compression < 0:
 *             compression = 0
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2208
 *         self._assertHasRoot()
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:             # <<<<<<<<<<<<<<
 *             compression = 0
 * 
 */
  __pyx_t_3 = (__pyx_v_compression == Py_None);
  if (!__pyx_t_3) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2209
 *         _assertValidNode(self._context_node)
 *         if compression is None or compression < 0:
 *             compression = 0             # <<<<<<<<<<<<<<
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_compression, __pyx_int_0);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2211
 *             compression = 0
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                         compression, inclusive_ns_prefixes)
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_context_node);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_exclusive); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_with_comments); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2212
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 *                         compression, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_compression); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2211
 *             compression = 0
 * 
 *         _tofilelikeC14N(file, self._context_node, exclusive, with_comments,             # <<<<<<<<<<<<<<
 *                         compression, inclusive_ns_prefixes)
 * 
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__tofilelikeC14N(__pyx_v_file, ((struct LxmlElement *)__pyx_t_2), __pyx_t_5, __pyx_t_3, __pyx_t_1, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2187
 *         XInclude()(self._context_node)
 * 
 *     def write_c14n(self, file, *, exclusive=False, with_comments=True,             # <<<<<<<<<<<<<<
 *                    compression=0, inclusive_ns_prefixes=None):
 *         u"""write_c14n(self, file, exclusive=False, with_comments=True,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ElementTree.write_c14n", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_compression);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2214
 *                         compression, inclusive_ns_prefixes)
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):             # <<<<<<<<<<<<<<
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 */

static struct LxmlElementTree *__pyx_f_4lxml_5etree__elementTreeFactory(struct LxmlDocument *__pyx_v_doc, struct LxmlElement *__pyx_v_context_node) {
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_elementTreeFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2215
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):
 *     return _newElementTree(doc, context_node, _ElementTree)             # <<<<<<<<<<<<<<
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_doc, __pyx_v_context_node, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2214
 *                         compression, inclusive_ns_prefixes)
 * 
 * cdef _ElementTree _elementTreeFactory(_Document doc, _Element context_node):             # <<<<<<<<<<<<<<
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._elementTreeFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2217
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,             # <<<<<<<<<<<<<<
 *                                   object baseclass):
 *     cdef _ElementTree result
 */

static struct LxmlElementTree *__pyx_f_4lxml_5etree__newElementTree(struct LxmlDocument *__pyx_v_doc, struct LxmlElement *__pyx_v_context_node, PyObject *__pyx_v_baseclass) {
  struct LxmlElementTree *__pyx_v_result = 0;
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newElementTree", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_context_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2220
 *                                   object baseclass):
 *     cdef _ElementTree result
 *     result = baseclass()             # <<<<<<<<<<<<<<
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_baseclass, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ElementTree))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_result = ((struct LxmlElementTree *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2221
 *     cdef _ElementTree result
 *     result = baseclass()
 *     if context_node is None and doc is not None:             # <<<<<<<<<<<<<<
 *         context_node = doc.getroot()
 *     if context_node is None:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_context_node) == Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = (((PyObject *)__pyx_v_doc) != Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
  } else {
    __pyx_t_4 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2222
 *     result = baseclass()
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()             # <<<<<<<<<<<<<<
 *     if context_node is None:
 *         _assertValidDoc(doc)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_context_node, ((struct LxmlElement *)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2223
 *     if context_node is None and doc is not None:
 *         context_node = doc.getroot()
 *     if context_node is None:             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         result._doc = doc
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_context_node) == Py_None);
  __pyx_t_2 = (__pyx_t_4 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2224
 *         context_node = doc.getroot()
 *     if context_node is None:
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         result._doc = doc
 *     else:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2225
 *     if context_node is None:
 *         _assertValidDoc(doc)
 *         result._doc = doc             # <<<<<<<<<<<<<<
 *     else:
 *         _assertValidNode(context_node)
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __Pyx_GOTREF(__pyx_v_result->_doc);
    __Pyx_DECREF(((PyObject *)__pyx_v_result->_doc));
    __pyx_v_result->_doc = __pyx_v_doc;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2227
 *         result._doc = doc
 *     else:
 *         _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     result._context_node = context_node
 *     return result
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2228
 *     else:
 *         _assertValidNode(context_node)
 *     result._context_node = context_node             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_context_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_context_node));
  __Pyx_GOTREF(__pyx_v_result->_context_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_context_node));
  __pyx_v_result->_context_node = __pyx_v_context_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2229
 *         _assertValidNode(context_node)
 *     result._context_node = context_node
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2217
 *     return _newElementTree(doc, context_node, _ElementTree)
 * 
 * cdef _ElementTree _newElementTree(_Document doc, _Element context_node,             # <<<<<<<<<<<<<<
 *                                   object baseclass):
 *     cdef _ElementTree result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._newElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_context_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2238
 *     """
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         self._element = element
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Attrib.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib___cinit__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_element);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7_Attrib___cinit__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, struct LxmlElement *__pyx_v_element) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2239
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         self._element = element
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2240
 *     def __cinit__(self, _Element element not None):
 *         _assertValidNode(element)
 *         self._element = element             # <<<<<<<<<<<<<<
 * 
 *     # MANIPULATORS
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(__pyx_v_self->_element);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_element));
  __pyx_v_self->_element = __pyx_v_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2238
 *     """
 *     cdef _Element _element
 *     def __cinit__(self, _Element element not None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         self._element = element
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2243
 * 
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _setAttributeValue(self._element, key, value)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_2__setitem__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2244
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         _setAttributeValue(self._element, key, value)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2245
 *     def __setitem__(self, key, value):
 *         _assertValidNode(self._element)
 *         _setAttributeValue(self._element, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2243
 * 
 *     # MANIPULATORS
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _setAttributeValue(self._element, key, value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2247
 *         _setAttributeValue(self._element, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _delAttribute(self._element, key)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_4__delitem__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_4lxml_5etree_7_Attrib_4__delitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2248
 * 
 *     def __delitem__(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         _delAttribute(self._element, key)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2249
 *     def __delitem__(self, key):
 *         _assertValidNode(self._element)
 *         _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 * 
 *     def update(self, sequence_or_dict):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__delAttribute(((struct LxmlElement *)__pyx_t_1), __pyx_v_key); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2247
 *         _setAttributeValue(self._element, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         _delAttribute(self._element, key)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2251
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_7update(PyObject *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_7update(PyObject *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_6update(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_sequence_or_dict));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_6update(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_sequence_or_dict) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_INCREF(__pyx_v_sequence_or_dict);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2252
 * 
 *     def update(self, sequence_or_dict):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2253
 *     def update(self, sequence_or_dict):
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):             # <<<<<<<<<<<<<<
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
 */
  __pyx_t_3 = PyDict_Check(__pyx_v_sequence_or_dict); 
  if (!__pyx_t_3) {
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_sequence_or_dict, ((PyObject*)__pyx_ptype_4lxml_5etree__Attrib)); 
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  __pyx_t_3 = (__pyx_t_5 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2254
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()             # <<<<<<<<<<<<<<
 *         for key, value in sequence_or_dict:
 *             _setAttributeValue(self._element, key, value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sequence_or_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_sequence_or_dict, __pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2255
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:             # <<<<<<<<<<<<<<
 *             _setAttributeValue(self._element, key, value)
 * 
 */
  if (PyList_CheckExact(__pyx_v_sequence_or_dict) || PyTuple_CheckExact(__pyx_v_sequence_or_dict)) {
    __pyx_t_6 = __pyx_v_sequence_or_dict; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_sequence_or_dict); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_8(__pyx_t_6);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_10);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2256
 *             sequence_or_dict = sequence_or_dict.items()
 *         for key, value in sequence_or_dict:
 *             _setAttributeValue(self._element, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, *default):
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __pyx_f_4lxml_5etree__setAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2251
 *         _delAttribute(self._element, key)
 * 
 *     def update(self, sequence_or_dict):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         if isinstance(sequence_or_dict, (dict, _Attrib)):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._Attrib.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_sequence_or_dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2258
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_9pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_9pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_default = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_default)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_default);
  } else {
    __pyx_v_default = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "pop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_default); __pyx_v_default = 0;
  __Pyx_AddTraceback("lxml.etree._Attrib.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_8pop(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_8pop(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pop", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2259
 * 
 *     def pop(self, key, *default):
 *         if len(default) > 1:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 *                 len(default)+1)
 */
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_default); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((__pyx_t_1 > 1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2261
 *         if len(default) > 1:
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 *                 len(default)+1)             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 */
    __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_default); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_1 + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2260
 *     def pop(self, key, *default):
 *         if len(default) > 1:
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (             # <<<<<<<<<<<<<<
 *                 len(default)+1)
 *         _assertValidNode(self._element)
 */
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_pop_expected_at_most_2_arguments, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2262
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 *                 len(default)+1)
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2263
 *                 len(default)+1)
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             if not default:
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_4), __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2264
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             if not default:
 *                 raise KeyError, key
 */
  __pyx_t_2 = (__pyx_v_result == Py_None);
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2265
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             if not default:             # <<<<<<<<<<<<<<
 *                 raise KeyError, key
 *             result = default[0]
 */
    __pyx_t_6 = (__pyx_v_default != Py_None) && (PyTuple_GET_SIZE(__pyx_v_default) != 0);
    __pyx_t_2 = ((!__pyx_t_6) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2266
 *         if result is None:
 *             if not default:
 *                 raise KeyError, key             # <<<<<<<<<<<<<<
 *             result = default[0]
 *         else:
 */
      __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2267
 *             if not default:
 *                 raise KeyError, key
 *             result = default[0]             # <<<<<<<<<<<<<<
 *         else:
 *             _delAttribute(self._element, key)
 */
    __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_default, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2267; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2269
 *             result = default[0]
 *         else:
 *             _delAttribute(self._element, key)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_element);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_f_4lxml_5etree__delAttribute(((struct LxmlElement *)__pyx_t_3), __pyx_v_key); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2270
 *         else:
 *             _delAttribute(self._element, key)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2258
 *             _setAttributeValue(self._element, key, value)
 * 
 *     def pop(self, key, *default):             # <<<<<<<<<<<<<<
 *         if len(default) > 1:
 *             raise TypeError, u"pop expected at most 2 arguments, got %d" % (
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2272
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node = self._element._c_node
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_11clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_11clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_10clear(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_10clear(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2273
 * 
 *     def clear(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node = self._element._c_node
 *         while c_node.properties is not NULL:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2274
 *     def clear(self):
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node = self._element._c_node             # <<<<<<<<<<<<<<
 *         while c_node.properties is not NULL:
 *             tree.xmlRemoveProp(c_node.properties)
 */
  __pyx_t_3 = __pyx_v_self->_element->_c_node;
  __pyx_v_c_node = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2275
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node = self._element._c_node
 *         while c_node.properties is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlRemoveProp(c_node.properties)
 * 
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_c_node->properties != NULL) != 0);
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2276
 *         cdef xmlNode* c_node = self._element._c_node
 *         while c_node.properties is not NULL:
 *             tree.xmlRemoveProp(c_node.properties)             # <<<<<<<<<<<<<<
 * 
 *     # ACCESSORS
 */
    xmlRemoveProp(__pyx_v_c_node->properties);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2272
 *         return result
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node = self._element._c_node
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2279
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_13__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_12__repr__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_12__repr__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2280
 *     # ACCESSORS
 *     def __repr__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2281
 *     def __repr__(self):
 *         _assertValidNode(self._element)
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2279
 * 
 *     # ACCESSORS
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2283
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_15__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_15__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_14__copy__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_14__copy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2284
 * 
 *     def __copy__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2285
 *     def __copy__(self):
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __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 = 2285; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2283
 *         return repr(dict( _collectAttributes(self._element._c_node, 3) ))
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2287
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_memo));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_16__deepcopy__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2288
 * 
 *     def __deepcopy__(self, memo):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2289
 *     def __deepcopy__(self, memo):
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2289; __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 = 2289; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2287
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return dict(_collectAttributes(self._element._c_node, 3))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2291
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_18__getitem__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_18__getitem__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2292
 * 
 *     def __getitem__(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2293
 *     def __getitem__(self, key):
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)             # <<<<<<<<<<<<<<
 *         if result is None:
 *             raise KeyError, key
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2294
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:             # <<<<<<<<<<<<<<
 *             raise KeyError, key
 *         return result
 */
  __pyx_t_4 = (__pyx_v_result == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2295
 *         result = _getAttributeValue(self._element, key, None)
 *         if result is None:
 *             raise KeyError, key             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_v_key, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2296
 *         if result is None:
 *             raise KeyError, key
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2291
 *         return dict(_collectAttributes(self._element._c_node, 3))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         result = _getAttributeValue(self._element, key, None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2298
 *         return result
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_21__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_21__bool__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_20__bool__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_7_Attrib_20__bool__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__bool__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2299
 * 
 *     def __bool__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2300
 *     def __bool__(self):
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_t_3 = __pyx_v_self->_element->_c_node->properties;
  __pyx_v_c_attr = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2301
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_c_attr != NULL) != 0);
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2302
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 return 1
 *             c_attr = c_attr.next
 */
    __pyx_t_4 = ((__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2303
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         return 0
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2304
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 return 1
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_3 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2305
 *                 return 1
 *             c_attr = c_attr.next
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2298
 *         return result
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2307
 *         return 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_7_Attrib_23__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4lxml_5etree_7_Attrib_23__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_22__len__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_4lxml_5etree_7_Attrib_22__len__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  Py_ssize_t __pyx_v_c;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2308
 * 
 *     def __len__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         cdef Py_ssize_t c = 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2309
 *     def __len__(self):
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:
 */
  __pyx_t_3 = __pyx_v_self->_element->_c_node->properties;
  __pyx_v_c_attr = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2310
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         cdef Py_ssize_t c = 0             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 */
  __pyx_v_c = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2311
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c += 1
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_c_attr != NULL) != 0);
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2312
 *         cdef Py_ssize_t c = 0
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *                 c += 1
 *             c_attr = c_attr.next
 */
    __pyx_t_4 = ((__pyx_v_c_attr->type == XML_ATTRIBUTE_NODE) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2313
 *         while c_attr is not NULL:
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c += 1             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         return c
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2314
 *             if c_attr.type == tree.XML_ATTRIBUTE_NODE:
 *                 c += 1
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         return c
 * 
 */
    __pyx_t_3 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2315
 *                 c += 1
 *             c_attr = c_attr.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2307
 *         return 0
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlAttr* c_attr = self._element._c_node.properties
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2317
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_25get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_25get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Attrib.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_24get(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_24get(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2318
 * 
 *     def get(self, key, default=None):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _getAttributeValue(self._element, key, default)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2319
 *     def get(self, key, default=None):
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree__getAttributeValue(((struct LxmlElement *)__pyx_t_1), __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2317
 *         return c
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _getAttributeValue(self._element, key, default)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2321
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_27keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_27keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_26keys(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_26keys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2322
 * 
 *     def keys(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2323
 *     def keys(self):
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2321
 *         return _getAttributeValue(self._element, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2325
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_29__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_29__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_28__iter__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_28__iter__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2326
 * 
 *     def __iter__(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2327
 *     def __iter__(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2325
 *         return _collectAttributes(self._element._c_node, 1)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2329
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_30iterkeys(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_30iterkeys(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterkeys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2330
 * 
 *     def iterkeys(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2331
 *     def iterkeys(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2329
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 1))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2333
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_33values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_33values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_32values(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_32values(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2334
 * 
 *     def values(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2335
 *     def values(self):
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2333
 *         return iter(_collectAttributes(self._element._c_node, 1))
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 2)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2337
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_35itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_35itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_34itervalues(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_34itervalues(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2338
 * 
 *     def itervalues(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2339
 *     def itervalues(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2337
 *         return _collectAttributes(self._element._c_node, 2)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 2))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2341
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_37items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_37items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_36items(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_36items(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2342
 * 
 *     def items(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2343
 *     def items(self):
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2341
 *         return iter(_collectAttributes(self._element._c_node, 2))
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return _collectAttributes(self._element._c_node, 3)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2345
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_39iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_39iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_38iteritems(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_38iteritems(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2346
 * 
 *     def iteritems(self):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2347
 *     def iteritems(self):
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, key):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->_element->_c_node, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2345
 *         return _collectAttributes(self._element._c_node, 3)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return iter(_collectAttributes(self._element._c_node, 3))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._Attrib.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2349
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_41has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_41has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_40has_key(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_40has_key(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2350
 * 
 *     def has_key(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         return key in self
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2351
 *     def has_key(self, key):
 *         _assertValidNode(self._element)
 *         return key in self             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_key, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2349
 *         return iter(_collectAttributes(self._element._c_node, 3))
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         return key in self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Attrib.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2353
 *         return key in self
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_Attrib_43__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_4lxml_5etree_7_Attrib_43__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_42__contains__(((struct __pyx_obj_4lxml_5etree__Attrib *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_4lxml_5etree_7_Attrib_42__contains__(struct __pyx_obj_4lxml_5etree__Attrib *__pyx_v_self, PyObject *__pyx_v_key) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  const xmlChar *__pyx_v_c_href;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlNode *__pyx_t_5;
  const xmlChar *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2354
 * 
 *     def __contains__(self, key):
 *         _assertValidNode(self._element)             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         ns, tag = _getNsTag(key)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_t_1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2356
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node
 *         ns, tag = _getNsTag(key)             # <<<<<<<<<<<<<<
 *         c_node = self._element._c_node
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_tag = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2357
 *         cdef xmlNode* c_node
 *         ns, tag = _getNsTag(key)
 *         c_node = self._element._c_node             # <<<<<<<<<<<<<<
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 */
  __pyx_t_5 = __pyx_v_self->_element->_c_node;
  __pyx_v_c_node = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2358
 *         ns, tag = _getNsTag(key)
 *         c_node = self._element._c_node
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)             # <<<<<<<<<<<<<<
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 */
  __pyx_t_7 = (__pyx_v_ns == Py_None);
  if ((__pyx_t_7 != 0)) {
    __pyx_t_6 = ((const xmlChar *)NULL);
  } else {
    __pyx_t_6 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_v_c_href = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2359
 *         c_node = self._element._c_node
 *         c_href = <const_xmlChar*>NULL if ns is None else _xcstr(ns)
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(one, other, int op):
 */
  if ((xmlHasNsProp(__pyx_v_c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_tag), __pyx_v_c_href) != 0)) {
    __pyx_t_2 = 1;
  } else {
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2353
 *         return key in self
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         _assertValidNode(self._element)
 *         cdef xmlNode* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._Attrib.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2361
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 *     def __richcmp__(one, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if not isinstance(one, dict):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(((PyObject *)__pyx_v_one), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

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

static PyObject *__pyx_pf_4lxml_5etree_7_Attrib_44__richcmp__(PyObject *__pyx_v_one, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_INCREF(__pyx_v_one);
  __Pyx_INCREF(__pyx_v_other);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2362
 * 
 *     def __richcmp__(one, other, int op):
 *         try:             # <<<<<<<<<<<<<<
 *             if not isinstance(one, dict):
 *                 one = dict(one)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2363
 *     def __richcmp__(one, other, int op):
 *         try:
 *             if not isinstance(one, dict):             # <<<<<<<<<<<<<<
 *                 one = dict(one)
 *             if not isinstance(other, dict):
 */
      __pyx_t_4 = PyDict_Check(__pyx_v_one); 
      __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2364
 *         try:
 *             if not isinstance(one, dict):
 *                 one = dict(one)             # <<<<<<<<<<<<<<
 *             if not isinstance(other, dict):
 *                 other = dict(other)
 */
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_one);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_one);
        __Pyx_GIVEREF(__pyx_v_one);
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_one, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2365
 *             if not isinstance(one, dict):
 *                 one = dict(one)
 *             if not isinstance(other, dict):             # <<<<<<<<<<<<<<
 *                 other = dict(other)
 *         except (TypeError, ValueError):
 */
      __pyx_t_5 = PyDict_Check(__pyx_v_other); 
      __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2366
 *                 one = dict(one)
 *             if not isinstance(other, dict):
 *                 other = dict(other)             # <<<<<<<<<<<<<<
 *         except (TypeError, ValueError):
 *             return NotImplemented
 */
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_other);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_other);
        __Pyx_GIVEREF(__pyx_v_other);
        __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_6);
        __pyx_t_6 = 0;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2367
 *             if not isinstance(other, dict):
 *                 other = dict(other)
 *         except (TypeError, ValueError):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_TypeError) || PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree._Attrib.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2368
 *                 other = dict(other)
 *         except (TypeError, ValueError):
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return python.PyObject_RichCompare(one, other, op)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2369
 *         except (TypeError, ValueError):
 *             return NotImplemented
 *         return python.PyObject_RichCompare(one, other, op)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyObject_RichCompare(__pyx_v_one, __pyx_v_other, __pyx_v_op); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2361
 *         return 1 if tree.xmlHasNsProp(c_node, _xcstr(tag), c_href) else 0
 * 
 *     def __richcmp__(one, other, int op):             # <<<<<<<<<<<<<<
 *         try:
 *             if not isinstance(one, dict):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._Attrib.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_one);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2381
 *     cdef xmlAttr* _c_attr
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_AttribIterator___iter__(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator___iter__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2382
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2381
 *     cdef xmlAttr* _c_attr
 *     cdef int _keysvalues # 1 - keys, 2 - values, 3 - items (key, value)
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2384
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_AttribIterator_2__next__(((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_AttribIterator_2__next__(struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_self) {
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlAttr *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2386
 *     def __next__(self):
 *         cdef xmlAttr* c_attr
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_attr = self._c_attr
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_node) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2387
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2388
 *         if self._node is None:
 *             raise StopIteration
 *         c_attr = self._c_attr             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
 */
  __pyx_t_3 = __pyx_v_self->_c_attr;
  __pyx_v_c_attr = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2389
 *             raise StopIteration
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *             c_attr = c_attr.next
 *         if c_attr is NULL:
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_attr != NULL) != 0);
    if (__pyx_t_2) {
      __pyx_t_1 = ((__pyx_v_c_attr->type != XML_ATTRIBUTE_NODE) != 0);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2390
 *         c_attr = self._c_attr
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if c_attr is NULL:
 *             self._node = None
 */
    __pyx_t_3 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2391
 *         while c_attr is not NULL and c_attr.type != tree.XML_ATTRIBUTE_NODE:
 *             c_attr = c_attr.next
 *         if c_attr is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *             raise StopIteration
 */
  __pyx_t_4 = ((__pyx_v_c_attr == NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2392
 *             c_attr = c_attr.next
 *         if c_attr is NULL:
 *             self._node = None             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_node));
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2393
 *         if c_attr is NULL:
 *             self._node = None
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         self._c_attr = c_attr.next
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2395
 *             raise StopIteration
 * 
 *         self._c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 */
  __pyx_t_3 = __pyx_v_c_attr->next;
  __pyx_v_self->_c_attr = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2398
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:             # <<<<<<<<<<<<<<
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 */
  switch (__pyx_v_self->_keysvalues) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2396
 * 
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:             # <<<<<<<<<<<<<<
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 */
    case 1:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2397
 *         self._c_attr = c_attr.next
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)             # <<<<<<<<<<<<<<
 *         elif self._keysvalues == 2:
 *             return _attributeValue(self._node._c_node, c_attr)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2398
 *         if self._keysvalues == 1:
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:             # <<<<<<<<<<<<<<
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 */
    case 2:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2399
 *             return _namespacedName(<xmlNode*>c_attr)
 *         elif self._keysvalues == 2:
 *             return _attributeValue(self._node._c_node, c_attr)             # <<<<<<<<<<<<<<
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_self->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2401
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __pyx_f_4lxml_5etree__namespacedName(((xmlNode *)__pyx_v_c_attr)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2402
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),
 *                     _attributeValue(self._node._c_node, c_attr))             # <<<<<<<<<<<<<<
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_self->_node->_c_node, __pyx_v_c_attr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2401
 *             return _attributeValue(self._node._c_node, c_attr)
 *         else:
 *             return (_namespacedName(<xmlNode*>c_attr),             # <<<<<<<<<<<<<<
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2384
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlAttr* c_attr
 *         if self._node is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._AttribIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2404
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
 */

static PyObject *__pyx_f_4lxml_5etree__attributeIteratorFactory(struct LxmlElement *__pyx_v_element, int __pyx_v_keysvalues) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *__pyx_v_attribs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlAttr *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attributeIteratorFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2406
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
 */
  __pyx_t_1 = ((__pyx_v_element->_c_node->properties == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2407
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
 *         return ITER_EMPTY             # <<<<<<<<<<<<<<
 *     attribs = _AttribIterator()
 *     attribs._node = element
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
    __pyx_r = __pyx_v_4lxml_5etree_ITER_EMPTY;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2408
 *     if element._c_node.properties is NULL:
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()             # <<<<<<<<<<<<<<
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__AttribIterator)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_attribs = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2409
 *         return ITER_EMPTY
 *     attribs = _AttribIterator()
 *     attribs._node = element             # <<<<<<<<<<<<<<
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(__pyx_v_attribs->_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_attribs->_node));
  __pyx_v_attribs->_node = __pyx_v_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2410
 *     attribs = _AttribIterator()
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties             # <<<<<<<<<<<<<<
 *     attribs._keysvalues = keysvalues
 *     return attribs
 */
  __pyx_t_3 = __pyx_v_element->_c_node->properties;
  __pyx_v_attribs->_c_attr = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2411
 *     attribs._node = element
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues             # <<<<<<<<<<<<<<
 *     return attribs
 * 
 */
  __pyx_v_attribs->_keysvalues = __pyx_v_keysvalues;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2412
 *     attribs._c_attr = element._c_node.properties
 *     attribs._keysvalues = keysvalues
 *     return attribs             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_attribs));
  __pyx_r = ((PyObject *)__pyx_v_attribs);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2404
 *                     _attributeValue(self._node._c_node, c_attr))
 * 
 * cdef object _attributeIteratorFactory(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     cdef _AttribIterator attribs
 *     if element._c_node.properties is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._attributeIteratorFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_attribs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2424
 *     cdef char* _href
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):             # <<<<<<<<<<<<<<
 *         self._href = NULL
 *         self._name = NULL
 */

static PyObject *__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch(struct LxmlElementTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initTagMatch", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2425
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL             # <<<<<<<<<<<<<<
 *         self._name = NULL
 *         if tag is None:
 */
  __pyx_v_self->_href = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2426
 *     cdef _initTagMatch(self, tag):
 *         self._href = NULL
 *         self._name = NULL             # <<<<<<<<<<<<<<
 *         if tag is None:
 *             self._node_type = 0
 */
  __pyx_v_self->_name = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2427
 *         self._href = NULL
 *         self._name = NULL
 *         if tag is None:             # <<<<<<<<<<<<<<
 *             self._node_type = 0
 *         elif tag is Comment:
 */
  __pyx_t_1 = (__pyx_v_tag == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2428
 *         self._name = NULL
 *         if tag is None:
 *             self._node_type = 0             # <<<<<<<<<<<<<<
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
 */
    __pyx_v_self->_node_type = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2429
 *         if tag is None:
 *             self._node_type = 0
 *         elif tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Comment); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2430
 *             self._node_type = 0
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE             # <<<<<<<<<<<<<<
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
 */
    __pyx_v_self->_node_type = XML_COMMENT_NODE;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2431
 *         elif tag is Comment:
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2432
 *             self._node_type = tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 */
    __pyx_v_self->_node_type = XML_PI_NODE;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2433
 *         elif tag is ProcessingInstruction:
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Entity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2434
 *             self._node_type = tree.XML_PI_NODE
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Element:
 *             self._node_type = tree.XML_ELEMENT_NODE
 */
    __pyx_v_self->_node_type = XML_ENTITY_REF_NODE;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2435
 *         elif tag is Entity:
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Element); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__pyx_v_tag == __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2436
 *             self._node_type = tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 *             self._node_type = tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE
 */
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2438
 *             self._node_type = tree.XML_ELEMENT_NODE
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:
 */
    __pyx_v_self->_node_type = XML_ELEMENT_NODE;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2439
 *         else:
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_pystrings);
    __Pyx_DECREF(__pyx_v_self->_pystrings);
    __pyx_v_self->_pystrings = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2440
 *             self._node_type = tree.XML_ELEMENT_NODE
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:             # <<<<<<<<<<<<<<
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = (__pyx_t_3 != Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2441
 *             self._pystrings = _getNsTag(tag)
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])             # <<<<<<<<<<<<<<
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 */
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_self->_href = PyBytes_AS_STRING(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2442
 *             if self._pystrings[0] is not None:
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])             # <<<<<<<<<<<<<<
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 *                 self._name = NULL
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->_pystrings, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_self->_name = PyBytes_AS_STRING(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2443
 *                 self._href = _cstr(self._pystrings[0])
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':             # <<<<<<<<<<<<<<
 *                 self._name = NULL
 * 
 */
    __pyx_t_1 = (((__pyx_v_self->_name[0]) == '*') != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = (((__pyx_v_self->_name[1]) == '\x00') != 0);
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2444
 *             self._name = _cstr(self._pystrings[1])
 *             if self._name[0] == c'*' and self._name[1] == c'\0':
 *                 self._name = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef public class _ElementIterator(_ElementTagMatcher) [
 */
      __pyx_v_self->_name = NULL;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2424
 *     cdef char* _href
 *     cdef char* _name
 *     cdef _initTagMatch(self, tag):             # <<<<<<<<<<<<<<
 *         self._href = NULL
 *         self._name = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementTagMatcher._initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2454
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_16_ElementIterator___iter__(((struct LxmlElementIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator___iter__(struct LxmlElementIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2455
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _storeNext(self, _Element node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2454
 *     cdef _Element _node
 *     cdef _node_to_node_function _next_element
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2457
 *         return self
 * 
 *     cdef void _storeNext(self, _Element node):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
 */

static void __pyx_f_4lxml_5etree_16_ElementIterator__storeNext(struct LxmlElementIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  xmlNode *__pyx_v_c_node;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_storeNext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2459
 *     cdef void _storeNext(self, _Element node):
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \
 */
  __pyx_v_c_node = __pyx_v_self->_next_element(__pyx_v_node->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2460
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and \             # <<<<<<<<<<<<<<
 *                   self._node_type != 0 and \
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2461
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \             # <<<<<<<<<<<<<<
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 */
      __pyx_t_2 = ((__pyx_v_self->__pyx_base._node_type != 0) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2462
 *         while c_node is not NULL and \
 *                   self._node_type != 0 and \
 *                   (<tree.xmlElementType>self._node_type != c_node.type or             # <<<<<<<<<<<<<<
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)
 */
        __pyx_t_3 = ((((xmlElementType)__pyx_v_self->__pyx_base._node_type) != __pyx_v_c_node->type) != 0);
        if (!__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2463
 *                   self._node_type != 0 and \
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:
 */
          __pyx_t_4 = ((!(__pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, ((const xmlChar *)__pyx_v_self->__pyx_base._href), ((const xmlChar *)__pyx_v_self->__pyx_base._name)) != 0)) != 0);
          __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;
      }
      __pyx_t_2 = __pyx_t_3;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2464
 *                   (<tree.xmlElementType>self._node_type != c_node.type or
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._node = None
 */
    __pyx_v_c_node = __pyx_v_self->_next_element(__pyx_v_c_node);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2465
 *                    not _tagMatches(c_node, <const_xmlChar*>self._href, <const_xmlChar*>self._name)):
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._node = None
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2466
 *             c_node = self._next_element(c_node)
 *         if c_node is NULL:
 *             self._node = None             # <<<<<<<<<<<<<<
 *         else:
 *             # Python ref:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_node));
    __pyx_v_self->_node = ((struct LxmlElement *)Py_None);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2469
 *         else:
 *             # Python ref:
 *             self._node = _elementFactory(node._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_node));
    __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2457
 *         return self
 * 
 *     cdef void _storeNext(self, _Element node):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         c_node = self._next_element(node._c_node)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._ElementIterator._storeNext", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2471
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_16_ElementIterator_2__next__(((struct LxmlElementIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_16_ElementIterator_2__next__(struct LxmlElementIterator *__pyx_v_self) {
  struct LxmlElement *__pyx_v_current_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2474
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 *         if self._node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         # Python ref:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_node) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2475
 *         cdef _Element current_node
 *         if self._node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         # Python ref:
 *         current_node = self._node
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2477
 *             raise StopIteration
 *         # Python ref:
 *         current_node = self._node             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_node);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2478
 *         # Python ref:
 *         current_node = self._node
 *         self._storeNext(current_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *)__pyx_v_self->__pyx_base.__pyx_vtab)->_storeNext(__pyx_v_self, __pyx_v_current_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2479
 *         current_node = self._node
 *         self._storeNext(current_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_current_node));
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2471
 *             self._node = _elementFactory(node._doc, c_node)
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ElementIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2494
 *     cdef int _node_types
 * 
 *     def __cinit__(self, tags):             # <<<<<<<<<<<<<<
 *         self._cached_tags = NULL
 *         self._cached_size = 0
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16_MultiTagMatcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16_MultiTagMatcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tags,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tags)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_tags = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_16_MultiTagMatcher___cinit__(((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_v_self), __pyx_v_tags);

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

static int __pyx_pf_4lxml_5etree_16_MultiTagMatcher___cinit__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2495
 * 
 *     def __cinit__(self, tags):
 *         self._cached_tags = NULL             # <<<<<<<<<<<<<<
 *         self._cached_size = 0
 *         self._tag_count = 0
 */
  __pyx_v_self->_cached_tags = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2496
 *     def __cinit__(self, tags):
 *         self._cached_tags = NULL
 *         self._cached_size = 0             # <<<<<<<<<<<<<<
 *         self._tag_count = 0
 *         self._node_types = 0
 */
  __pyx_v_self->_cached_size = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2497
 *         self._cached_tags = NULL
 *         self._cached_size = 0
 *         self._tag_count = 0             # <<<<<<<<<<<<<<
 *         self._node_types = 0
 *         self._py_tags = []
 */
  __pyx_v_self->_tag_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2498
 *         self._cached_size = 0
 *         self._tag_count = 0
 *         self._node_types = 0             # <<<<<<<<<<<<<<
 *         self._py_tags = []
 *         self.initTagMatch(tags)
 */
  __pyx_v_self->_node_types = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2499
 *         self._tag_count = 0
 *         self._node_types = 0
 *         self._py_tags = []             # <<<<<<<<<<<<<<
 *         self.initTagMatch(tags)
 * 
 */
  __pyx_t_1 = PyList_New(0); 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_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_py_tags);
  __Pyx_DECREF(__pyx_v_self->_py_tags);
  __pyx_v_self->_py_tags = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2500
 *         self._node_types = 0
 *         self._py_tags = []
 *         self.initTagMatch(tags)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(__pyx_v_self, __pyx_v_tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2494
 *     cdef int _node_types
 * 
 *     def __cinit__(self, tags):             # <<<<<<<<<<<<<<
 *         self._cached_tags = NULL
 *         self._cached_size = 0
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2502
 *         self.initTagMatch(tags)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self._clear()
 * 
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_16_MultiTagMatcher_2__dealloc__(((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_16_MultiTagMatcher_2__dealloc__(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2503
 * 
 *     def __dealloc__(self):
 *         self._clear()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint rejectsAll(self):
 */
  __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2502
 *         self.initTagMatch(tags)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self._clear()
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2505
 *         self._clear()
 * 
 *     cdef bint rejectsAll(self):             # <<<<<<<<<<<<<<
 *         return not self._tag_count and not self._node_types
 * 
 */

static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("rejectsAll", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2506
 * 
 *     cdef bint rejectsAll(self):
 *         return not self._tag_count and not self._node_types             # <<<<<<<<<<<<<<
 * 
 *     cdef bint rejectsAllAttributes(self):
 */
  __pyx_t_1 = (!(__pyx_v_self->_tag_count != 0));
  if (__pyx_t_1) {
    __pyx_t_2 = (!(__pyx_v_self->_node_types != 0));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2505
 *         self._clear()
 * 
 *     cdef bint rejectsAll(self):             # <<<<<<<<<<<<<<
 *         return not self._tag_count and not self._node_types
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2508
 *         return not self._tag_count and not self._node_types
 * 
 *     cdef bint rejectsAllAttributes(self):             # <<<<<<<<<<<<<<
 *         return not self._tag_count
 * 
 */

static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rejectsAllAttributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2509
 * 
 *     cdef bint rejectsAllAttributes(self):
 *         return not self._tag_count             # <<<<<<<<<<<<<<
 * 
 *     cdef bint matchesType(self, int node_type):
 */
  __pyx_r = (!(__pyx_v_self->_tag_count != 0));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2508
 *         return not self._tag_count and not self._node_types
 * 
 *     cdef bint rejectsAllAttributes(self):             # <<<<<<<<<<<<<<
 *         return not self._tag_count
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2511
 *         return not self._tag_count
 * 
 *     cdef bint matchesType(self, int node_type):             # <<<<<<<<<<<<<<
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
 */

static int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, int __pyx_v_node_type) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("matchesType", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2512
 * 
 *     cdef bint matchesType(self, int node_type):
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:             # <<<<<<<<<<<<<<
 *             return True
 *         return self._node_types & (1 << node_type)
 */
  __pyx_t_1 = (__pyx_v_node_type == XML_ELEMENT_NODE);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_self->_tag_count != 0);
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2513
 *     cdef bint matchesType(self, int node_type):
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True             # <<<<<<<<<<<<<<
 *         return self._node_types & (1 << node_type)
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2514
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
 *         return self._node_types & (1 << node_type)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _clear(self):
 */
  __pyx_r = (__pyx_v_self->_node_types & (1 << __pyx_v_node_type));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2511
 *         return not self._tag_count
 * 
 *     cdef bint matchesType(self, int node_type):             # <<<<<<<<<<<<<<
 *         if node_type == tree.XML_ELEMENT_NODE and self._tag_count:
 *             return True
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2516
 *         return self._node_types & (1 << node_type)
 * 
 *     cdef void _clear(self):             # <<<<<<<<<<<<<<
 *         cdef size_t i, count
 *         count = self._tag_count
 */

static void __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self) {
  size_t __pyx_v_i;
  size_t __pyx_v_count;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  __Pyx_RefNannySetupContext("_clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2518
 *     cdef void _clear(self):
 *         cdef size_t i, count
 *         count = self._tag_count             # <<<<<<<<<<<<<<
 *         self._tag_count = 0
 *         if self._cached_tags:
 */
  __pyx_t_1 = __pyx_v_self->_tag_count;
  __pyx_v_count = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2519
 *         cdef size_t i, count
 *         count = self._tag_count
 *         self._tag_count = 0             # <<<<<<<<<<<<<<
 *         if self._cached_tags:
 *             for i in xrange(count):
 */
  __pyx_v_self->_tag_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2520
 *         count = self._tag_count
 *         self._tag_count = 0
 *         if self._cached_tags:             # <<<<<<<<<<<<<<
 *             for i in xrange(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 */
  __pyx_t_2 = (__pyx_v_self->_cached_tags != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2521
 *         self._tag_count = 0
 *         if self._cached_tags:
 *             for i in xrange(count):             # <<<<<<<<<<<<<<
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             cpython.mem.PyMem_Free(self._cached_tags)
 */
    __pyx_t_1 = __pyx_v_count;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2522
 *         if self._cached_tags:
 *             for i in xrange(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)             # <<<<<<<<<<<<<<
 *             cpython.mem.PyMem_Free(self._cached_tags)
 *             self._cached_tags = NULL
 */
      Py_XDECREF((__pyx_v_self->_cached_tags[__pyx_v_i]).href);
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2523
 *             for i in xrange(count):
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             cpython.mem.PyMem_Free(self._cached_tags)             # <<<<<<<<<<<<<<
 *             self._cached_tags = NULL
 * 
 */
    PyMem_Free(__pyx_v_self->_cached_tags);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2524
 *                 cpython.ref.Py_XDECREF(self._cached_tags[i].href)
 *             cpython.mem.PyMem_Free(self._cached_tags)
 *             self._cached_tags = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef initTagMatch(self, tags):
 */
    __pyx_v_self->_cached_tags = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2516
 *         return self._node_types & (1 << node_type)
 * 
 *     cdef void _clear(self):             # <<<<<<<<<<<<<<
 *         cdef size_t i, count
 *         count = self._tag_count
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2526
 *             self._cached_tags = NULL
 * 
 *     cdef initTagMatch(self, tags):             # <<<<<<<<<<<<<<
 *         self._cached_doc = None
 *         del self._py_tags[:]
 */

static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initTagMatch", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2527
 * 
 *     cdef initTagMatch(self, tags):
 *         self._cached_doc = None             # <<<<<<<<<<<<<<
 *         del self._py_tags[:]
 *         self._clear()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_cached_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_cached_doc));
  __pyx_v_self->_cached_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2528
 *     cdef initTagMatch(self, tags):
 *         self._cached_doc = None
 *         del self._py_tags[:]             # <<<<<<<<<<<<<<
 *         self._clear()
 *         if tags is None or tags == ():
 */
  if (unlikely(__pyx_v_self->_py_tags == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_py_tags, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2529
 *         self._cached_doc = None
 *         del self._py_tags[:]
 *         self._clear()             # <<<<<<<<<<<<<<
 *         if tags is None or tags == ():
 *             # no selection in tags argument => match anything
 */
  __pyx_f_4lxml_5etree_16_MultiTagMatcher__clear(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2530
 *         del self._py_tags[:]
 *         self._clear()
 *         if tags is None or tags == ():             # <<<<<<<<<<<<<<
 *             # no selection in tags argument => match anything
 *             self._node_types = (
 */
  __pyx_t_1 = (__pyx_v_tags == Py_None);
  if (!__pyx_t_1) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_tags, __pyx_empty_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __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) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2532
 *         if tags is None or tags == ():
 *             # no selection in tags argument => match anything
 *             self._node_types = (             # <<<<<<<<<<<<<<
 *                 1 << tree.XML_COMMENT_NODE |
 *                 1 << tree.XML_PI_NODE |
 */
    __pyx_v_self->_node_types = ((((1 << XML_COMMENT_NODE) | (1 << XML_PI_NODE)) | (1 << XML_ENTITY_REF_NODE)) | (1 << XML_ELEMENT_NODE));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2538
 *                 1 << tree.XML_ELEMENT_NODE)
 *         else:
 *             self._node_types = 0             # <<<<<<<<<<<<<<
 *             self._storeTags(tags, set())
 * 
 */
    __pyx_v_self->_node_types = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2539
 *         else:
 *             self._node_types = 0
 *             self._storeTags(tags, set())             # <<<<<<<<<<<<<<
 * 
 *     cdef _storeTags(self, tag, set seen):
 */
    __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_v_tags, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2526
 *             self._cached_tags = NULL
 * 
 *     cdef initTagMatch(self, tags):             # <<<<<<<<<<<<<<
 *         self._cached_doc = None
 *         del self._py_tags[:]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2541
 *             self._storeTags(tags, set())
 * 
 *     cdef _storeTags(self, tag, set seen):             # <<<<<<<<<<<<<<
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 */

static PyObject *__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_seen) {
  PyObject *__pyx_v_href = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_storeTags", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2542
 * 
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2543
 *     cdef _storeTags(self, tag, set seen):
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE             # <<<<<<<<<<<<<<
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE
 */
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_COMMENT_NODE));
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2544
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2545
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 */
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_PI_NODE));
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2546
 *         elif tag is ProcessingInstruction:
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Entity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2547
 *             self._node_types |= 1 << tree.XML_PI_NODE
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE             # <<<<<<<<<<<<<<
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 */
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_ENTITY_REF_NODE));
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2548
 *         elif tag is Entity:
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:             # <<<<<<<<<<<<<<
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Element); 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_t_3 = (__pyx_v_tag == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2549
 *             self._node_types |= 1 << tree.XML_ENTITY_REF_NODE
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *         elif python._isString(tag):
 *             if tag in seen:
 */
    __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_ELEMENT_NODE));
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2550
 *         elif tag is Element:
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):             # <<<<<<<<<<<<<<
 *             if tag in seen:
 *                 return
 */
  __pyx_t_2 = (_isString(__pyx_v_tag) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2551
 *             self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *         elif python._isString(tag):
 *             if tag in seen:             # <<<<<<<<<<<<<<
 *                 return
 *             seen.add(tag)
 */
    __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_tag, __pyx_v_seen, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2552
 *         elif python._isString(tag):
 *             if tag in seen:
 *                 return             # <<<<<<<<<<<<<<
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2553
 *             if tag in seen:
 *                 return
 *             seen.add(tag)             # <<<<<<<<<<<<<<
 *             if tag in ('*', '{*}*'):
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 */
    if (unlikely(__pyx_v_seen == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = PySet_Add(__pyx_v_seen, __pyx_v_tag); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2554
 *                 return
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):             # <<<<<<<<<<<<<<
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
 */
    __Pyx_INCREF(__pyx_v_tag);
    __pyx_t_1 = __pyx_v_tag;
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__34, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_3) {
      __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__35, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __pyx_t_2;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = (__pyx_t_5 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2555
 *             seen.add(tag)
 *             if tag in ('*', '{*}*'):
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE             # <<<<<<<<<<<<<<
 *             else:
 *                 href, name = _getNsTag(tag)
 */
      __pyx_v_self->_node_types = (__pyx_v_self->_node_types | (1 << XML_ELEMENT_NODE));
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2557
 *                 self._node_types |= 1 << tree.XML_ELEMENT_NODE
 *             else:
 *                 href, name = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *                 if name == b'*':
 *                     name = None
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(__pyx_t_1 != Py_None)) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_href = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_name = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2558
 *             else:
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':             # <<<<<<<<<<<<<<
 *                     name = None
 *                 if href is None:
 */
      __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_v_name, __pyx_kp_b__34, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2559
 *                 href, name = _getNsTag(tag)
 *                 if name == b'*':
 *                     name = None             # <<<<<<<<<<<<<<
 *                 if href is None:
 *                     href = b''  # no namespace
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_name, Py_None);
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2560
 *                 if name == b'*':
 *                     name = None
 *                 if href is None:             # <<<<<<<<<<<<<<
 *                     href = b''  # no namespace
 *                 elif href == b'*':
 */
      __pyx_t_3 = (__pyx_v_href == Py_None);
      __pyx_t_5 = (__pyx_t_3 != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2561
 *                     name = None
 *                 if href is None:
 *                     href = b''  # no namespace             # <<<<<<<<<<<<<<
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none
 */
        __Pyx_INCREF(__pyx_kp_b__15);
        __Pyx_DECREF_SET(__pyx_v_href, __pyx_kp_b__15);
        goto __pyx_L7;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2562
 *                 if href is None:
 *                     href = b''  # no namespace
 *                 elif href == b'*':             # <<<<<<<<<<<<<<
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))
 */
      __pyx_t_5 = (__Pyx_PyBytes_Equals(__pyx_v_href, __pyx_kp_b__34, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2563
 *                     href = b''  # no namespace
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none             # <<<<<<<<<<<<<<
 *                 self._py_tags.append((href, name))
 *         else:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_href, Py_None);
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2564
 *                 elif href == b'*':
 *                     href = None  # wildcard: any namespace, including none
 *                 self._py_tags.append((href, name))             # <<<<<<<<<<<<<<
 *         else:
 *             # support a sequence of tags
 */
      if (unlikely(__pyx_v_self->_py_tags == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_href);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_href);
      __Pyx_GIVEREF(__pyx_v_href);
      __Pyx_INCREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_py_tags, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2567
 *         else:
 *             # support a sequence of tags
 *             for item in tag:             # <<<<<<<<<<<<<<
 *                 self._storeTags(item, seen)
 * 
 */
    if (PyList_CheckExact(__pyx_v_tag) || PyTuple_CheckExact(__pyx_v_tag)) {
      __pyx_t_1 = __pyx_v_tag; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_9(__pyx_t_1);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2568
 *             # support a sequence of tags
 *             for item in tag:
 *                 self._storeTags(item, seen)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:
 */
      __pyx_t_7 = __pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags(__pyx_v_self, __pyx_v_item, __pyx_v_seen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2541
 *             self._storeTags(tags, set())
 * 
 *     cdef _storeTags(self, tag, set seen):             # <<<<<<<<<<<<<<
 *         if tag is Comment:
 *             self._node_types |= 1 << tree.XML_COMMENT_NODE
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher._storeTags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_href);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2570
 *                 self._storeTags(item, seen)
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, struct LxmlDocument *__pyx_v_doc, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args) {
  int __pyx_v_force_into_dict = ((int)0);
  size_t __pyx_v_dict_size;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cacheTags", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_force_into_dict = __pyx_optional_args->force_into_dict;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2574
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
 *         """
 *         cdef size_t dict_size = tree.xmlDictSize(doc._c_doc.dict)             # <<<<<<<<<<<<<<
 *         if doc is self._cached_doc and dict_size == self._cached_size:
 *             # doc and dict didn't change => names already cached
 */
  __pyx_v_dict_size = xmlDictSize(__pyx_v_doc->_c_doc->dict);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2575
 *         """
 *         cdef size_t dict_size = tree.xmlDictSize(doc._c_doc.dict)
 *         if doc is self._cached_doc and dict_size == self._cached_size:             # <<<<<<<<<<<<<<
 *             # doc and dict didn't change => names already cached
 *             return 0
 */
  __pyx_t_1 = (__pyx_v_doc == __pyx_v_self->_cached_doc);
  if ((__pyx_t_1 != 0)) {
    __pyx_t_2 = ((__pyx_v_dict_size == __pyx_v_self->_cached_size) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2577
 *         if doc is self._cached_doc and dict_size == self._cached_size:
 *             # doc and dict didn't change => names already cached
 *             return 0             # <<<<<<<<<<<<<<
 *         self._tag_count = 0
 *         if not self._py_tags:
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2578
 *             # doc and dict didn't change => names already cached
 *             return 0
 *         self._tag_count = 0             # <<<<<<<<<<<<<<
 *         if not self._py_tags:
 *             self._cached_doc = doc
 */
  __pyx_v_self->_tag_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2579
 *             return 0
 *         self._tag_count = 0
 *         if not self._py_tags:             # <<<<<<<<<<<<<<
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
 */
  __pyx_t_3 = (__pyx_v_self->_py_tags != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_py_tags) != 0);
  __pyx_t_1 = ((!__pyx_t_3) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2580
 *         self._tag_count = 0
 *         if not self._py_tags:
 *             self._cached_doc = doc             # <<<<<<<<<<<<<<
 *             self._cached_size = dict_size
 *             return 0
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __Pyx_GOTREF(__pyx_v_self->_cached_doc);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_cached_doc));
    __pyx_v_self->_cached_doc = __pyx_v_doc;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2581
 *         if not self._py_tags:
 *             self._cached_doc = doc
 *             self._cached_size = dict_size             # <<<<<<<<<<<<<<
 *             return 0
 *         if not self._cached_tags:
 */
    __pyx_v_self->_cached_size = __pyx_v_dict_size;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2582
 *             self._cached_doc = doc
 *             self._cached_size = dict_size
 *             return 0             # <<<<<<<<<<<<<<
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>cpython.mem.PyMem_Malloc(len(self._py_tags) * sizeof(qname))
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2583
 *             self._cached_size = dict_size
 *             return 0
 *         if not self._cached_tags:             # <<<<<<<<<<<<<<
 *             self._cached_tags = <qname*>cpython.mem.PyMem_Malloc(len(self._py_tags) * sizeof(qname))
 *             if not self._cached_tags:
 */
  __pyx_t_1 = ((!(__pyx_v_self->_cached_tags != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2584
 *             return 0
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>cpython.mem.PyMem_Malloc(len(self._py_tags) * sizeof(qname))             # <<<<<<<<<<<<<<
 *             if not self._cached_tags:
 *                 self._cached_doc = None
 */
    __pyx_t_4 = __pyx_v_self->_py_tags;
    __Pyx_INCREF(__pyx_t_4);
    if (unlikely(__pyx_t_4 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = PyList_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_self->_cached_tags = ((struct __pyx_t_4lxml_5etree_qname *)PyMem_Malloc((__pyx_t_5 * (sizeof(struct __pyx_t_4lxml_5etree_qname)))));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2585
 *         if not self._cached_tags:
 *             self._cached_tags = <qname*>cpython.mem.PyMem_Malloc(len(self._py_tags) * sizeof(qname))
 *             if not self._cached_tags:             # <<<<<<<<<<<<<<
 *                 self._cached_doc = None
 *                 raise MemoryError()
 */
    __pyx_t_1 = ((!(__pyx_v_self->_cached_tags != 0)) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2586
 *             self._cached_tags = <qname*>cpython.mem.PyMem_Malloc(len(self._py_tags) * sizeof(qname))
 *             if not self._cached_tags:
 *                 self._cached_doc = None             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_cached_doc);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_cached_doc));
      __pyx_v_self->_cached_doc = ((struct LxmlDocument *)Py_None);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2587
 *             if not self._cached_tags:
 *                 self._cached_doc = None
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2589
 *                 raise MemoryError()
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)             # <<<<<<<<<<<<<<
 *         self._cached_doc = doc
 *         self._cached_size = dict_size
 */
  __pyx_t_4 = __pyx_v_self->_py_tags;
  __Pyx_INCREF(__pyx_t_4);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2588
 *                 self._cached_doc = None
 *                 raise MemoryError()
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(             # <<<<<<<<<<<<<<
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 *         self._cached_doc = doc
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__mapTagsToQnameMatchArray(__pyx_v_doc->_c_doc, ((PyObject*)__pyx_t_4), __pyx_v_self->_cached_tags, __pyx_v_force_into_dict); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_self->_tag_count = ((size_t)__pyx_t_5);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2590
 *         self._tag_count = <size_t>_mapTagsToQnameMatchArray(
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 *         self._cached_doc = doc             # <<<<<<<<<<<<<<
 *         self._cached_size = dict_size
 *         return 0
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(__pyx_v_self->_cached_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_cached_doc));
  __pyx_v_self->_cached_doc = __pyx_v_doc;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2591
 *             doc._c_doc, self._py_tags, self._cached_tags, force_into_dict)
 *         self._cached_doc = doc
 *         self._cached_size = dict_size             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_v_self->_cached_size = __pyx_v_dict_size;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2592
 *         self._cached_doc = doc
 *         self._cached_size = dict_size
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matches(self, xmlNode* c_node):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2570
 *                 self._storeTags(item, seen)
 * 
 *     cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         Look up the tag names in the doc dict to enable string pointer comparisons.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._MultiTagMatcher.cacheTags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2594
 *         return 0
 * 
 *     cdef inline bint matches(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_2;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_3;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_4;
  __Pyx_RefNannySetupContext("matches", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2596
 *     cdef inline bint matches(self, xmlNode* c_node):
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = ((__pyx_v_self->_node_types & (1 << __pyx_v_c_node->type)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2597
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
 *             return True             # <<<<<<<<<<<<<<
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2598
 *         if self._node_types & (1 << c_node.type):
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2599
 *             return True
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:             # <<<<<<<<<<<<<<
 *                 if _tagMatchesExactly(c_node, c_qname):
 *                     return True
 */
    __pyx_t_3 = (__pyx_v_self->_cached_tags + __pyx_v_self->_tag_count);
    for (__pyx_t_4 = __pyx_v_self->_cached_tags; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
      __pyx_t_2 = __pyx_t_4;
      __pyx_v_c_qname = __pyx_t_2;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2600
 *         elif c_node.type == tree.XML_ELEMENT_NODE:
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):             # <<<<<<<<<<<<<<
 *                     return True
 *         return False
 */
      __pyx_t_1 = (__pyx_f_4lxml_5etree__tagMatchesExactly(__pyx_v_c_node, __pyx_v_c_qname) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2601
 *             for c_qname in self._cached_tags[:self._tag_count]:
 *                 if _tagMatchesExactly(c_node, c_qname):
 *                     return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
        __pyx_r = 1;
        goto __pyx_L0;
      }
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2602
 *                 if _tagMatchesExactly(c_node, c_qname):
 *                     return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2594
 *         return 0
 * 
 *     cdef inline bint matches(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         cdef qname* c_qname
 *         if self._node_types & (1 << c_node.type):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2604
 *         return False
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_name):
 *         cdef qname* c_qname
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_2;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_3;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_4;
  __Pyx_RefNannySetupContext("matchesNsTag", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2607
 *                                   const_xmlChar* c_name):
 *         cdef qname* c_qname
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):             # <<<<<<<<<<<<<<
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
 */
  __pyx_t_1 = ((__pyx_v_self->_node_types & (1 << XML_ELEMENT_NODE)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2608
 *         cdef qname* c_qname
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):
 *             return True             # <<<<<<<<<<<<<<
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2609
 *         if self._node_types & (1 << tree.XML_ELEMENT_NODE):
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:             # <<<<<<<<<<<<<<
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True
 */
  __pyx_t_3 = (__pyx_v_self->_cached_tags + __pyx_v_self->_tag_count);
  for (__pyx_t_4 = __pyx_v_self->_cached_tags; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_c_qname = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2610
 *             return True
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    __pyx_t_1 = (__pyx_f_4lxml_5etree__nsTagMatchesExactly(__pyx_v_c_href, __pyx_v_c_name, __pyx_v_c_qname) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2611
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2612
 *             if _nsTagMatchesExactly(c_href, c_name, c_qname):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2604
 *         return False
 * 
 *     cdef inline bint matchesNsTag(self, const_xmlChar* c_href,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_name):
 *         cdef qname* c_qname
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2614
 *         return False
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr):             # <<<<<<<<<<<<<<
 *         """Attribute matches differ from Element matches in that they do
 *         not care about node types.
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_self, xmlAttr *__pyx_v_c_attr) {
  struct __pyx_t_4lxml_5etree_qname *__pyx_v_c_qname;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_1;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_2;
  struct __pyx_t_4lxml_5etree_qname *__pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("matchesAttribute", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2619
 *         """
 *         cdef qname* c_qname
 *         for c_qname in self._cached_tags[:self._tag_count]:             # <<<<<<<<<<<<<<
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True
 */
  __pyx_t_2 = (__pyx_v_self->_cached_tags + __pyx_v_self->_tag_count);
  for (__pyx_t_3 = __pyx_v_self->_cached_tags; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_c_qname = __pyx_t_1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2620
 *         cdef qname* c_qname
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
 */
    __pyx_t_4 = (__pyx_f_4lxml_5etree__tagMatchesExactly(((xmlNode *)__pyx_v_c_attr), __pyx_v_c_qname) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2621
 *         for c_qname in self._cached_tags[:self._tag_count]:
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_r = 1;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2622
 *             if _tagMatchesExactly(<xmlNode*>c_attr, c_qname):
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 * cdef class _ElementMatchIterator:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2614
 *         return False
 * 
 *     cdef inline bint matchesAttribute(self, xmlAttr* c_attr):             # <<<<<<<<<<<<<<
 *         """Attribute matches differ from Element matches in that they do
 *         not care about node types.
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2630
 * 
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher(tags)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, PyObject *__pyx_v_tags) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initTagMatcher", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2631
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):
 *         self._matcher = _MultiTagMatcher(tags)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tags);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tags);
  __Pyx_GIVEREF(__pyx_v_tags);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_matcher);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_matcher));
  __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2630
 * 
 *     @cython.final
 *     cdef _initTagMatcher(self, tags):             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher(tags)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ElementMatchIterator._initTagMatcher", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2633
 *         self._matcher = _MultiTagMatcher(tags)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementMatchIterator___iter__(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator___iter__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2634
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2633
 *         self._matcher = _MultiTagMatcher(tags)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2637
 * 
 *     @cython.final
 *     cdef int _storeNext(self, _Element node) except -1:             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(node._doc)
 *         c_node = self._next_element(node._c_node)
 */

static int __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_storeNext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2638
 *     @cython.final
 *     cdef int _storeNext(self, _Element node) except -1:
 *         self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_node->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_1), NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2639
 *     cdef int _storeNext(self, _Element node) except -1:
 *         self._matcher.cacheTags(node._doc)
 *         c_node = self._next_element(node._c_node)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)
 */
  __pyx_v_c_node = __pyx_v_self->_next_element(__pyx_v_node->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2640
 *         self._matcher.cacheTags(node._doc)
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and not self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_3) {
      __pyx_t_4 = ((!(__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_c_node) != 0)) != 0);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    if (!__pyx_t_5) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2641
 *         c_node = self._next_element(node._c_node)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 */
    __pyx_v_c_node = __pyx_v_self->_next_element(__pyx_v_c_node);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2643
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (((__pyx_v_c_node != NULL) != 0)) {
    __pyx_t_6 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_node));
  __pyx_v_self->_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2644
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2637
 * 
 *     @cython.final
 *     cdef int _storeNext(self, _Element node) except -1:             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(node._doc)
 *         c_node = self._next_element(node._c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ElementMatchIterator._storeNext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2646
 *         return 0
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element current_node = self._node
 *         if current_node is None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementMatchIterator_2__next__(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementMatchIterator_2__next__(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *__pyx_v_self) {
  struct LxmlElement *__pyx_v_current_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2647
 * 
 *     def __next__(self):
 *         cdef _Element current_node = self._node             # <<<<<<<<<<<<<<
 *         if current_node is None:
 *             raise StopIteration
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2648
 *     def __next__(self):
 *         cdef _Element current_node = self._node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self._storeNext(current_node)
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_current_node) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2649
 *         cdef _Element current_node = self._node
 *         if current_node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         self._storeNext(current_node)
 *         return current_node
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2650
 *         if current_node is None:
 *             raise StopIteration
 *         self._storeNext(current_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(__pyx_v_self, __pyx_v_current_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2651
 *             raise StopIteration
 *         self._storeNext(current_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementChildIterator(_ElementMatchIterator):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_current_node));
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2646
 *         return 0
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element current_node = self._node
 *         if current_node is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementMatchIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2657
 *     Iterates over the children of an element.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint reversed=False):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20ElementChildIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_20ElementChildIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_reversed;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,&__pyx_n_s_reversed,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_reversed = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_reversed == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_reversed = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag, __pyx_v_reversed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_20ElementChildIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementChildIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_reversed) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2659
 *     def __cinit__(self, _Element node not None, tag=None, *, bint reversed=False):
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatcher(tag)
 *         if reversed:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2660
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2661
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if reversed:             # <<<<<<<<<<<<<<
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement
 */
  __pyx_t_3 = (__pyx_v_reversed != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2662
 *         self._initTagMatcher(tag)
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_node->_c_node, 0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2663
 *         if reversed:
 *             c_node = _findChildBackwards(node._c_node, 0)
 *             self._next_element = _previousElement             # <<<<<<<<<<<<<<
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)
 */
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__previousElement;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2665
 *             self._next_element = _previousElement
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2666
 *         else:
 *             c_node = _findChildForwards(node._c_node, 0)
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(node._doc)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 */
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2667
 *             c_node = _findChildForwards(node._c_node, 0)
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->__pyx_base._matcher, ((struct LxmlDocument *)__pyx_t_2), NULL); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2668
 *             self._next_element = _nextElement
 *         self._matcher.cacheTags(node._doc)
 *         while c_node is not NULL and not self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_3) {
      __pyx_t_4 = ((!(__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->__pyx_base._matcher, __pyx_v_c_node) != 0)) != 0);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    if (!__pyx_t_5) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2669
 *         self._matcher.cacheTags(node._doc)
 *         while c_node is not NULL and not self._matcher.matches(c_node):
 *             c_node = self._next_element(c_node)             # <<<<<<<<<<<<<<
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None
 */
    __pyx_v_c_node = __pyx_v_self->__pyx_base._next_element(__pyx_v_c_node);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2671
 *             c_node = self._next_element(c_node)
 *         # store Python ref to next node to make sure it's kept alive
 *         self._node = _elementFactory(node._doc, c_node) if c_node is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * cdef class SiblingsIterator(_ElementMatchIterator):
 */
  if (((__pyx_v_c_node != NULL) != 0)) {
    __pyx_t_6 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_2 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base._node);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._node));
  __pyx_v_self->__pyx_base._node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2657
 *     Iterates over the children of an element.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint reversed=False):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         _assertValidNode(node)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.ElementChildIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2679
 *     You can pass the boolean keyword ``preceding`` to specify the direction.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_16SiblingsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_16SiblingsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_preceding;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,&__pyx_n_s_preceding,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_preceding = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_preceding == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_preceding = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag, __pyx_v_preceding);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_16SiblingsIterator___cinit__(struct __pyx_obj_4lxml_5etree_SiblingsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_preceding) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2680
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatcher(tag)
 *         if preceding:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2681
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         if preceding:
 *             self._next_element = _previousElement
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2682
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         if preceding:             # <<<<<<<<<<<<<<
 *             self._next_element = _previousElement
 *         else:
 */
  __pyx_t_3 = (__pyx_v_preceding != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2683
 *         self._initTagMatcher(tag)
 *         if preceding:
 *             self._next_element = _previousElement             # <<<<<<<<<<<<<<
 *         else:
 *             self._next_element = _nextElement
 */
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__previousElement;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2685
 *             self._next_element = _previousElement
 *         else:
 *             self._next_element = _nextElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
 */
    __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__nextElement;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2686
 *         else:
 *             self._next_element = _nextElement
 *         self._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef class AncestorsIterator(_ElementMatchIterator):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2679
 *     You can pass the boolean keyword ``preceding`` to specify the direction.
 *     """
 *     def __cinit__(self, _Element node not None, tag=None, *, bint preceding=False):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.SiblingsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2692
 *     Iterates over the ancestors of an element (from parent to parent).
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17AncestorsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17AncestorsIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2692; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17AncestorsIterator___cinit__(struct __pyx_obj_4lxml_5etree_AncestorsIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2693
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2694
 *     def __cinit__(self, _Element node not None, tag=None):
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         self._next_element = _parentElement
 *         self._storeNext(node)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2695
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement             # <<<<<<<<<<<<<<
 *         self._storeNext(node)
 * 
 */
  __pyx_v_self->__pyx_base._next_element = __pyx_f_4lxml_5etree__parentElement;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2696
 *         self._initTagMatcher(tag)
 *         self._next_element = _parentElement
 *         self._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementDepthFirstIterator:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext(((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)__pyx_v_self), __pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2692
 *     Iterates over the ancestors of an element (from parent to parent).
 *     """
 *     def __cinit__(self, _Element node not None, tag=None):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._initTagMatcher(tag)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.AncestorsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2723
 *     cdef _Element _top_node
 *     cdef _MultiTagMatcher _matcher
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._top_node  = node
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_inclusive;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_tag,&__pyx_n_s_inclusive,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_inclusive = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_inclusive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_inclusive = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self), __pyx_v_node, __pyx_v_tag, __pyx_v_inclusive);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, struct LxmlElement *__pyx_v_node, PyObject *__pyx_v_tag, int __pyx_v_inclusive) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2724
 *     cdef _MultiTagMatcher _matcher
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         self._top_node  = node
 *         self._next_node = node
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2725
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):
 *         _assertValidNode(node)
 *         self._top_node  = node             # <<<<<<<<<<<<<<
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher(tag)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
  __Pyx_GOTREF(__pyx_v_self->_top_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_top_node));
  __pyx_v_self->_top_node = __pyx_v_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2726
 *         _assertValidNode(node)
 *         self._top_node  = node
 *         self._next_node = node             # <<<<<<<<<<<<<<
 *         self._matcher = _MultiTagMatcher(tag)
 *         self._matcher.cacheTags(node._doc)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
  __Pyx_GOTREF(__pyx_v_self->_next_node);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_node));
  __pyx_v_self->_next_node = __pyx_v_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2727
 *         self._top_node  = node
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(node._doc)
 *         if not inclusive or not self._matcher.matches(node._c_node):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_matcher);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_matcher));
  __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2728
 *         self._next_node = node
 *         self._matcher = _MultiTagMatcher(tag)
 *         self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 *         if not inclusive or not self._matcher.matches(node._c_node):
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_node->_doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_3), NULL); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2729
 *         self._matcher = _MultiTagMatcher(tag)
 *         self._matcher.cacheTags(node._doc)
 *         if not inclusive or not self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
 *             next(self)
 */
  __pyx_t_4 = ((!(__pyx_v_inclusive != 0)) != 0);
  if (!__pyx_t_4) {
    __pyx_t_5 = ((!(__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node) != 0)) != 0);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2731
 *         if not inclusive or not self._matcher.matches(node._c_node):
 *             # find start node (this cannot raise StopIteration, self._next_node != None)
 *             next(self)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_t_3 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2723
 *     cdef _Element _top_node
 *     cdef _MultiTagMatcher _matcher
 *     def __cinit__(self, _Element node not None, tag=None, *, bint inclusive=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(node)
 *         self._top_node  = node
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2733
 *             next(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__iter__(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2734
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2733
 *             next(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2736
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_4__next__(((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25ElementDepthFirstIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_v_current_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2738
 *     def __next__(self):
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node             # <<<<<<<<<<<<<<
 *         if current_node is None:
 *             raise StopIteration
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_next_node);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_current_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2739
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
 *         if current_node is None:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         c_node = current_node._c_node
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_current_node) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2740
 *         cdef _Element current_node = self._next_node
 *         if current_node is None:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2741
 *         if current_node is None:
 *             raise StopIteration
 *         c_node = current_node._c_node             # <<<<<<<<<<<<<<
 *         self._matcher.cacheTags(current_node._doc)
 *         if not self._matcher._tag_count:
 */
  __pyx_t_4 = __pyx_v_current_node->_c_node;
  __pyx_v_c_node = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2742
 *             raise StopIteration
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)             # <<<<<<<<<<<<<<
 *         if not self._matcher._tag_count:
 *             # no tag name was found in the dict => not in document either
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_current_node->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_1), NULL); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2743
 *         c_node = current_node._c_node
 *         self._matcher.cacheTags(current_node._doc)
 *         if not self._matcher._tag_count:             # <<<<<<<<<<<<<<
 *             # no tag name was found in the dict => not in document either
 *             # try to match by node type
 */
  __pyx_t_3 = ((!(__pyx_v_self->_matcher->_tag_count != 0)) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2746
 *             # no tag name was found in the dict => not in document either
 *             # try to match by node type
 *             c_node = self._nextNodeAnyTag(c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(__pyx_v_self, __pyx_v_c_node);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2748
 *             c_node = self._nextNodeAnyTag(c_node)
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             self._next_node = None
 */
    __pyx_v_c_node = __pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(__pyx_v_self, __pyx_v_c_node);
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2749
 *         else:
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             self._next_node = None
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2750
 *             c_node = self._nextNodeMatchTag(c_node)
 *         if c_node is NULL:
 *             self._next_node = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_next_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_node));
    __pyx_v_self->_next_node = ((struct LxmlElement *)Py_None);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2752
 *             self._next_node = None
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)             # <<<<<<<<<<<<<<
 *         return current_node
 * 
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_current_node->_doc);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->_next_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_node));
    __pyx_v_self->_next_node = ((struct LxmlElement *)__pyx_t_6);
    __pyx_t_6 = 0;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2753
 *         else:
 *             self._next_node = _elementFactory(current_node._doc, c_node)
 *         return current_node             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_current_node));
  __pyx_r = ((PyObject *)__pyx_v_current_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2736
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         cdef _Element current_node = self._next_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.ElementDepthFirstIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_current_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2756
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:
 */

static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  int __pyx_v_node_types;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_nextNodeAnyTag", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2757
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):
 *         cdef int node_types = self._matcher._node_types             # <<<<<<<<<<<<<<
 *         if not node_types:
 *             return NULL
 */
  __pyx_t_1 = __pyx_v_self->_matcher->_node_types;
  __pyx_v_node_types = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2758
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:             # <<<<<<<<<<<<<<
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 */
  __pyx_t_2 = ((!(__pyx_v_node_types != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2759
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:
 *             return NULL             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2760
 *         if not node_types:
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)             # <<<<<<<<<<<<<<
 *         if node_types & (1 << c_node.type):
 *             return c_node
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_self->_top_node->_c_node, __pyx_v_c_node, 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2761
 *             return NULL
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
  __pyx_t_2 = ((__pyx_v_node_types & (1 << __pyx_v_c_node->type)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2762
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if node_types & (1 << c_node.type):
 *             return c_node             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL
 */
    __pyx_r = __pyx_v_c_node;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2763
 *         if node_types & (1 << c_node.type):
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2764
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2756
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         cdef int node_types = self._matcher._node_types
 *         if not node_types:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2767
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):
 */

static xmlNode *__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_nextNodeMatchTag", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2768
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)             # <<<<<<<<<<<<<<
 *         if self._matcher.matches(c_node):
 *             return c_node
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_self->_top_node->_c_node, __pyx_v_c_node, 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2769
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):             # <<<<<<<<<<<<<<
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
  __pyx_t_1 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_c_node) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2770
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):
 *             return c_node             # <<<<<<<<<<<<<<
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL
 */
    __pyx_r = __pyx_v_c_node;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2771
 *         if self._matcher.matches(c_node):
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2772
 *             return c_node
 *         tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef class ElementTextIterator:
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2767
 * 
 *     @cython.final
 *     cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
 *         if self._matcher.matches(c_node):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2786
 *     cdef object _nextEvent
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if with_tail:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_19ElementTextIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_19ElementTextIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_v_with_tail;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_tag,&__pyx_n_s_with_tail,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_tag = values[1];
    if (values[2]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_with_tail = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self), __pyx_v_element, __pyx_v_tag, __pyx_v_with_tail);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_19ElementTextIterator___cinit__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_tag, int __pyx_v_with_tail) {
  PyObject *__pyx_v_events = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2787
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             events = (u"start", u"end")
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2788
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):
 *         _assertValidNode(element)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             events = (u"start", u"end")
 *         else:
 */
  __pyx_t_2 = (__pyx_v_with_tail != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2789
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = (u"start", u"end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = (u"start",)
 */
    __Pyx_INCREF(__pyx_tuple__36);
    __pyx_v_events = __pyx_tuple__36;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2791
 *             events = (u"start", u"end")
 *         else:
 *             events = (u"start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 */
    __Pyx_INCREF(__pyx_tuple__37);
    __pyx_v_events = __pyx_tuple__37;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2792
 *         else:
 *             events = (u"start",)
 *         self._start_element = element             # <<<<<<<<<<<<<<
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(__pyx_v_self->_start_element);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_start_element));
  __pyx_v_self->_start_element = __pyx_v_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2793
 *             events = (u"start",)
 *         self._start_element = element
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_events, __pyx_v_events) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_iterwalk)), __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_next); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_nextEvent);
  __Pyx_DECREF(__pyx_v_self->_nextEvent);
  __pyx_v_self->_nextEvent = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2786
 *     cdef object _nextEvent
 *     cdef _Element _start_element
 *     def __cinit__(self, _Element element not None, tag=None, *, bint with_tail=True):             # <<<<<<<<<<<<<<
 *         _assertValidNode(element)
 *         if with_tail:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2795
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_19ElementTextIterator_2__iter__(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_2__iter__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2796
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2795
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2798
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element element
 *         result = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_19ElementTextIterator_4__next__(((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_19ElementTextIterator_4__next__(struct __pyx_obj_4lxml_5etree_ElementTextIterator *__pyx_v_self) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_event = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2800
 *     def __next__(self):
 *         cdef _Element element
 *         result = None             # <<<<<<<<<<<<<<
 *         while result is None:
 *             event, element = self._nextEvent() # raises StopIteration
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_result = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2801
 *         cdef _Element element
 *         result = None
 *         while result is None:             # <<<<<<<<<<<<<<
 *             event, element = self._nextEvent() # raises StopIteration
 *             if event == u"start":
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_result == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2802
 *         result = None
 *         while result is None:
 *             event, element = self._nextEvent() # raises StopIteration             # <<<<<<<<<<<<<<
 *             if event == u"start":
 *                 result = element.text
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_self->_nextEvent, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_element, ((struct LxmlElement *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2803
 *         while result is None:
 *             event, element = self._nextEvent() # raises StopIteration
 *             if event == u"start":             # <<<<<<<<<<<<<<
 *                 result = element.text
 *             elif element is not self._start_element:
 */
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_event, __pyx_n_u_start, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2804
 *             event, element = self._nextEvent() # raises StopIteration
 *             if event == u"start":
 *                 result = element.text             # <<<<<<<<<<<<<<
 *             elif element is not self._start_element:
 *                 result = element.tail
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_element), __pyx_n_s_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L7;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2805
 *             if event == u"start":
 *                 result = element.text
 *             elif element is not self._start_element:             # <<<<<<<<<<<<<<
 *                 result = element.tail
 *         return result
 */
    __pyx_t_2 = (__pyx_v_element != __pyx_v_self->_start_element);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2806
 *                 result = element.text
 *             elif element is not self._start_element:
 *                 result = element.tail             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_element), __pyx_n_s_tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2807
 *             elif element is not self._start_element:
 *                 result = element.tail
 *         return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2798
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef _Element element
 *         result = None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.ElementTextIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2809
 *         return result
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)
 */

static xmlNode *__pyx_f_4lxml_5etree__createElement(xmlDoc *__pyx_v_c_doc, PyObject *__pyx_v_name_utf) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_createElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2811
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewDocNode(__pyx_v_c_doc, NULL, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2812
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2809
 *         return result
 * 
 * cdef xmlNode* _createElement(xmlDoc* c_doc, object name_utf) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocNode(c_doc, NULL, _xcstr(name_utf), NULL)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2814
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 */

static xmlNode *__pyx_f_4lxml_5etree__createComment(xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_createComment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2816
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text):
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewDocComment(__pyx_v_c_doc, __pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2817
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2814
 *     return c_node
 * 
 * cdef xmlNode* _createComment(xmlDoc* c_doc, const_xmlChar* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocComment(c_doc, text)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2819
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 */

static xmlNode *__pyx_f_4lxml_5etree__createPI(xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_target, const xmlChar *__pyx_v_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_createPI", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2821
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text):
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewDocPI(__pyx_v_c_doc, __pyx_v_target, __pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2822
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name):
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2819
 *     return c_node
 * 
 * cdef xmlNode* _createPI(xmlDoc* c_doc, const_xmlChar* target, const_xmlChar* text):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewDocPI(c_doc, target, text)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2824
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 */

static xmlNode *__pyx_f_4lxml_5etree__createEntity(xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_name) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_createEntity", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2826
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name):
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
  __pyx_v_c_node = xmlNewReference(__pyx_v_c_doc, __pyx_v_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2827
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * # module-level API for ElementTree
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2824
 *     return c_node
 * 
 * cdef xmlNode* _createEntity(xmlDoc* c_doc, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     c_node = tree.xmlNewReference(c_doc, name)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2831
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7Element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_6Element[] = "Element(_tag, attrib=None, nsmap=None, **_extra)\n\n    Element factory.  This function returns an object implementing the\n    Element interface.\n\n    Also look at the `_Element.makeelement()` and\n    `_BaseParser.makeelement()` methods, which provide a faster way to\n    create an Element within a specific document or parser context.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_7Element = {__Pyx_NAMESTR("Element"), (PyCFunction)__pyx_pw_4lxml_5etree_7Element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_6Element)};
static PyObject *__pyx_pw_4lxml_5etree_7Element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Element (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrib);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, pos_args, "Element") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Element", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.Element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_6Element(__pyx_self, __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

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

static PyObject *__pyx_pf_4lxml_5etree_6Element(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Element", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2841
 *     create an Element within a specific document or parser context.
 *     """
 *     return _makeElement(_tag, NULL, None, None, None, None,             # <<<<<<<<<<<<<<
 *                         attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2842
 *     """
 *     return _makeElement(_tag, NULL, None, None, None, None,
 *                         attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * def Comment(text=None):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2831
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2844
 *                         attrib, nsmap, _extra)
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     u"""Comment(text=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9Comment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Comment[] = "Comment(text=None)\n\n    Comment element factory. This factory function creates a special element that will\n    be serialized as an XML comment.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_9Comment = {__Pyx_NAMESTR("Comment"), (PyCFunction)__pyx_pw_4lxml_5etree_9Comment, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Comment)};
static PyObject *__pyx_pw_4lxml_5etree_9Comment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Comment (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Comment") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Comment", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Comment(__pyx_self, __pyx_v_text);

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

static PyObject *__pyx_pf_4lxml_5etree_8Comment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Comment", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2853
 *     cdef xmlNode*  c_node
 *     cdef xmlDoc*   c_doc
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
  __pyx_t_1 = (__pyx_v_text == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2854
 *     cdef xmlDoc*   c_doc
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__15);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__15);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2856
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2857
 *     else:
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2858
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2859
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2860
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2861
 *     c_node = _createComment(c_doc, _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * def ProcessingInstruction(target, text=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2844
 *                         attrib, nsmap, _extra)
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     u"""Comment(text=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.Comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2863
 *     return _elementFactory(doc, c_node)
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     u"""ProcessingInstruction(target, text=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11ProcessingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_10ProcessingInstruction[] = "ProcessingInstruction(target, text=None)\n\n    ProcessingInstruction element factory. This factory function creates a\n    special element that will be serialized as an XML processing instruction.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_11ProcessingInstruction = {__Pyx_NAMESTR("ProcessingInstruction"), (PyCFunction)__pyx_pw_4lxml_5etree_11ProcessingInstruction, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10ProcessingInstruction)};
static PyObject *__pyx_pw_4lxml_5etree_11ProcessingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ProcessingInstruction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_text,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ProcessingInstruction") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ProcessingInstruction", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ProcessingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ProcessingInstruction(__pyx_self, __pyx_v_target, __pyx_v_text);

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

static PyObject *__pyx_pf_4lxml_5etree_10ProcessingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ProcessingInstruction", 0);
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2872
 *     cdef xmlNode*  c_node
 *     cdef xmlDoc*   c_doc
 *     target = _utf8(target)             # <<<<<<<<<<<<<<
 *     if text is None:
 *         text = b''
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2873
 *     cdef xmlDoc*   c_doc
 *     target = _utf8(target)
 *     if text is None:             # <<<<<<<<<<<<<<
 *         text = b''
 *     else:
 */
  __pyx_t_2 = (__pyx_v_text == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2874
 *     target = _utf8(target)
 *     if text is None:
 *         text = b''             # <<<<<<<<<<<<<<
 *     else:
 *         text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__15);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__15);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2876
 *         text = b''
 *     else:
 *         text = _utf8(text)             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2877
 *     else:
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2878
 *         text = _utf8(text)
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2879
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_target), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2880
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2881
 *     c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * PI = ProcessingInstruction
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2863
 *     return _elementFactory(doc, c_node)
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     u"""ProcessingInstruction(target, text=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.ProcessingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2900
 *     """
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):             # <<<<<<<<<<<<<<
 *         self._utf8_data = _utf8(data)
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5CDATA_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5CDATA_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.CDATA.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5CDATA___cinit__(((struct __pyx_obj_4lxml_5etree_CDATA *)__pyx_v_self), __pyx_v_data);

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

static int __pyx_pf_4lxml_5etree_5CDATA___cinit__(struct __pyx_obj_4lxml_5etree_CDATA *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2901
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):
 *         self._utf8_data = _utf8(data)             # <<<<<<<<<<<<<<
 * 
 * def Entity(name):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_utf8_data);
  __Pyx_DECREF(__pyx_v_self->_utf8_data);
  __pyx_v_self->_utf8_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2900
 *     """
 *     cdef bytes _utf8_data
 *     def __cinit__(self, data):             # <<<<<<<<<<<<<<
 *         self._utf8_data = _utf8(data)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.CDATA.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2903
 *         self._utf8_data = _utf8(data)
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     u"""Entity(name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13Entity(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_4lxml_5etree_12Entity[] = "Entity(name)\n\n    Entity factory.  This factory function creates a special element\n    that will be serialized as an XML entity reference or character\n    reference.  Note, however, that entities will not be automatically\n    declared in the document.  A document that uses entity references\n    requires a DTD to define the entities.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_13Entity = {__Pyx_NAMESTR("Entity"), (PyCFunction)__pyx_pw_4lxml_5etree_13Entity, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12Entity)};
static PyObject *__pyx_pw_4lxml_5etree_13Entity(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Entity (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12Entity(__pyx_self, ((PyObject *)__pyx_v_name));

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

static PyObject *__pyx_pf_4lxml_5etree_12Entity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_name_utf = NULL;
  const xmlChar *__pyx_v_c_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Entity", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2915
 *     cdef xmlNode*  c_node
 *     cdef xmlDoc*   c_doc
 *     name_utf = _utf8(name)             # <<<<<<<<<<<<<<
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2916
 *     cdef xmlDoc*   c_doc
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)             # <<<<<<<<<<<<<<
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
 */
  __pyx_v_c_name = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2917
 *     name_utf = _utf8(name)
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 */
  __pyx_t_2 = (((__pyx_v_c_name[0]) == '#') != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2918
 *     c_name = _xcstr(name_utf)
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 *     elif not _xmlNameIsValid(c_name):
 */
    __pyx_t_2 = ((!(__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)) != 0)) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2919
 *     if c_name[0] == c'#':
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, u"Invalid character reference: '%s'" % name             # <<<<<<<<<<<<<<
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 */
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Invalid_character_reference_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2920
 *         if not _characterReferenceIsValid(c_name + 1):
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 *     elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 *     c_doc = _newXMLDoc()
 */
  __pyx_t_2 = ((!(__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name) != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2921
 *             raise ValueError, u"Invalid character reference: '%s'" % name
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, u"Invalid entity reference: '%s'" % name             # <<<<<<<<<<<<<<
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Invalid_entity_reference_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2922
 *     elif not _xmlNameIsValid(c_name):
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 *     c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2923
 *         raise ValueError, u"Invalid entity reference: '%s'" % name
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2924
 *     c_doc = _newXMLDoc()
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)             # <<<<<<<<<<<<<<
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__createEntity(__pyx_v_c_doc, __pyx_v_c_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2925
 *     doc = _documentFactory(c_doc, None)
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2926
 *     c_node = _createEntity(c_doc, c_name)
 *     tree.xmlAddChild(<xmlNode*>c_doc, c_node)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * def SubElement(_Element _parent not None, _tag,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2903
 *         self._utf8_data = _utf8(data)
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     u"""Entity(name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2928
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15SubElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_14SubElement[] = "SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)\n\n    Subelement factory.  This function creates an element instance, and\n    appends it to an existing element.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_15SubElement = {__Pyx_NAMESTR("SubElement"), (PyCFunction)__pyx_pw_4lxml_5etree_15SubElement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14SubElement)};
static PyObject *__pyx_pw_4lxml_5etree_15SubElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v__parent = 0;
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SubElement (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[4] = {0,0,0,0};

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2929
 * 
 * def SubElement(_Element _parent not None, _tag,
 *                attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrib);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, pos_args, "SubElement") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v__parent = ((struct LxmlElement *)values[0]);
    __pyx_v__tag = values[1];
    __pyx_v_attrib = values[2];
    __pyx_v_nsmap = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("SubElement", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.SubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v__parent), __pyx_ptype_4lxml_5etree__Element, 0, "_parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_14SubElement(__pyx_self, __pyx_v__parent, __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2928
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__extra);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_14SubElement(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v__parent, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SubElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2935
 *     appends it to an existing element.
 *     """
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(__pyx_v__parent, __pyx_v__tag, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2928
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.SubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2937
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""ElementTree(element=None, file=None, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17ElementTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_16ElementTree[] = "ElementTree(element=None, file=None, parser=None)\n\n    ElementTree wrapper class.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_17ElementTree = {__Pyx_NAMESTR("ElementTree"), (PyCFunction)__pyx_pw_4lxml_5etree_17ElementTree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_16ElementTree)};
static PyObject *__pyx_pw_4lxml_5etree_17ElementTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_file = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ElementTree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_file,&__pyx_n_s_parser,0};
    PyObject* values[3] = {0,0,0};
    values[0] = (PyObject *)((struct LxmlElement *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ElementTree") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_file = values[1];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ElementTree", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 1, "element", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_16ElementTree(__pyx_self, __pyx_v_element, __pyx_v_file, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_16ElementTree(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_file, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  xmlDoc *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ElementTree", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2949
 *     cdef _Document doc
 * 
 *     if element is not None:             # <<<<<<<<<<<<<<
 *         doc  = element._doc
 *     elif file is not None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_element) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2950
 * 
 *     if element is not None:
 *         doc  = element._doc             # <<<<<<<<<<<<<<
 *     elif file is not None:
 *         try:
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_element->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2951
 *     if element is not None:
 *         doc  = element._doc
 *     elif file is not None:             # <<<<<<<<<<<<<<
 *         try:
 *             doc = _parseDocument(file, parser, None)
 */
  __pyx_t_2 = (__pyx_v_file != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2952
 *         doc  = element._doc
 *     elif file is not None:
 *         try:             # <<<<<<<<<<<<<<
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2953
 *     elif file is not None:
 *         try:
 *             doc = _parseDocument(file, parser, None)             # <<<<<<<<<<<<<<
 *         except _TargetParserResult as result_container:
 *             return result_container.result
 */
        __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, __pyx_v_parser, Py_None)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2953; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
        __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L11_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2954
 *         try:
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *             return result_container.result
 *     else:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        __Pyx_AddTraceback("lxml.etree.ElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_v_result_container = __pyx_t_8;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2955
 *             doc = _parseDocument(file, parser, None)
 *         except _TargetParserResult as result_container:
 *             return result_container.result             # <<<<<<<<<<<<<<
 *     else:
 *         c_doc = _newXMLDoc()
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_except_return;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L5_exception_handled;
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L0;
      __pyx_L5_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L11_try_end:;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2957
 *             return result_container.result
 *     else:
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, parser)
 * 
 */
    __pyx_t_11 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_11;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2958
 *     else:
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     return _elementTreeFactory(doc, element)
 */
    __pyx_t_9 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_9);
    __pyx_t_9 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2960
 *         doc = _documentFactory(c_doc, parser)
 * 
 *     return _elementTreeFactory(doc, element)             # <<<<<<<<<<<<<<
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, __pyx_v_element)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2937
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""ElementTree(element=None, file=None, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.ElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2962
 *     return _elementTreeFactory(doc, element)
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""HTML(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19HTML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_18HTML[] = "HTML(text, parser=None, base_url=None)\n\n    Parses an HTML document from a string constant.  Returns the root\n    node (or the result returned by a parser target).  This function\n    can be used to embed \"HTML literals\" in Python code.\n\n    To override the parser with a different ``HTMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_19HTML = {__Pyx_NAMESTR("HTML"), (PyCFunction)__pyx_pw_4lxml_5etree_19HTML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_18HTML)};
static PyObject *__pyx_pw_4lxml_5etree_19HTML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("HTML (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "HTML") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("HTML", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_18HTML(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_18HTML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("HTML", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2977
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2978
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2979
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 */
    __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), ((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)); 
    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2980
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER             # <<<<<<<<<<<<<<
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));
      __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2981
 *         if not isinstance(parser, HTMLParser):
 *             parser = __DEFAULT_HTML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2982
 *             parser = __DEFAULT_HTML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2982; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2983
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2984
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_result_container = __pyx_t_8;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2985
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L8_except_return;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L12_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2962
 *     return _elementTreeFactory(doc, element)
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""HTML(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.HTML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2987
 *         return result_container.result
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XML(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_20XML[] = "XML(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string constant.\n    Returns the root node (or the result returned by a parser target).\n    This function can be used to embed \"XML literals\" in Python code,\n    like in\n\n       >>> root = XML(\"<root><test/></root>\")\n       >>> print(root.tag)\n       root\n\n    To override the parser with a different ``XMLParser`` you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_21XML = {__Pyx_NAMESTR("XML"), (PyCFunction)__pyx_pw_4lxml_5etree_21XML, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20XML)};
static PyObject *__pyx_pw_4lxml_5etree_21XML(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XML (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "XML") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XML", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_20XML(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_20XML(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XML", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3007
 *     """
 *     cdef _Document doc
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3008
 *     cdef _Document doc
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3009
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):             # <<<<<<<<<<<<<<
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 */
    __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), ((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)); 
    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3010
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER             # <<<<<<<<<<<<<<
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
      __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3011
 *         if not isinstance(parser, XMLParser):
 *             parser = __DEFAULT_XML_PARSER
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3012
 *             parser = __DEFAULT_XML_PARSER
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3012; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3013
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3014
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3014; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3014; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_result_container = __pyx_t_8;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3015
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L8_except_return;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L12_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2987
 *         return result_container.result
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XML(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.XML", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3017
 *         return result_container.result
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""fromstring(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22fromstring[] = "fromstring(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_23fromstring = {__Pyx_NAMESTR("fromstring"), (PyCFunction)__pyx_pw_4lxml_5etree_23fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22fromstring)};
static PyObject *__pyx_pw_4lxml_5etree_23fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromstring (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fromstring") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstring", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_22fromstring(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_22fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstring", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3031
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3032
 *     cdef _Document doc
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)             # <<<<<<<<<<<<<<
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_v_text, __pyx_v_base_url, __pyx_v_parser)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3033
 *     try:
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_doc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3034
 *         doc = _parseMemoryDocument(text, base_url, parser)
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_result_container = __pyx_t_6;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3035
 *         return doc.getroot()
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * def fromstringlist(strings, _BaseParser parser=None):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3017
 *         return result_container.result
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""fromstring(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3037
 *         return result_container.result
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""fromstringlist(strings, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25fromstringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_24fromstringlist[] = "fromstringlist(strings, parser=None)\n\n    Parses an XML document from a sequence of strings.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_25fromstringlist = {__Pyx_NAMESTR("fromstringlist"), (PyCFunction)__pyx_pw_4lxml_5etree_25fromstringlist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24fromstringlist)};
static PyObject *__pyx_pw_4lxml_5etree_25fromstringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_strings = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromstringlist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_strings,&__pyx_n_s_parser,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_strings)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fromstringlist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_strings = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromstringlist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.fromstringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_24fromstringlist(__pyx_self, __pyx_v_strings, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_24fromstringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_v_feed = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstringlist", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3047
 *     """
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):             # <<<<<<<<<<<<<<
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_strings); 
  if (!__pyx_t_1) {
    __pyx_t_2 = PyUnicode_Check(__pyx_v_strings); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3048
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):
 *         raise ValueError("passing a single string into fromstringlist() is not"             # <<<<<<<<<<<<<<
 *                          " efficient, use fromstring() instead")
 *     if parser is None:
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3050
 *         raise ValueError("passing a single string into fromstringlist() is not"
 *                          " efficient, use fromstring() instead")
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3051
 *                          " efficient, use fromstring() instead")
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     feed = parser.feed
 *     for data in strings:
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_4));
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3052
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed             # <<<<<<<<<<<<<<
 *     for data in strings:
 *         feed(data)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_feed); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_feed = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3053
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     feed = parser.feed
 *     for data in strings:             # <<<<<<<<<<<<<<
 *         feed(data)
 *     return parser.close()
 */
  if (PyList_CheckExact(__pyx_v_strings) || PyTuple_CheckExact(__pyx_v_strings)) {
    __pyx_t_4 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_data, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3054
 *     feed = parser.feed
 *     for data in strings:
 *         feed(data)             # <<<<<<<<<<<<<<
 *     return parser.close()
 * 
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_feed, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3055
 *     for data in strings:
 *         feed(data)
 *     return parser.close()             # <<<<<<<<<<<<<<
 * 
 * def iselement(element):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3037
 *         return result_container.result
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""fromstringlist(strings, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.fromstringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_feed);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3057
 *     return parser.close()
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     u"""iselement(element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27iselement(PyObject *__pyx_self, PyObject *__pyx_v_element); /*proto*/
static char __pyx_doc_4lxml_5etree_26iselement[] = "iselement(element)\n\n    Checks if an object appears to be a valid element object.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_27iselement = {__Pyx_NAMESTR("iselement"), (PyCFunction)__pyx_pw_4lxml_5etree_27iselement, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26iselement)};
static PyObject *__pyx_pw_4lxml_5etree_27iselement(PyObject *__pyx_self, PyObject *__pyx_v_element) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iselement (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_26iselement(__pyx_self, ((PyObject *)__pyx_v_element));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3062
 *     Checks if an object appears to be a valid element object.
 *     """
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL             # <<<<<<<<<<<<<<
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, with_tail=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  if (__pyx_t_1) {
    __pyx_t_2 = (((struct LxmlElement *)__pyx_v_element)->_c_node != NULL);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3057
 *     return parser.close()
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     u"""iselement(element)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iselement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3064
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""dump(elem, pretty_print=True, with_tail=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_29dump(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_28dump[] = "dump(elem, pretty_print=True, with_tail=True)\n\n    Writes an element tree or element structure to sys.stdout. This function\n    should be used for debugging only.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_29dump = {__Pyx_NAMESTR("dump"), (PyCFunction)__pyx_pw_4lxml_5etree_29dump, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_28dump)};
static PyObject *__pyx_pw_4lxml_5etree_29dump(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_elem = 0;
  int __pyx_v_pretty_print;
  PyObject *__pyx_v_with_tail = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dump (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_pretty_print,&__pyx_n_s_with_tail,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dump") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_elem = ((struct LxmlElement *)values[0]);
    if (values[1]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_pretty_print = ((int)1);
    }
    __pyx_v_with_tail = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elem), __pyx_ptype_4lxml_5etree__Element, 0, "elem", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_28dump(__pyx_self, __pyx_v_elem, __pyx_v_pretty_print, __pyx_v_with_tail);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_28dump(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElement *__pyx_v_elem, int __pyx_v_pretty_print, PyObject *__pyx_v_with_tail) {
  PyObject *__pyx_v_xml = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dump", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3070
 *     should be used for debugging only.
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail,             # <<<<<<<<<<<<<<
 *                    encoding=u'unicode' if python.IS_PYTHON3 else None)
 *     if not pretty_print:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __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 = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_elem));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_elem));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_elem));
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_pretty_print); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_pretty_print, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_with_tail, __pyx_v_with_tail) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3071
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail,
 *                    encoding=u'unicode' if python.IS_PYTHON3 else None)             # <<<<<<<<<<<<<<
 *     if not pretty_print:
 *         xml += '\n'
 */
  if ((IS_PYTHON3 != 0)) {
    __Pyx_INCREF(__pyx_n_u_unicode);
    __pyx_t_4 = __pyx_n_u_unicode;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_4 = Py_None;
  }
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3070
 *     should be used for debugging only.
 *     """
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail,             # <<<<<<<<<<<<<<
 *                    encoding=u'unicode' if python.IS_PYTHON3 else None)
 *     if not pretty_print:
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_xml = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3072
 *     xml = tostring(elem, pretty_print=pretty_print, with_tail=with_tail,
 *                    encoding=u'unicode' if python.IS_PYTHON3 else None)
 *     if not pretty_print:             # <<<<<<<<<<<<<<
 *         xml += '\n'
 *     sys.stdout.write(xml)
 */
  __pyx_t_5 = ((!(__pyx_v_pretty_print != 0)) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3073
 *                    encoding=u'unicode' if python.IS_PYTHON3 else None)
 *     if not pretty_print:
 *         xml += '\n'             # <<<<<<<<<<<<<<
 *     sys.stdout.write(xml)
 * 
 */
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_xml, __pyx_kp_s__21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_xml, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3074
 *     if not pretty_print:
 *         xml += '\n'
 *     sys.stdout.write(xml)             # <<<<<<<<<<<<<<
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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 = 3074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_xml);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_xml);
  __Pyx_GIVEREF(__pyx_v_xml);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __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_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3064
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""dump(elem, pretty_print=True, with_tail=True)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xml);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3076
 *     sys.stdout.write(xml)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_31tostring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_30tostring[] = "tostring(element_or_tree, encoding=None, method=\"xml\",\n                 xml_declaration=None, pretty_print=False, with_tail=True,\n                 standalone=None, doctype=None,\n                 exclusive=False, with_comments=True, inclusive_ns_prefixes=None)\n\n    Serialize an element to an encoded string representation of its XML\n    tree.\n\n    Defaults to ASCII encoding without XML declaration.  This\n    behaviour can be configured with the keyword arguments 'encoding'\n    (string) and 'xml_declaration' (bool).  Note that changing the\n    encoding to a non UTF-8 compatible encoding will enable a\n    declaration by default.\n\n    You can also serialise to a Unicode string without declaration by\n    passing the ``unicode`` function as encoding (or ``str`` in Py3),\n    or the name 'unicode'.  This changes the return value from a byte\n    string to an unencoded unicode string.\n\n    The keyword argument 'pretty_print' (bool) enables formatted XML.\n\n    The keyword argument 'method' selects the output method: 'xml',\n    'html', plain 'text' (text content without tags) or 'c14n'.\n    Default is 'xml'.\n\n    The ``exclusive`` and ``with_comments`` arguments are only used\n    with C14N output, where they request exclusive and uncommented\n    C14N serialisation respectively.\n\n    Passing a boolean value to the ``standalone`` option will output\n    an XML declaration with the corresponding ``standalone`` flag.\n\n    The ``doctype`` option allows passing in a plain string that will\n    be serialised before the XML tree.  Note that passing in non\n    well-formed content here will make the XML output non well-formed.\n    Also, an existing doctype in the document tree will not be removed\n    when serialising an ElementTree instance.\n\n    You can prevent the tail text of the element from being serialised\n    by passing the boolean ``with_tail`` option.  This has no impact\n    on the tail text of children, which will always be serialised.""\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_31tostring = {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pw_4lxml_5etree_31tostring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_30tostring)};
static PyObject *__pyx_pw_4lxml_5etree_31tostring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_xml_declaration = 0;
  int __pyx_v_pretty_print;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  int __pyx_v_exclusive;
  int __pyx_v_with_comments;
  PyObject *__pyx_v_inclusive_ns_prefixes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostring (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_encoding,&__pyx_n_s_method,&__pyx_n_s_xml_declaration,&__pyx_n_s_pretty_print,&__pyx_n_s_with_tail,&__pyx_n_s_standalone,&__pyx_n_s_doctype,&__pyx_n_s_exclusive,&__pyx_n_s_with_comments,&__pyx_n_s_inclusive_ns_prefixes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_n_u_xml);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3077
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              bint exclusive=False, bint with_comments=True, inclusive_ns_prefixes=None):
 */
    values[3] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3078
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,             # <<<<<<<<<<<<<<
 *              bint exclusive=False, bint with_comments=True, inclusive_ns_prefixes=None):
 *     u"""tostring(element_or_tree, encoding=None, method="xml",
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3079
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 *              bint exclusive=False, bint with_comments=True, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     u"""tostring(element_or_tree, encoding=None, method="xml",
 *                  xml_declaration=None, pretty_print=False, with_tail=True,
 */
    values[10] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 10)) {
        Py_ssize_t index;
        for (index = 1; index < 11 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tostring") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_method = values[2];
    __pyx_v_xml_declaration = values[3];
    if (values[4]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3077
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,             # <<<<<<<<<<<<<<
 *              standalone=None, doctype=None,
 *              bint exclusive=False, bint with_comments=True, inclusive_ns_prefixes=None):
 */
      __pyx_v_pretty_print = ((int)0);
    }
    if (values[5]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_with_tail = ((int)1);
    }
    __pyx_v_standalone = values[6];
    __pyx_v_doctype = values[7];
    if (values[8]) {
      __pyx_v_exclusive = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_exclusive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3079
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 *              bint exclusive=False, bint with_comments=True, inclusive_ns_prefixes=None):             # <<<<<<<<<<<<<<
 *     u"""tostring(element_or_tree, encoding=None, method="xml",
 *                  xml_declaration=None, pretty_print=False, with_tail=True,
 */
      __pyx_v_exclusive = ((int)0);
    }
    if (values[9]) {
      __pyx_v_with_comments = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_with_comments == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_with_comments = ((int)1);
    }
    __pyx_v_inclusive_ns_prefixes = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostring", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_30tostring(__pyx_self, __pyx_v_element_or_tree, __pyx_v_encoding, __pyx_v_method, __pyx_v_xml_declaration, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone, __pyx_v_doctype, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_inclusive_ns_prefixes);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3076
 *     sys.stdout.write(xml)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */

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

static PyObject *__pyx_pf_4lxml_5etree_30tostring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_encoding, PyObject *__pyx_v_method, PyObject *__pyx_v_xml_declaration, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype, int __pyx_v_exclusive, int __pyx_v_with_comments, PyObject *__pyx_v_inclusive_ns_prefixes) {
  int __pyx_v_write_declaration;
  int __pyx_v_is_standalone;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  const char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3125
 *     cdef int is_standalone
 *     # C14N serialisation
 *     if method == 'c14n':             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_c14n, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3126
 *     # C14N serialisation
 *     if method == 'c14n':
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 */
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3127
 *     if method == 'c14n':
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3128
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3129
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *     if not with_comments:
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3130
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__tostringC14N(__pyx_v_element_or_tree, __pyx_v_exclusive, __pyx_v_with_comments, __pyx_v_inclusive_ns_prefixes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3131
 *             raise ValueError("Cannot enable XML declaration in C14N")
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *     if not with_comments:             # <<<<<<<<<<<<<<
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 */
  __pyx_t_2 = ((!(__pyx_v_with_comments != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3132
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3133
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError, \
 */
  __pyx_t_2 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
  if (!__pyx_t_2) {
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_1) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_UNICODE, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3133; __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_1;
    }
    __pyx_t_1 = __pyx_t_6;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3134
 *         raise ValueError("Can only discard comments in C14N serialisation")
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 u"Serialisation to unicode must not request an XML declaration"
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3135
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 u"Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Serialisation_to_unicode_must_no, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3137
 *             raise ValueError, \
 *                 u"Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0             # <<<<<<<<<<<<<<
 *         encoding = _unicode
 *     elif xml_declaration is None:
 */
    __pyx_v_write_declaration = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3138
 *                 u"Serialisation to unicode must not request an XML declaration"
 *         write_declaration = 0
 *         encoding = _unicode             # <<<<<<<<<<<<<<
 *     elif xml_declaration is None:
 *         # by default, write an XML declaration only for non-standard encodings
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree__unicode);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_v_4lxml_5etree__unicode);
    goto __pyx_L7;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3139
 *         write_declaration = 0
 *         encoding = _unicode
 *     elif xml_declaration is None:             # <<<<<<<<<<<<<<
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \
 */
  __pyx_t_1 = (__pyx_v_xml_declaration == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3141
 *     elif xml_declaration is None:
 *         # by default, write an XML declaration only for non-standard encodings
 *         write_declaration = encoding is not None and encoding.upper() not in \             # <<<<<<<<<<<<<<
 *                             (u'ASCII', u'UTF-8', u'UTF8', u'US-ASCII')
 *     else:
 */
    __pyx_t_2 = (__pyx_v_encoding != Py_None);
    if (__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_upper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_ASCII, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_1) {
        __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u_UTF_8, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = __pyx_t_6;
      } else {
        __pyx_t_5 = __pyx_t_1;
      }
      if (__pyx_t_5) {
        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_UTF8, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_6 = __pyx_t_1;
      } else {
        __pyx_t_6 = __pyx_t_5;
      }
      if (__pyx_t_6) {
        __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u_US_ASCII, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_1 = __pyx_t_5;
      } else {
        __pyx_t_1 = __pyx_t_6;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_t_1;
      __pyx_t_1 = __pyx_t_6;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    __pyx_v_write_declaration = __pyx_t_1;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3144
 *                             (u'ASCII', u'UTF-8', u'UTF8', u'US-ASCII')
 *     else:
 *         write_declaration = xml_declaration             # <<<<<<<<<<<<<<
 *     if encoding is None:
 *         encoding = u'ASCII'
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_xml_declaration); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_write_declaration = __pyx_t_1;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3145
 *     else:
 *         write_declaration = xml_declaration
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = u'ASCII'
 *     if standalone is None:
 */
  __pyx_t_1 = (__pyx_v_encoding == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3146
 *         write_declaration = xml_declaration
 *     if encoding is None:
 *         encoding = u'ASCII'             # <<<<<<<<<<<<<<
 *     if standalone is None:
 *         is_standalone = -1
 */
    __Pyx_INCREF(__pyx_n_u_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_u_ASCII);
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3147
 *     if encoding is None:
 *         encoding = u'ASCII'
 *     if standalone is None:             # <<<<<<<<<<<<<<
 *         is_standalone = -1
 *     elif standalone:
 */
  __pyx_t_2 = (__pyx_v_standalone == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3148
 *         encoding = u'ASCII'
 *     if standalone is None:
 *         is_standalone = -1             # <<<<<<<<<<<<<<
 *     elif standalone:
 *         write_declaration = 1
 */
    __pyx_v_is_standalone = -1;
    goto __pyx_L10;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3149
 *     if standalone is None:
 *         is_standalone = -1
 *     elif standalone:             # <<<<<<<<<<<<<<
 *         write_declaration = 1
 *         is_standalone = 1
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3150
 *         is_standalone = -1
 *     elif standalone:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 1
 *     else:
 */
    __pyx_v_write_declaration = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3151
 *     elif standalone:
 *         write_declaration = 1
 *         is_standalone = 1             # <<<<<<<<<<<<<<
 *     else:
 *         write_declaration = 1
 */
    __pyx_v_is_standalone = 1;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3153
 *         is_standalone = 1
 *     else:
 *         write_declaration = 1             # <<<<<<<<<<<<<<
 *         is_standalone = 0
 * 
 */
    __pyx_v_write_declaration = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3154
 *     else:
 *         write_declaration = 1
 *         is_standalone = 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(element_or_tree, _Element):
 */
    __pyx_v_is_standalone = 0;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3156
 *         is_standalone = 0
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3157
 * 
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3159
 *         return _tostring(<_Element>element_or_tree, encoding, doctype, method,
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)             # <<<<<<<<<<<<<<
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 0, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_is_standalone); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3160
 *                          write_declaration, 0, pretty_print, with_tail,
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3161
 *                          is_standalone)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3163
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          encoding, doctype, method, write_declaration, 1,
 *                          pretty_print, with_tail, is_standalone)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_3), __pyx_v_encoding, __pyx_v_doctype, __pyx_v_method, __pyx_v_write_declaration, 1, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_is_standalone); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3166
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \
 *             python._fqtypename(element_or_tree).decode('utf8')             # <<<<<<<<<<<<<<
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):
 */
    __pyx_t_7 = _fqtypename(__pyx_v_element_or_tree);
    __pyx_t_4 = __Pyx_decode_c_string(__pyx_t_7, 0, strlen(__pyx_t_7), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3165
 *                          pretty_print, with_tail, is_standalone)
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(element_or_tree).decode('utf8')
 * 
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Type_s_cannot_be_serialized, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3076
 *     sys.stdout.write(xml)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3168
 *             python._fqtypename(element_or_tree).decode('utf8')
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     u"""tostringlist(element_or_tree, *args, **kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_33tostringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_32tostringlist[] = "tostringlist(element_or_tree, *args, **kwargs)\n\n    Serialize an element to an encoded string representation of its XML\n    tree, stored in a list of partial strings.\n\n    This is purely for ElementTree 1.3 compatibility.  The result is a\n    single string wrapped in a list.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_33tostringlist = {__Pyx_NAMESTR("tostringlist"), (PyCFunction)__pyx_pw_4lxml_5etree_33tostringlist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_32tostringlist)};
static PyObject *__pyx_pw_4lxml_5etree_33tostringlist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostringlist (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "tostringlist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_element_or_tree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tostringlist", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("lxml.etree.tostringlist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_32tostringlist(__pyx_self, __pyx_v_element_or_tree, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_4lxml_5etree_32tostringlist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostringlist", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3177
 *     single string wrapped in a list.
 *     """
 *     return [tostring(element_or_tree, *args, **kwargs)]             # <<<<<<<<<<<<<<
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3177; __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 = 3177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_element_or_tree);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree);
  __Pyx_GIVEREF(__pyx_v_element_or_tree);
  __pyx_t_3 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3168
 *             python._fqtypename(element_or_tree).decode('utf8')
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     u"""tostringlist(element_or_tree, *args, **kwargs)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3179
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_35tounicode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_34tounicode[] = "tounicode(element_or_tree, method=\"xml\", pretty_print=False,\n                  with_tail=True, doctype=None)\n\n    Serialize an element to the Python unicode representation of its XML\n    tree.\n\n    :deprecated: use ``tostring(el, encoding='unicode')`` instead.\n\n    Note that the result does not carry an XML encoding declaration and is\n    therefore not necessarily suited for serialization to byte streams without\n    further treatment.\n\n    The boolean keyword argument 'pretty_print' enables formatted XML.\n\n    The keyword argument 'method' selects the output method: 'xml',\n    'html' or plain 'text'.\n\n    You can prevent the tail text of the element from being serialised\n    by passing the boolean ``with_tail`` option.  This has no impact\n    on the tail text of children, which will always be serialised.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_35tounicode = {__Pyx_NAMESTR("tounicode"), (PyCFunction)__pyx_pw_4lxml_5etree_35tounicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_34tounicode)};
static PyObject *__pyx_pw_4lxml_5etree_35tounicode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_method = 0;
  int __pyx_v_pretty_print;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_doctype = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tounicode (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_method,&__pyx_n_s_pretty_print,&__pyx_n_s_with_tail,&__pyx_n_s_doctype,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_u_xml);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3180
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 4)) {
        Py_ssize_t index;
        for (index = 1; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tounicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_method = values[1];
    if (values[2]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3179
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */
      __pyx_v_pretty_print = ((int)0);
    }
    if (values[3]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3180
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,
 *               bint with_tail=True, doctype=None):             # <<<<<<<<<<<<<<
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 *                   with_tail=True, doctype=None)
 */
      __pyx_v_with_tail = ((int)1);
    }
    __pyx_v_doctype = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tounicode", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.tounicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_34tounicode(__pyx_self, __pyx_v_element_or_tree, __pyx_v_method, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_doctype);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3179
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */

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

static PyObject *__pyx_pf_4lxml_5etree_34tounicode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_method, int __pyx_v_pretty_print, int __pyx_v_with_tail, PyObject *__pyx_v_doctype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tounicode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3202
 *     on the tail text of children, which will always be serialised.
 *     """
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3203
 *     """
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,             # <<<<<<<<<<<<<<
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_4lxml_5etree__unicode;
    __Pyx_INCREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3204
 *     if isinstance(element_or_tree, _Element):
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)             # <<<<<<<<<<<<<<
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_v_element_or_tree), __pyx_t_3, __pyx_v_doctype, __pyx_v_method, 0, 0, __pyx_v_pretty_print, __pyx_v_with_tail, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3205
 *         return _tostring(<_Element>element_or_tree, _unicode, doctype, method,
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):             # <<<<<<<<<<<<<<
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          _unicode, doctype, method, 0, 1, pretty_print,
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3206
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          _unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)((struct LxmlElementTree *)__pyx_v_element_or_tree)->_context_node);
    __Pyx_INCREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3207
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,
 *                          _unicode, doctype, method, 0, 1, pretty_print,             # <<<<<<<<<<<<<<
 *                          with_tail, -1)
 *     else:
 */
    __pyx_t_3 = __pyx_v_4lxml_5etree__unicode;
    __Pyx_INCREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3206
 *                           0, 0, pretty_print, with_tail, -1)
 *     elif isinstance(element_or_tree, _ElementTree):
 *         return _tostring((<_ElementTree>element_or_tree)._context_node,             # <<<<<<<<<<<<<<
 *                          _unicode, doctype, method, 0, 1, pretty_print,
 *                          with_tail, -1)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__tostring(((struct LxmlElement *)__pyx_t_4), __pyx_t_3, __pyx_v_doctype, __pyx_v_method, 0, 1, __pyx_v_pretty_print, __pyx_v_with_tail, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3210
 *                          with_tail, -1)
 *     else:
 *         raise TypeError, u"Type '%s' cannot be serialized." % \             # <<<<<<<<<<<<<<
 *             type(element_or_tree)
 * 
 */
    __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_Type_s_cannot_be_serialized, ((PyObject *)Py_TYPE(__pyx_v_element_or_tree))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3179
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.tounicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3213
 *             type(element_or_tree)
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parse(source, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_37parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_36parse[] = "parse(source, parser=None, base_url=None)\n\n    Return an ElementTree object loaded with source elements.  If no parser\n    is provided as second argument, the default parser is used.\n\n    The ``source`` can be any of the following:\n\n    - a file name/path\n    - a file object\n    - a file-like object\n    - a URL using the HTTP or FTP protocol\n\n    To parse from a string, use the ``fromstring()`` function instead.\n\n    Note that it is generally faster to parse from a file path or URL\n    than from an open file object or file-like object.  Transparent\n    decompression from gzip compressed sources is supported (unless\n    explicitly disabled in libxml2).\n\n    The ``base_url`` keyword allows setting a URL for the document\n    when parsing from a file-like object.  This is needed when looking\n    up external entities (DTD, XInclude, ...) with relative paths.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_37parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pw_4lxml_5etree_37parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_36parse)};
static PyObject *__pyx_pw_4lxml_5etree_37parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[1]);
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_36parse(__pyx_self, __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_36parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_result_container = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3238
 *     """
 *     cdef _Document doc
 *     try:             # <<<<<<<<<<<<<<
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3239
 *     cdef _Document doc
 *     try:
 *         doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, __pyx_v_parser, __pyx_v_base_url)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3240
 *     try:
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)             # <<<<<<<<<<<<<<
 *     except _TargetParserResult as result_container:
 *         return result_container.result
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3241
 *         doc = _parseDocument(source, parser, base_url)
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:             # <<<<<<<<<<<<<<
 *         return result_container.result
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_result_container = __pyx_t_6;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3242
 *         return _elementTreeFactory(doc, None)
 *     except _TargetParserResult as result_container:
 *         return result_container.result             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_result_container, __pyx_n_s_result); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3242; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3213
 *             type(element_or_tree)
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parse(source, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_result_container);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":10
 *     cdef _ReadOnlyProxy _source_proxy
 *     cdef list _dependent_proxies
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_node = NULL
 *         self._free_after_use = 0
 */

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

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

static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy___cinit__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":11
 *     cdef list _dependent_proxies
 *     def __cinit__(self):
 *         self._c_node = NULL             # <<<<<<<<<<<<<<
 *         self._free_after_use = 0
 * 
 */
  __pyx_v_self->_c_node = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":12
 *     def __cinit__(self):
 *         self._c_node = NULL
 *         self._free_after_use = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int _assertNode(self) except -1:
 */
  __pyx_v_self->_free_after_use = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":10
 *     cdef _ReadOnlyProxy _source_proxy
 *     cdef list _dependent_proxies
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_node = NULL
 *         self._free_after_use = 0
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":14
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 */

static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":17
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 *         if not self._c_node:             # <<<<<<<<<<<<<<
 *             raise ReferenceError("Proxy invalidated!")
 *         return 0
 */
  __pyx_t_1 = ((!(__pyx_v_self->_c_node != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":18
 *         """
 *         if not self._c_node:
 *             raise ReferenceError("Proxy invalidated!")             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ReferenceError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":19
 *         if not self._c_node:
 *             raise ReferenceError("Proxy invalidated!")
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int _raise_unsupported_type(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":14
 *         self._free_after_use = 0
 * 
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy._assertNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":21
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)
 * 
 */

static int __pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_unsupported_type", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":22
 * 
 *     cdef int _raise_unsupported_type(self) except -1:
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)             # <<<<<<<<<<<<<<
 * 
 *     cdef void free_after_use(self):
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unsupported_node_type_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":21
 *         return 0
 * 
 *     cdef int _raise_unsupported_type(self) except -1:             # <<<<<<<<<<<<<<
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy._raise_unsupported_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":24
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)
 * 
 *     cdef void free_after_use(self):             # <<<<<<<<<<<<<<
 *         u"""Should the xmlNode* be freed when releasing the proxy?
 *         """
 */

static void __pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("free_after_use", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":27
 *         u"""Should the xmlNode* be freed when releasing the proxy?
 *         """
 *         self._free_after_use = 1             # <<<<<<<<<<<<<<
 * 
 *     property tag:
 */
  __pyx_v_self->_free_after_use = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":24
 *         raise TypeError("Unsupported node type: %d" % self._c_node.type)
 * 
 *     cdef void free_after_use(self):             # <<<<<<<<<<<<<<
 *         u"""Should the xmlNode* be freed when releasing the proxy?
 *         """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":32
 *         u"""Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3tag_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3tag_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_3tag___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":33
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _namespacedName(self._c_node)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":40
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *                 return Entity
 *             else:
 */
  switch (__pyx_v_self->_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":34
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 return _namespacedName(self._c_node)
 *             elif self._c_node.type == tree.XML_PI_NODE:
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":35
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _namespacedName(self._c_node)             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_PI_NODE:
 *                 return ProcessingInstruction
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_self->_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __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;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":36
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _namespacedName(self._c_node)
 *             elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *                 return ProcessingInstruction
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":37
 *                 return _namespacedName(self._c_node)
 *             elif self._c_node.type == tree.XML_PI_NODE:
 *                 return ProcessingInstruction             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 37; __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;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":38
 *             elif self._c_node.type == tree.XML_PI_NODE:
 *                 return ProcessingInstruction
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":39
 *                 return ProcessingInstruction
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return Entity
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __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;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":40
 *             elif self._c_node.type == tree.XML_COMMENT_NODE:
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *                 return Entity
 *             else:
 */
    case XML_ENTITY_REF_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":41
 *                 return Comment
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return Entity             # <<<<<<<<<<<<<<
 *             else:
 *                 self._raise_unsupported_type()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Entity); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 41; __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:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":43
 *                 return Entity
 *             else:
 *                 self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_raise_unsupported_type(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":32
 *         u"""Element tag
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.tag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":49
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":50
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _collectText(self._c_node.children)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":59
 *                 else:
 *                     return funicode(self._c_node.content)
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *                 return u'&%s;' % funicode(self._c_node.name)
 *             else:
 */
  switch (__pyx_v_self->_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":51
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 return _collectText(self._c_node.children)
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":52
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 *                                        tree.XML_COMMENT_NODE):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __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;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":53
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 *                 return _collectText(self._c_node.children)
 *             elif self._c_node.type in (tree.XML_PI_NODE,             # <<<<<<<<<<<<<<
 *                                        tree.XML_COMMENT_NODE):
 *                 if self._c_node.content is NULL:
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":54
 *                 return _collectText(self._c_node.children)
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 *                                        tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *                 if self._c_node.content is NULL:
 *                     return ''
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":55
 *             elif self._c_node.type in (tree.XML_PI_NODE,
 *                                        tree.XML_COMMENT_NODE):
 *                 if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                     return ''
 *                 else:
 */
    __pyx_t_3 = ((__pyx_v_self->_c_node->content == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":56
 *                                        tree.XML_COMMENT_NODE):
 *                 if self._c_node.content is NULL:
 *                     return ''             # <<<<<<<<<<<<<<
 *                 else:
 *                     return funicode(self._c_node.content)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_s__15);
      __pyx_r = __pyx_kp_s__15;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":58
 *                     return ''
 *                 else:
 *                     return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return u'&%s;' % funicode(self._c_node.name)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __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;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":59
 *                 else:
 *                     return funicode(self._c_node.content)
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *                 return u'&%s;' % funicode(self._c_node.name)
 *             else:
 */
    case XML_ENTITY_REF_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":60
 *                     return funicode(self._c_node.content)
 *             elif self._c_node.type == tree.XML_ENTITY_REF_NODE:
 *                 return u'&%s;' % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 *             else:
 *                 self._raise_unsupported_type()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __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;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":62
 *                 return u'&%s;' % funicode(self._c_node.name)
 *             else:
 *                 self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     property tail:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_raise_unsupported_type(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":49
 *         the value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":69
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.next)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4tail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4tail_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4tail___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":70
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.next)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":71
 *         def __get__(self):
 *             self._assertNode()
 *             return _collectText(self._c_node.next)             # <<<<<<<<<<<<<<
 * 
 *     property sourceline:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":69
 *         there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.next)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":76
 *         u"""Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             self._assertNode()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_10sourceline_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_10sourceline_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10sourceline___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  long __pyx_v_line;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":78
 *         def __get__(self):
 *             cdef long line
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":79
 *             cdef long line
 *             self._assertNode()
 *             line = tree.xmlGetLineNo(self._c_node)             # <<<<<<<<<<<<<<
 *             if line > 0:
 *                 return line
 */
  __pyx_v_line = xmlGetLineNo(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":80
 *             self._assertNode()
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:             # <<<<<<<<<<<<<<
 *                 return line
 *             else:
 */
  __pyx_t_2 = ((__pyx_v_line > 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":81
 *             line = tree.xmlGetLineNo(self._c_node)
 *             if line > 0:
 *                 return line             # <<<<<<<<<<<<<<
 *             else:
 *                 return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_line); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":83
 *                 return line
 *             else:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":76
 *         u"""Original line number as found by the parser or None if unknown.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef long line
 *             self._assertNode()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.sourceline.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":85
 *                 return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__repr__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_2__repr__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":86
 * 
 *     def __repr__(self):
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":93
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *             text = self.text
 *             if text:
 */
  switch (__pyx_v_self->_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":87
 *     def __repr__(self):
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":88
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return u"<!--%s-->" % self.text
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __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[5]; __pyx_lineno = 88; __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_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __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[5]; __pyx_lineno = 88; __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);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_Element_s_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":89
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *             return u"<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":90
 *             return u"<Element %s at 0x%x>" % (self.tag, id(self))
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return u"<!--%s-->" % self.text             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":91
 *         elif self._c_node.type == tree.XML_COMMENT_NODE:
 *             return u"<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:             # <<<<<<<<<<<<<<
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 */
    case XML_ENTITY_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":92
 *             return u"<!--%s-->" % self.text
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_3, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":93
 *         elif self._c_node.type == tree.XML_ENTITY_NODE:
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *             text = self.text
 *             if text:
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":94
 *             return u"&%s;" % funicode(self._c_node.name)
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text             # <<<<<<<<<<<<<<
 *             if text:
 *                 return u"<?%s %s?>" % (self.target, text)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_text = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":95
 *         elif self._c_node.type == tree.XML_PI_NODE:
 *             text = self.text
 *             if text:             # <<<<<<<<<<<<<<
 *                 return u"<?%s %s?>" % (self.target, text)
 *             else:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":96
 *             text = self.text
 *             if text:
 *                 return u"<?%s %s?>" % (self.target, text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return u"<?%s?>" % self.target
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __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(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_s_3, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":98
 *                 return u"<?%s %s?>" % (self.target, text)
 *             else:
 *                 return u"<?%s?>" % self.target             # <<<<<<<<<<<<<<
 *         else:
 *             self._raise_unsupported_type()
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_target); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":100
 *                 return u"<?%s?>" % self.target
 *         else:
 *             self._raise_unsupported_type()             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, x):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_raise_unsupported_type(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":85
 *                 return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self._assertNode()
 *         if self._c_node.type == tree.XML_ELEMENT_NODE:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":102
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""Returns the subelement at the given position or the requested
 *         slice.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_4__getitem__[] = "Returns the subelement at the given position or the requested\n        slice.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__getitem__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_4__getitem__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_x) {
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_v_step;
  Py_ssize_t __pyx_v_slicelength;
  Py_ssize_t __pyx_v_c;
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  _node_to_node_function __pyx_v_next_element;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":106
 *         slice.
 *         """
 *         cdef xmlNode* c_node = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t step = 0, slicelength = 0
 *         cdef Py_ssize_t c, i
 */
  __pyx_v_c_node = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":107
 *         """
 *         cdef xmlNode* c_node = NULL
 *         cdef Py_ssize_t step = 0, slicelength = 0             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t c, i
 *         cdef _node_to_node_function next_element
 */
  __pyx_v_step = 0;
  __pyx_v_slicelength = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":111
 *         cdef _node_to_node_function next_element
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         if isinstance(x, slice):
 *             # slicing
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":112
 *         cdef list result
 *         self._assertNode()
 *         if isinstance(x, slice):             # <<<<<<<<<<<<<<
 *             # slicing
 *             if _isFullSlice(<slice>x):
 */
  __pyx_t_2 = PySlice_Check(__pyx_v_x); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":114
 *         if isinstance(x, slice):
 *             # slicing
 *             if _isFullSlice(<slice>x):             # <<<<<<<<<<<<<<
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__isFullSlice(((PyObject*)__pyx_v_x)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":115
 *             # slicing
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)             # <<<<<<<<<<<<<<
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(((((PyObject *)__pyx_v_self)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __pyx_f_4lxml_5etree__collectChildren(((struct LxmlElement *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":116
 *             if _isFullSlice(<slice>x):
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 return []
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__findChildSlice(((PyObject*)__pyx_v_x), __pyx_v_self->_c_node, (&__pyx_v_c_node), (&__pyx_v_step), (&__pyx_v_slicelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":117
 *                 return _collectChildren(self)
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 return []
 *             if step > 0:
 */
    __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":118
 *             _findChildSlice(<slice>x, self._c_node, &c_node, &step, &slicelength)
 *             if c_node is NULL:
 *                 return []             # <<<<<<<<<<<<<<
 *             if step > 0:
 *                 next_element = _nextElement
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":119
 *             if c_node is NULL:
 *                 return []
 *             if step > 0:             # <<<<<<<<<<<<<<
 *                 next_element = _nextElement
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_step > 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":120
 *                 return []
 *             if step > 0:
 *                 next_element = _nextElement             # <<<<<<<<<<<<<<
 *             else:
 *                 step = -step
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__nextElement;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":122
 *                 next_element = _nextElement
 *             else:
 *                 step = -step             # <<<<<<<<<<<<<<
 *                 next_element = _previousElement
 *             result = []
 */
      __pyx_v_step = (-__pyx_v_step);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":123
 *             else:
 *                 step = -step
 *                 next_element = _previousElement             # <<<<<<<<<<<<<<
 *             result = []
 *             c = 0
 */
      __pyx_v_next_element = __pyx_f_4lxml_5etree__previousElement;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":124
 *                 step = -step
 *                 next_element = _previousElement
 *             result = []             # <<<<<<<<<<<<<<
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_result = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":125
 *                 next_element = _previousElement
 *             result = []
 *             c = 0             # <<<<<<<<<<<<<<
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 */
    __pyx_v_c = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":126
 *             result = []
 *             c = 0
 *             while c_node is not NULL and c < slicelength:             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))
 */
    while (1) {
      __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
      if (__pyx_t_2) {
        __pyx_t_3 = ((__pyx_v_c < __pyx_v_slicelength) != 0);
        __pyx_t_5 = __pyx_t_3;
      } else {
        __pyx_t_5 = __pyx_t_2;
      }
      if (!__pyx_t_5) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":127
 *             c = 0
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))             # <<<<<<<<<<<<<<
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_source_proxy);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":128
 *             while c_node is not NULL and c < slicelength:
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __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_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_6), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":129
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 */
      __pyx_v_c = (__pyx_v_c + 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":130
 *                 result.append(_elementFactory(self._doc, c_node))
 *                 c = c + 1
 *                 for i from 0 <= i < step:             # <<<<<<<<<<<<<<
 *                     c_node = next_element(c_node)
 *             return result
 */
      __pyx_t_8 = __pyx_v_step;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":131
 *                 c = c + 1
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)             # <<<<<<<<<<<<<<
 *             return result
 *         else:
 */
        __pyx_v_c_node = __pyx_v_next_element(__pyx_v_c_node);
      }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":132
 *                 for i from 0 <= i < step:
 *                     c_node = next_element(c_node)
 *             return result             # <<<<<<<<<<<<<<
 *         else:
 *             # indexing
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":135
 *         else:
 *             # indexing
 *             c_node = _findChild(self._c_node, x)             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 */
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_node = __pyx_f_4lxml_5etree__findChild(__pyx_v_self->_c_node, __pyx_t_8);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":136
 *             # indexing
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise IndexError, u"list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
    __pyx_t_5 = ((__pyx_v_c_node == NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":137
 *             c_node = _findChild(self._c_node, x)
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_u_list_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":138
 *             if c_node is NULL:
 *                 raise IndexError, u"list index out of range"
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":102
 *             self._raise_unsupported_type()
 * 
 *     def __getitem__(self, x):             # <<<<<<<<<<<<<<
 *         u"""Returns the subelement at the given position or the requested
 *         slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":140
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the number of subelements.
 *         """
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__len__[] = "Returns the number of subelements.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__;
#endif
static Py_ssize_t __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__len__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_6__len__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  Py_ssize_t __pyx_v_c;
  xmlNode *__pyx_v_c_node;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":145
 *         cdef Py_ssize_t c
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c = 0
 *         c_node = self._c_node.children
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":146
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c = 0             # <<<<<<<<<<<<<<
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 */
  __pyx_v_c = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":147
 *         self._assertNode()
 *         c = 0
 *         c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 */
  __pyx_t_2 = __pyx_v_self->_c_node->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":148
 *         c = 0
 *         c_node = self._c_node.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if tree._isElement(c_node):
 *                 c = c + 1
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":149
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 c = c + 1
 *             c_node = c_node.next
 */
    __pyx_t_3 = (_isElement(__pyx_v_c_node) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":150
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 *                 c = c + 1             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         return c
 */
      __pyx_v_c = (__pyx_v_c + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":151
 *             if tree._isElement(c_node):
 *                 c = c + 1
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         return c
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":152
 *                 c = c + 1
 *             c_node = c_node.next
 *         return c             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":140
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the number of subelements.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":154
 *         return c
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__nonzero__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_8__nonzero__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":156
 *     def __nonzero__(self):
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _findChildBackwards(self._c_node, 0)
 *         return c_node != NULL
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":157
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _findChildBackwards(self._c_node, 0)             # <<<<<<<<<<<<<<
 *         return c_node != NULL
 * 
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_self->_c_node, 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":158
 *         self._assertNode()
 *         c_node = _findChildBackwards(self._c_node, 0)
 *         return c_node != NULL             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __pyx_r = (__pyx_v_c_node != NULL);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":154
 *         return c
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_node
 *         self._assertNode()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__[] = "__deepcopy__(self, memo)";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), ((PyObject *)__pyx_v_memo));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":162
 *     def __deepcopy__(self, memo):
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     cpdef __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->__pyx___copy__(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":160
 *         return c_node != NULL
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         u"__deepcopy__(self, memo)"
 *         return self.__copy__()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch) {
  xmlDoc *__pyx_v_c_doc;
  xmlNode *__pyx_v_c_node;
  struct LxmlDocument *__pyx_v_new_doc = 0;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 164; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":169
 *         cdef xmlNode* c_node
 *         cdef _Document new_doc
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 */
  __pyx_t_3 = ((__pyx_v_self->_c_node == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":170
 *         cdef _Document new_doc
 *         if self._c_node is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":171
 *         if self._c_node is NULL:
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive             # <<<<<<<<<<<<<<
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_self->_c_node->doc, __pyx_v_self->_c_node); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":172
 *             return self
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         root = new_doc.getroot()
 *         if root is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":173
 *         c_doc = _copyDocRoot(self._c_node.doc, self._c_node) # recursive
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()             # <<<<<<<<<<<<<<
 *         if root is not None:
 *             return root
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_new_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":174
 *         new_doc = _documentFactory(c_doc, None)
 *         root = new_doc.getroot()
 *         if root is not None:             # <<<<<<<<<<<<<<
 *             return root
 *         # Comment/PI
 */
  __pyx_t_3 = (__pyx_v_root != Py_None);
  __pyx_t_5 = (__pyx_t_3 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":175
 *         root = new_doc.getroot()
 *         if root is not None:
 *             return root             # <<<<<<<<<<<<<<
 *         # Comment/PI
 *         c_node = c_doc.children
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_root);
    __pyx_r = __pyx_v_root;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":177
 *             return root
 *         # Comment/PI
 *         c_node = c_doc.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 */
  __pyx_t_6 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":178
 *         # Comment/PI
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         if c_node is NULL:
 */
  while (1) {
    __pyx_t_5 = ((__pyx_v_c_node != NULL) != 0);
    if (__pyx_t_5) {
      __pyx_t_3 = ((__pyx_v_c_node->type != __pyx_v_self->_c_node->type) != 0);
      __pyx_t_7 = __pyx_t_3;
    } else {
      __pyx_t_7 = __pyx_t_5;
    }
    if (!__pyx_t_7) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":179
 *         c_node = c_doc.children
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         if c_node is NULL:
 *             return None
 */
    __pyx_t_6 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_6;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":180
 *         while c_node is not NULL and c_node.type != self._c_node.type:
 *             c_node = c_node.next
 *         if c_node is NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return _elementFactory(new_doc, c_node)
 */
  __pyx_t_7 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":181
 *             c_node = c_node.next
 *         if c_node is NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return _elementFactory(new_doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":182
 *         if c_node is NULL:
 *             return None
 *         return _elementFactory(new_doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_new_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":164
 *         return self.__copy__()
 * 
 *     cpdef __copy__(self):             # <<<<<<<<<<<<<<
 *         u"__copy__(self)"
 *         cdef xmlDoc* c_doc
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_doc);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12__copy__[] = "__copy__(self)";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12__copy__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_12__copy__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->__pyx___copy__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":184
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.getchildren())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_14__iter__(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_14__iter__(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":185
 * 
 *     def __iter__(self):
 *         return iter(self.getchildren())             # <<<<<<<<<<<<<<
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->getchildren(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":184
 *         return _elementFactory(new_doc, c_node)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.getchildren())
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, reversed=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren[] = "iterchildren(self, tag=None, reversed=False)\n\n        Iterate over the children of this element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_reversed = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterchildren (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_reversed,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterchildren") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_reversed = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterchildren", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_16iterchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self), __pyx_v_tag, __pyx_v_reversed);

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_16iterchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_reversed) {
  PyObject *__pyx_v_children = NULL;
  PyObject *__pyx_v_el = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterchildren", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":192
 *         Iterate over the children of this element.
 *         """
 *         children = self.getchildren()             # <<<<<<<<<<<<<<
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->getchildren(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_children = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":193
 *         """
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':             # <<<<<<<<<<<<<<
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 */
  __pyx_t_2 = (__pyx_v_tag != Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_tag, __pyx_kp_s__34, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":194
 *         children = self.getchildren()
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]             # <<<<<<<<<<<<<<
 *         if reversed:
 *             children = children[::-1]
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyList_CheckExact(__pyx_v_children) || PyTuple_CheckExact(__pyx_v_children)) {
      __pyx_t_5 = __pyx_v_children; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_el, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_v_tag, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_4) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_el))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_children, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":195
 *         if tag is not None and tag != '*':
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:             # <<<<<<<<<<<<<<
 *             children = children[::-1]
 *         return iter(children)
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_reversed); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":196
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 *             children = children[::-1]             # <<<<<<<<<<<<<<
 *         return iter(children)
 * 
 */
    __pyx_t_1 = PyObject_GetItem(__pyx_v_children, __pyx_slice__43); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_children, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":197
 *         if reversed:
 *             children = children[::-1]
 *         return iter(children)             # <<<<<<<<<<<<<<
 * 
 *     cpdef getchildren(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(__pyx_v_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":187
 *         return iter(self.getchildren())
 * 
 *     def iterchildren(self, tag=None, *, reversed=False):             # <<<<<<<<<<<<<<
 *         u"""iterchildren(self, tag=None, reversed=False)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.iterchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_children);
  __Pyx_XDECREF(__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""Returns all subelements. The elements are returned in document
 *         order.
 */

static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self, int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getchildren", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getchildren); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":205
 *         cdef xmlNode* c_node
 *         cdef list result
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         result = []
 *         c_node = self._c_node.children
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":206
 *         cdef list result
 *         self._assertNode()
 *         result = []             # <<<<<<<<<<<<<<
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":207
 *         self._assertNode()
 *         result = []
 *         c_node = self._c_node.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 */
  __pyx_t_4 = __pyx_v_self->_c_node->children;
  __pyx_v_c_node = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":208
 *         result = []
 *         c_node = self._c_node.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 */
  while (1) {
    __pyx_t_5 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_5) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":209
 *         c_node = self._c_node.children
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):             # <<<<<<<<<<<<<<
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
 */
    __pyx_t_5 = (_isElement(__pyx_v_c_node) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":210
 *         while c_node is not NULL:
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 *         return result
 */
      __pyx_t_1 = ((PyObject *)__pyx_v_self->_source_proxy);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1), __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":211
 *             if tree._isElement(c_node):
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    __pyx_t_4 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":212
 *                 result.append(_newReadOnlyProxy(self._source_proxy, c_node))
 *             c_node = c_node.next
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":199
 *         return iter(children)
 * 
 *     cpdef getchildren(self):             # <<<<<<<<<<<<<<
 *         u"""Returns all subelements. The elements are returned in document
 *         order.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_18getchildren[] = "Returns all subelements. The elements are returned in document\n        order.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getchildren (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_18getchildren(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_18getchildren(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getchildren", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->getchildren(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getchildren", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the parent of this element or None for the root element.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent[] = "Returns the parent of this element or None for the root element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_20getparent(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_20getparent(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_parent;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getparent", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":218
 *         """
 *         cdef xmlNode* c_parent
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":219
 *         cdef xmlNode* c_parent
 *         self._assertNode()
 *         c_parent = self._c_node.parent             # <<<<<<<<<<<<<<
 *         if c_parent is NULL or not tree._isElement(c_parent):
 *             return None
 */
  __pyx_t_2 = __pyx_v_self->_c_node->parent;
  __pyx_v_c_parent = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":220
 *         self._assertNode()
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):             # <<<<<<<<<<<<<<
 *             return None
 *         else:
 */
  __pyx_t_3 = ((__pyx_v_c_parent == NULL) != 0);
  if (!__pyx_t_3) {
    __pyx_t_4 = ((!(_isElement(__pyx_v_c_parent) != 0)) != 0);
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":221
 *         c_parent = self._c_node.parent
 *         if c_parent is NULL or not tree._isElement(c_parent):
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":223
 *             return None
 *         else:
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def getnext(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_6), __pyx_v_c_parent)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":214
 *         return result
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the parent of this element or None for the root element.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getparent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the following sibling of this element or None.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext[] = "Returns the following sibling of this element or None.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getnext (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_22getnext(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_22getnext(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getnext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":229
 *         """
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":230
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__nextElement(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":231
 *         self._assertNode()
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
 */
  __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":232
 *         c_node = _nextElement(self._c_node)
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":233
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def getprevious(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":225
 *             return _newReadOnlyProxy(self._source_proxy, c_parent)
 * 
 *     def getnext(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the following sibling of this element or None.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the preceding sibling of this element or None.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious[] = "Returns the preceding sibling of this element or None.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getprevious (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_ReadOnlyProxy_24getprevious(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_ReadOnlyProxy_24getprevious(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getprevious", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":239
 *         """
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self->__pyx_vtab)->_assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":240
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)             # <<<<<<<<<<<<<<
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__previousElement(__pyx_v_self->_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":241
 *         self._assertNode()
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:             # <<<<<<<<<<<<<<
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None
 */
  __pyx_t_2 = ((__pyx_v_c_node != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":242
 *         c_node = _previousElement(self._c_node)
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_source_proxy);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":243
 *         if c_node is not NULL:
 *             return _newReadOnlyProxy(self._source_proxy, c_node)
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":235
 *         return None
 * 
 *     def getprevious(self):             # <<<<<<<<<<<<<<
 *         u"""Returns the preceding sibling of this element or None.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyProxy.getprevious", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":251
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_16_ReadOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_16_ReadOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_16_ReadOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":252
 *     property target:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":253
 *         def __get__(self):
 *             self._assertNode()
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":251
 *     u"A read-only proxy for processing instructions (for internal use only!)"
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyPIProxy.target.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":260
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":261
 *     property name:
 *         def __get__(self):
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":260
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":263
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if u'&' in value or u';' in value:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_2__set__(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_value_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":264
 * 
 *         def __set__(self, value):
 *             value_utf = _utf8(value)             # <<<<<<<<<<<<<<
 *             if u'&' in value or u';' in value:
 *                 raise ValueError(u"Invalid entity name '%s'" % value)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":265
 *         def __set__(self, value):
 *             value_utf = _utf8(value)
 *             if u'&' in value or u';' in value:             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"Invalid entity name '%s'" % value)
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_kp_u__24, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(__pyx_t_2 != 0)) {
    __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_kp_u__25, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = (__pyx_t_3 != 0);
  } else {
    __pyx_t_4 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":266
 *             value_utf = _utf8(value)
 *             if u'&' in value or u';' in value:
 *                 raise ValueError(u"Invalid entity name '%s'" % value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))
 * 
 */
    __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Invalid_entity_name_s, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":267
 *             if u'&' in value or u';' in value:
 *                 raise ValueError(u"Invalid entity name '%s'" % value)
 *             tree.xmlNodeSetName(self._c_node, _xcstr(value_utf))             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base._c_node, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value_utf));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":263
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value_utf = _utf8(value)
 *             if u'&' in value or u';' in value:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":270
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20_ReadOnlyEntityProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":271
 *     property text:
 *         def __get__(self):
 *             return u'&%s;' % funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_s_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":270
 * 
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return u'&%s;' % funicode(self._c_node.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyEntityProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":279
 * 
 *     property attrib:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return dict(_collectAttributes(self._c_node, 3))
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6attrib_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6attrib_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6attrib___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":280
 *     property attrib:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return dict(_collectAttributes(self._c_node, 3))
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":281
 *         def __get__(self):
 *             self._assertNode()
 *             return dict(_collectAttributes(self._c_node, 3))             # <<<<<<<<<<<<<<
 * 
 *     property prefix:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __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[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":279
 * 
 *     property attrib:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return dict(_collectAttributes(self._c_node, 3))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.attrib.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":286
 *         u"""Namespace prefix or None.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6prefix___get__(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":287
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":288
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:             # <<<<<<<<<<<<<<
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 */
  __pyx_t_2 = ((__pyx_v_self->__pyx_base._c_node->ns != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":289
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:             # <<<<<<<<<<<<<<
 *                     return funicode(self._c_node.ns.prefix)
 *             return None
 */
    __pyx_t_2 = ((__pyx_v_self->__pyx_base._c_node->ns->prefix != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":290
 *             if self._c_node.ns is not NULL:
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->ns->prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":291
 *                 if self._c_node.ns.prefix is not NULL:
 *                     return funicode(self._c_node.ns.prefix)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":286
 *         u"""Namespace prefix or None.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.ns is not NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":293
 *             return None
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""Gets an element attribute.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get[] = "Gets an element attribute.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_get(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":296
 *         u"""Gets an element attribute.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":297
 *         """
 *         self._assertNode()
 *         return _getNodeAttributeValue(self._c_node, key, default)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getNodeAttributeValue(__pyx_v_self->__pyx_base._c_node, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":293
 *             return None
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         u"""Gets an element attribute.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":299
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"""Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys[] = "Gets a list of attribute names. The names are returned in an\n        arbitrary order (just like for an ordinary Python dictionary).\n        ";
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2keys(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_2keys(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":303
 *         arbitrary order (just like for an ordinary Python dictionary).
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 1)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":304
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 1)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":299
 *         return _getNodeAttributeValue(self._c_node, key, default)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         u"""Gets a list of attribute names. The names are returned in an
 *         arbitrary order (just like for an ordinary Python dictionary).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":306
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"""Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values[] = "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4values(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_4values(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":310
 *         in an arbitrary order.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 2)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":311
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 2)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":306
 *         return _collectAttributes(self._c_node, 1)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         u"""Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":313
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"""Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items[] = "Gets element attributes, as a sequence. The attributes are returned\n        in an arbitrary order.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6items(((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ReadOnlyElementProxy_6items(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":317
 *         in an arbitrary order.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         return _collectAttributes(self._c_node, 3)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":318
 *         """
 *         self._assertNode()
 *         return _collectAttributes(self._c_node, 3)             # <<<<<<<<<<<<<<
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_self->__pyx_base._c_node, 3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":313
 *         return _collectAttributes(self._c_node, 2)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         u"""Gets element attributes, as a sequence. The attributes are returned
 *         in an arbitrary order.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ReadOnlyElementProxy.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":320
 *         return _collectAttributes(self._c_node, 3)
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 */

static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newReadOnlyProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":327
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,             # <<<<<<<<<<<<<<
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
 */
  switch (__pyx_v_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":323
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":324
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyElementProxy)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":325
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":326
 *         el = _ReadOnlyElementProxy.__new__(_ReadOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyPIProxy)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":327
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,             # <<<<<<<<<<<<<<
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":328
 *         el = _ReadOnlyPIProxy.__new__(_ReadOnlyPIProxy)
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):             # <<<<<<<<<<<<<<
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
 *     else:
 */
    case XML_ENTITY_REF_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":329
 *     elif c_node.type in (tree.XML_COMMENT_NODE,
 *                          tree.XML_ENTITY_REF_NODE):
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyProxy)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":331
 *         el = _ReadOnlyProxy.__new__(_ReadOnlyProxy)
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unsupported_element_type_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 331; __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[5]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 331; __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, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":332
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
 */
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":333
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":334
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el             # <<<<<<<<<<<<<<
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_el));
  __pyx_r = __pyx_v_el;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":320
 *         return _collectAttributes(self._c_node, 3)
 * 
 * cdef _ReadOnlyProxy _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._newReadOnlyProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":336
 *     return el
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,             # <<<<<<<<<<<<<<
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__initReadOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el, struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initReadOnlyProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":338
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:             # <<<<<<<<<<<<<<
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_source_proxy) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":339
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
 *         el._source_proxy = el             # <<<<<<<<<<<<<<
 *         el._dependent_proxies = [el]
 *     else:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_el));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_el));
    __Pyx_GOTREF(__pyx_v_el->_source_proxy);
    __Pyx_DECREF(((PyObject *)__pyx_v_el->_source_proxy));
    __pyx_v_el->_source_proxy = __pyx_v_el;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":340
 *     if source_proxy is None:
 *         el._source_proxy = el
 *         el._dependent_proxies = [el]             # <<<<<<<<<<<<<<
 *     else:
 *         el._source_proxy = source_proxy
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_el));
    PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_el));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_el));
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_el->_dependent_proxies);
    __Pyx_DECREF(__pyx_v_el->_dependent_proxies);
    __pyx_v_el->_dependent_proxies = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":342
 *         el._dependent_proxies = [el]
 *     else:
 *         el._source_proxy = source_proxy             # <<<<<<<<<<<<<<
 *         source_proxy._dependent_proxies.append(el)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_source_proxy));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_source_proxy));
    __Pyx_GOTREF(__pyx_v_el->_source_proxy);
    __Pyx_DECREF(((PyObject *)__pyx_v_el->_source_proxy));
    __pyx_v_el->_source_proxy = __pyx_v_source_proxy;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":343
 *     else:
 *         el._source_proxy = source_proxy
 *         source_proxy._dependent_proxies.append(el)             # <<<<<<<<<<<<<<
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):
 */
    if (unlikely(__pyx_v_source_proxy->_dependent_proxies == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_source_proxy->_dependent_proxies, ((PyObject *)__pyx_v_el)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":336
 *     return el
 * 
 * cdef inline _initReadOnlyProxy(_ReadOnlyProxy el,             # <<<<<<<<<<<<<<
 *                                _ReadOnlyProxy source_proxy):
 *     if source_proxy is None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._initReadOnlyProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":345
 *         source_proxy._dependent_proxies.append(el)
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 */

static PyObject *__pyx_f_4lxml_5etree__freeReadOnlyProxies(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_sourceProxy) {
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  xmlNode *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_freeReadOnlyProxies", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":348
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:             # <<<<<<<<<<<<<<
 *         return
 *     if sourceProxy._dependent_proxies is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_sourceProxy) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":349
 *     cdef _ReadOnlyProxy el
 *     if sourceProxy is None:
 *         return             # <<<<<<<<<<<<<<
 *     if sourceProxy._dependent_proxies is None:
 *         return
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":350
 *     if sourceProxy is None:
 *         return
 *     if sourceProxy._dependent_proxies is None:             # <<<<<<<<<<<<<<
 *         return
 *     for el in sourceProxy._dependent_proxies:
 */
  __pyx_t_2 = (__pyx_v_sourceProxy->_dependent_proxies == ((PyObject*)Py_None));
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":351
 *         return
 *     if sourceProxy._dependent_proxies is None:
 *         return             # <<<<<<<<<<<<<<
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":352
 *     if sourceProxy._dependent_proxies is None:
 *         return
 *     for el in sourceProxy._dependent_proxies:             # <<<<<<<<<<<<<<
 *         c_node = el._c_node
 *         el._c_node = NULL
 */
  if (unlikely(__pyx_v_sourceProxy->_dependent_proxies == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __pyx_v_sourceProxy->_dependent_proxies; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__ReadOnlyProxy))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_el, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":353
 *         return
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node             # <<<<<<<<<<<<<<
 *         el._c_node = NULL
 *         if el._free_after_use:
 */
    __pyx_t_6 = __pyx_v_el->_c_node;
    __pyx_v_c_node = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":354
 *     for el in sourceProxy._dependent_proxies:
 *         c_node = el._c_node
 *         el._c_node = NULL             # <<<<<<<<<<<<<<
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)
 */
    __pyx_v_el->_c_node = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":355
 *         c_node = el._c_node
 *         el._c_node = NULL
 *         if el._free_after_use:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]
 */
    __pyx_t_1 = (__pyx_v_el->_free_after_use != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":356
 *         el._c_node = NULL
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)             # <<<<<<<<<<<<<<
 *     del sourceProxy._dependent_proxies[:]
 * 
 */
      xmlFreeNode(__pyx_v_c_node);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":357
 *         if el._free_after_use:
 *             tree.xmlFreeNode(c_node)
 *     del sourceProxy._dependent_proxies[:]             # <<<<<<<<<<<<<<
 * 
 * # opaque wrapper around non-element nodes, e.g. the document node
 */
  if (unlikely(__pyx_v_sourceProxy->_dependent_proxies == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_sourceProxy->_dependent_proxies, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":345
 *         source_proxy._dependent_proxies.append(el)
 * 
 * cdef _freeReadOnlyProxies(_ReadOnlyProxy sourceProxy):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy el
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._freeReadOnlyProxies", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":367
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, u"This type cannot be instantiated from Python"
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_18_OpaqueNodeWrapper___init__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":368
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):
 *         raise TypeError, u"This type cannot be instantiated from Python"             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_This_type_cannot_be_instantiated, 0, 0);
  {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":367
 * cdef class _OpaqueNodeWrapper:
 *     cdef tree.xmlNode* _c_node
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError, u"This type cannot be instantiated from Python"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._OpaqueNodeWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":373
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 */

static int __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":376
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 *         assert self._c_node is not NULL, u"Proxy invalidated!"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base._c_node != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Proxy_invalidated);
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":377
 *         """
 *         assert self._c_node is not NULL, u"Proxy invalidated!"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, other_element):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":373
 * @cython.internal
 * cdef class _OpaqueDocumentWrapper(_OpaqueNodeWrapper):
 *     cdef int _assertNode(self) except -1:             # <<<<<<<<<<<<<<
 *         u"""This is our way of saying: this proxy is invalid!
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper._assertNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":379
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element, CYTHON_UNUSED int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":384
 *         cdef xmlNode* c_next
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":385
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":386
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, u"cannot append, document already has a root element"
 */
  __pyx_t_3 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":387
 *         c_node = _roNodeOf(other_element)
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 */
    __pyx_t_3 = ((xmlDocGetRootElement(((xmlDoc *)__pyx_v_self->__pyx_base._c_node)) != NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":388
 *         if c_node.type == tree.XML_ELEMENT_NODE:
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, u"cannot append, document already has a root element"             # <<<<<<<<<<<<<<
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_cannot_append_document_already_h, 0, 0);
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":389
 *             if tree.xmlDocGetRootElement(<tree.xmlDoc*>self._c_node) is not NULL:
 *                 raise ValueError, u"cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 */
  switch (__pyx_v_c_node->type) {
    case XML_PI_NODE:
    case XML_COMMENT_NODE:
    __pyx_t_3 = 0;
    break;
    default:
    __pyx_t_3 = 1;
    break;
  }
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":390
 *                 raise ValueError, u"cannot append, document already has a root element"
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
 */
    __pyx_t_5 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unsupported_element_type_for_top, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":391
 *         elif c_node.type not in (tree.XML_PI_NODE, tree.XML_COMMENT_NODE):
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)             # <<<<<<<<<<<<<<
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, ((xmlDoc *)__pyx_v_self->__pyx_base._c_node)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":392
 *             raise TypeError, u"unsupported element type for top-level node: %d" % c_node.type
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)
 */
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":393
 *         c_node = _copyNodeToDoc(c_node, <tree.xmlDoc*>self._c_node)
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 * 
 */
  xmlAddChild(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":394
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":379
 *         return 0
 * 
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static char __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append[] = "Append a copy of an Element to the list of children.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), ((PyObject *)__pyx_v_other_element));

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

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_append(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(__pyx_v_self, __pyx_v_other_element, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":396
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of all Elements from a sequence to the list of
 *         children.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/
static char __pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend[] = "Append a copy of all Elements from a sequence to the list of\n        children.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)__pyx_v_self), ((PyObject *)__pyx_v_elements));

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

static PyObject *__pyx_pf_4lxml_5etree_22_OpaqueDocumentWrapper_2extend(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":400
 *         children.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             self.append(element)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":401
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":402
 *         self._assertNode()
 *         for element in elements:
 *             self.append(element)             # <<<<<<<<<<<<<<
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append(__pyx_v_self, __pyx_v_element, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 402; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":396
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of all Elements from a sequence to the list of
 *         children.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._OpaqueDocumentWrapper.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":404
 *             self.append(element)
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 */

static struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_v_node = 0;
  struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newOpaqueAppendOnlyNodeWrapper", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":406
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)
 *     else:
 */
  switch (__pyx_v_c_node->type) {
    case XML_DOCUMENT_NODE:
    case XML_HTML_DOCUMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":407
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)             # <<<<<<<<<<<<<<
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":409
 *         node = _OpaqueDocumentWrapper.__new__(_OpaqueDocumentWrapper)
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)             # <<<<<<<<<<<<<<
 *     node._c_node = c_node
 *     return node
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":410
 *     else:
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
 *     node._c_node = c_node             # <<<<<<<<<<<<<<
 *     return node
 * 
 */
  __pyx_v_node->_c_node = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":411
 *         node = _OpaqueNodeWrapper.__new__(_OpaqueNodeWrapper)
 *     node._c_node = c_node
 *     return node             # <<<<<<<<<<<<<<
 * 
 * # element proxies that allow restricted modification
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":404
 *             self.append(element)
 * 
 * cdef _OpaqueNodeWrapper _newOpaqueAppendOnlyNodeWrapper(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef _OpaqueNodeWrapper node
 *     if c_node.type in (tree.XML_DOCUMENT_NODE, tree.XML_HTML_DOCUMENT_NODE):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._newOpaqueAppendOnlyNodeWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":420
 *     """
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.content is NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":421
 *     property text:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if self._c_node.content is NULL:
 *                 return ''
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":422
 *         def __get__(self):
 *             self._assertNode()
 *             if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_2 = ((__pyx_v_self->__pyx_base._c_node->content == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":423
 *             self._assertNode()
 *             if self._c_node.content is NULL:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return funicode(self._c_node.content)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s__15);
    __pyx_r = __pyx_kp_s__15;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":425
 *                 return ''
 *             else:
 *                 return funicode(self._c_node.content)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base._c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":420
 *     """
 *     property text:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if self._c_node.content is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":427
 *                 return funicode(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_2__set__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_23_ModifyContentOnlyProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":429
 *         def __set__(self, value):
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":430
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
 *             if value is None:             # <<<<<<<<<<<<<<
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 */
  __pyx_t_2 = (__pyx_v_value == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":431
 *             self._assertNode()
 *             if value is None:
 *                 c_text = <const_xmlChar*>NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 value = _utf8(value)
 */
    __pyx_v_c_text = ((const xmlChar *)NULL);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":433
 *                 c_text = <const_xmlChar*>NULL
 *             else:
 *                 value = _utf8(value)             # <<<<<<<<<<<<<<
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":434
 *             else:
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetContent(self._c_node, c_text)
 * 
 */
    __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":435
 *                 value = _utf8(value)
 *                 c_text = _xcstr(value)
 *             tree.xmlNodeSetContent(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  xmlNodeSetContent(__pyx_v_self->__pyx_base._c_node, __pyx_v_c_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":427
 *                 return funicode(self._c_node.content)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef tree.xmlDict* c_dict
 *             self._assertNode()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyProxy.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":444
 *     """
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":445
 *     property target:
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":446
 *         def __get__(self):
 *             self._assertNode()
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":444
 *     """
 *     property target:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return funicode(self._c_node.name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyPIProxy.target.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":448
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             value = _utf8(value)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_2__set__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":449
 * 
 *         def __set__(self, value):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":450
 *         def __set__(self, value):
 *             self._assertNode()
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":451
 *             self._assertNode()
 *             value = _utf8(value)
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":452
 *             value = _utf8(value)
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":448
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             value = _utf8(value)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyPIProxy.target.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":459
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name___get__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":460
 *     property name:
 *         def __get__(self):
 *             return funicode(self._c_node.name)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->__pyx_base.__pyx_base._c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":459
 *     u"A read-only proxy for entity references (for internal use only!)"
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyEntityProxy.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":462
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_2__set__(((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_2__set__(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  const xmlChar *__pyx_v_c_text;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":463
 * 
 *         def __set__(self, value):
 *             value = _utf8(value)             # <<<<<<<<<<<<<<
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":464
 *         def __set__(self, value):
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \             # <<<<<<<<<<<<<<
 *                 u"Invalid entity name '%s'" % value
 *             c_text = _xcstr(value)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_kp_u__24, __pyx_v_value, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if ((__pyx_t_2 != 0)) {
      __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_kp_u__25, __pyx_v_value, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = (__pyx_t_3 != 0);
    } else {
      __pyx_t_4 = (__pyx_t_2 != 0);
    }
    if (unlikely(!__pyx_t_4)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":465
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value             # <<<<<<<<<<<<<<
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)
 */
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Invalid_entity_name_s, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":466
 *             assert u'&' not in value and u';' not in value, \
 *                 u"Invalid entity name '%s'" % value
 *             c_text = _xcstr(value)             # <<<<<<<<<<<<<<
 *             tree.xmlNodeSetName(self._c_node, c_text)
 * 
 */
  __pyx_v_c_text = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":467
 *                 u"Invalid entity name '%s'" % value
 *             c_text = _xcstr(value)
 *             tree.xmlNodeSetName(self._c_node, c_text)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  xmlNodeSetName(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":462
 *             return funicode(self._c_node.name)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             value = _utf8(value)
 *             assert u'&' not in value and u';' not in value, \
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ModifyContentOnlyEntityProxy.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":476
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element, CYTHON_UNUSED int __pyx_skip_dispatch) {
  xmlNode *__pyx_v_c_next;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":481
 *         cdef xmlNode* c_next
 *         cdef xmlNode* c_node
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":482
 *         cdef xmlNode* c_node
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)             # <<<<<<<<<<<<<<
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_other_element); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":483
 *         self._assertNode()
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)             # <<<<<<<<<<<<<<
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_node, __pyx_v_self->__pyx_base.__pyx_base._c_node->doc); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":484
 *         c_node = _roNodeOf(other_element)
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)
 */
  __pyx_t_2 = __pyx_v_c_node->next;
  __pyx_v_c_next = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":485
 *         c_node = _copyNodeToDoc(c_node, self._c_node.doc)
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)             # <<<<<<<<<<<<<<
 *         _moveTail(c_next, c_node)
 * 
 */
  xmlAddChild(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":486
 *         c_next = c_node.next
 *         tree.xmlAddChild(self._c_node, c_node)
 *         _moveTail(c_next, c_node)             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, elements):
 */
  __pyx_f_4lxml_5etree__moveTail(__pyx_v_c_next, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":476
 *     text content (i.e. everything that adds to the subtree).
 *     """
 *     cpdef append(self, other_element):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of an Element to the list of children.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element); /*proto*/
static char __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append[] = "Append a copy of an Element to the list of children.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append(PyObject *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), ((PyObject *)__pyx_v_other_element));

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

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_append(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_other_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(__pyx_v_self, __pyx_v_other_element, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":488
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of all Elements from a sequence to the list of
 *         children.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements); /*proto*/
static char __pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend[] = "Append a copy of all Elements from a sequence to the list of\n        children.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend(PyObject *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), ((PyObject *)__pyx_v_elements));

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

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_2extend(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_elements) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":492
 *         children.
 *         """
 *         self._assertNode()             # <<<<<<<<<<<<<<
 *         for element in elements:
 *             self.append(element)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":493
 *         """
 *         self._assertNode()
 *         for element in elements:             # <<<<<<<<<<<<<<
 *             self.append(element)
 * 
 */
  if (PyList_CheckExact(__pyx_v_elements) || PyTuple_CheckExact(__pyx_v_elements)) {
    __pyx_t_2 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_element, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":494
 *         self._assertNode()
 *         for element in elements:
 *             self.append(element)             # <<<<<<<<<<<<<<
 * 
 *     property text:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append(__pyx_v_self, __pyx_v_element, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 494; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":488
 *         _moveTail(c_next, c_node)
 * 
 *     def extend(self, elements):             # <<<<<<<<<<<<<<
 *         u"""Append a copy of all Elements from a sequence to the list of
 *         children.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":500
 *         value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.children)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text___get__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":501
 *         """
 *         def __get__(self):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             return _collectText(self._c_node.children)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":502
 *         def __get__(self):
 *             self._assertNode()
 *             return _collectText(self._c_node.children)             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->__pyx_base.__pyx_base._c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":500
 *         value None, if there was no text.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             return _collectText(self._c_node.children)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":504
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if isinstance(value, QName):
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_2__set__(((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_4lxml_5etree_23_AppendOnlyElementProxy_4text_2__set__(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":505
 * 
 *         def __set__(self, value):
 *             self._assertNode()             # <<<<<<<<<<<<<<
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._assertNode(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":506
 *         def __set__(self, value):
 *             self._assertNode()
 *             if isinstance(value, QName):             # <<<<<<<<<<<<<<
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_QName)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":507
 *             self._assertNode()
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')             # <<<<<<<<<<<<<<
 *             _setNodeText(self._c_node, value)
 * 
 */
    if (!(likely(((((PyObject *)__pyx_v_self)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_f_4lxml_5etree__resolveQNameText(((struct LxmlElement *)__pyx_v_self), __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_t_4 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __Pyx_decode_bytes(__pyx_t_4, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":508
 *             if isinstance(value, QName):
 *                 value = _resolveQNameText(self, value).decode('utf8')
 *             _setNodeText(self._c_node, value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->__pyx_base.__pyx_base._c_node, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":504
 *             return _collectText(self._c_node.children)
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             self._assertNode()
 *             if isinstance(value, QName):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._AppendOnlyElementProxy.text.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":511
 * 
 * 
 * cdef _ReadOnlyProxy _newAppendOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 */

static struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_f_4lxml_5etree__newAppendOnlyProxy(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_source_proxy, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_el = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newAppendOnlyProxy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":518
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 *     else:
 */
  switch (__pyx_v_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":514
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":515
 *     cdef _ReadOnlyProxy el
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":516
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":517
 *         el = _AppendOnlyElementProxy.__new__(_AppendOnlyElementProxy)
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":518
 *     elif c_node.type == tree.XML_PI_NODE:
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 *     else:
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":519
 *         el = _ModifyContentOnlyPIProxy.__new__(_ModifyContentOnlyPIProxy)
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 */
    __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyProxy)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_el = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1);
    __pyx_t_1 = 0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":521
 *         el = _ModifyContentOnlyProxy.__new__(_ModifyContentOnlyProxy)
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)             # <<<<<<<<<<<<<<
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unsupported_element_type_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 521; __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[5]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 521; __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, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":522
 *     else:
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node             # <<<<<<<<<<<<<<
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el
 */
  __pyx_v_el->_c_node = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":523
 *         raise TypeError("Unsupported element type: %d" % c_node.type)
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)             # <<<<<<<<<<<<<<
 *     return el
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__initReadOnlyProxy(__pyx_v_el, __pyx_v_source_proxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":524
 *     el._c_node = c_node
 *     _initReadOnlyProxy(el, source_proxy)
 *     return el             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_el));
  __pyx_r = __pyx_v_el;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":511
 * 
 * 
 * cdef _ReadOnlyProxy _newAppendOnlyProxy(             # <<<<<<<<<<<<<<
 *     _ReadOnlyProxy source_proxy, xmlNode* c_node):
 *     cdef _ReadOnlyProxy el
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._newAppendOnlyProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_el);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":526
 *     return el
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 */

static xmlNode *__pyx_f_4lxml_5etree__roNodeOf(PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_roNodeOf", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":528
 * cdef xmlNode* _roNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":529
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 */
    __pyx_t_3 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_3;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":530
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ReadOnlyProxy)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":531
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_3;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":532
 *     elif isinstance(element, _ReadOnlyProxy):
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":533
 *         c_node = (<_ReadOnlyProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_3;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":535
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_invalid_argument_type_s, ((PyObject *)Py_TYPE(__pyx_v_element))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":537
 *         raise TypeError, u"invalid argument type %s" % type(element)
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"invalid element"
 *     return c_node
 */
  __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":538
 * 
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_invalid_element, 0, 0);
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":539
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":526
 *     return el
 * 
 * cdef xmlNode* _roNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._roNodeOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":541
 *     return c_node
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 */

static xmlNode *__pyx_f_4lxml_5etree__nonRoNodeOf(PyObject *__pyx_v_element) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_nonRoNodeOf", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":543
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":544
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 */
    __pyx_t_3 = ((struct LxmlElement *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_3;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":545
 *     if isinstance(element, _Element):
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):             # <<<<<<<<<<<<<<
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__AppendOnlyElementProxy)); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":546
 *         c_node = (<_Element>element)._c_node
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node             # <<<<<<<<<<<<<<
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)__pyx_v_element)->__pyx_base.__pyx_base._c_node;
    __pyx_v_c_node = __pyx_t_3;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":547
 *     elif isinstance(element, _AppendOnlyElementProxy):
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):             # <<<<<<<<<<<<<<
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__OpaqueNodeWrapper)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":548
 *         c_node = (<_AppendOnlyElementProxy>element)._c_node
 *     elif isinstance(element, _OpaqueNodeWrapper):
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)
 */
    __pyx_t_3 = ((struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper *)__pyx_v_element)->_c_node;
    __pyx_v_c_node = __pyx_t_3;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":550
 *         c_node = (<_OpaqueNodeWrapper>element)._c_node
 *     else:
 *         raise TypeError, u"invalid argument type %s" % type(element)             # <<<<<<<<<<<<<<
 * 
 *     if c_node is NULL:
 */
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_invalid_argument_type_s, ((PyObject *)Py_TYPE(__pyx_v_element))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":552
 *         raise TypeError, u"invalid argument type %s" % type(element)
 * 
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError, u"invalid element"
 *     return c_node
 */
  __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":553
 * 
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"             # <<<<<<<<<<<<<<
 *     return c_node
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_invalid_element, 0, 0);
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":554
 *     if c_node is NULL:
 *         raise TypeError, u"invalid element"
 *     return c_node             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_c_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":541
 *     return c_node
 * 
 * cdef xmlNode* _nonRoNodeOf(element) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if isinstance(element, _Element):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._nonRoNodeOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11ElementBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11ElementBase___init__[] = "ElementBase(*children, attrib=None, nsmap=None, **_extra)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__;
#endif
static int __pyx_pw_4lxml_5etree_11ElementBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v_children = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return -1;
  __Pyx_GOTREF(__pyx_v__extra);
  if (PyTuple_GET_SIZE(__pyx_args) > 0) {
    __pyx_v_children = PyTuple_GetSlice(__pyx_args, 0, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_children)) {
      __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
      __Pyx_RefNannyFinishContext();
      return -1;
    }
    __Pyx_GOTREF(__pyx_v_children);
  } else {
    __pyx_v_children = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 0; index < 2 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_attrib = values[0];
    __pyx_v_nsmap = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_children); __pyx_v_children = 0;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11ElementBase___init__(((struct LxmlElementBase *)__pyx_v_self), __pyx_v_attrib, __pyx_v_nsmap, __pyx_v_children, __pyx_v__extra);

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

static int __pyx_pf_4lxml_5etree_11ElementBase___init__(struct LxmlElementBase *__pyx_v_self, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_children, PyObject *__pyx_v__extra) {
  int __pyx_v_is_html;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  struct LxmlElement *__pyx_v_last_child = 0;
  PyObject *__pyx_v__getattr = NULL;
  PyObject *__pyx_v_namespace = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_tag = NULL;
  PyObject *__pyx_v_child = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":45
 *         u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 *         cdef bint is_html = 0             # <<<<<<<<<<<<<<
 *         cdef _BaseParser parser
 *         cdef _Element last_child
 */
  __pyx_v_is_html = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":49
 *         cdef _Element last_child
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__             # <<<<<<<<<<<<<<
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_getattribute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__getattr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":50
 *         # don't use normal attribute access as it might be overridden
 *         _getattr = object.__getattribute__
 *         try:             # <<<<<<<<<<<<<<
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":51
 *         _getattr = object.__getattribute__
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             namespace = None
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      __Pyx_INCREF(__pyx_n_s_NAMESPACE);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_NAMESPACE);
      __Pyx_GIVEREF(__pyx_n_s_NAMESPACE);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v__getattr, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_namespace = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":52
 *         try:
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             namespace = None
 *         try:
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":53
 *             namespace = _utf8(_getattr(self, 'NAMESPACE'))
 *         except AttributeError:
 *             namespace = None             # <<<<<<<<<<<<<<
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_namespace, Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":54
 *         except AttributeError:
 *             namespace = None
 *         try:             # <<<<<<<<<<<<<<
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":55
 *             namespace = None
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))             # <<<<<<<<<<<<<<
 *             if ns is not None:
 *                 namespace = ns
 */
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      __Pyx_INCREF(__pyx_n_s_TAG);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_TAG);
      __Pyx_GIVEREF(__pyx_n_s_TAG);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v__getattr, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __pyx_f_4lxml_5etree__getNsTag(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (likely(__pyx_t_7 != Py_None)) {
        PyObject* sequence = __pyx_t_7;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        #else
        __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      }
      __pyx_v_ns = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_tag = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":56
 *         try:
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:             # <<<<<<<<<<<<<<
 *                 namespace = ns
 *         except AttributeError:
 */
      __pyx_t_8 = (__pyx_v_ns != Py_None);
      __pyx_t_9 = (__pyx_t_8 != 0);
      if (__pyx_t_9) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":57
 *             ns, tag = _getNsTag(_getattr(self, 'TAG'))
 *             if ns is not None:
 *                 namespace = ns             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 */
        __Pyx_INCREF(__pyx_v_ns);
        __Pyx_DECREF_SET(__pyx_v_namespace, __pyx_v_ns);
        goto __pyx_L21;
      }
      __pyx_L21:;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L20_try_end;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":58
 *             if ns is not None:
 *                 namespace = ns
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":59
 *                 namespace = ns
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))             # <<<<<<<<<<<<<<
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 */
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      __Pyx_INCREF(__pyx_n_s_class);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_n_s_class);
      __Pyx_GIVEREF(__pyx_n_s_class);
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_v__getattr, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_n_s_name);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_n_s_name);
      __Pyx_GIVEREF(__pyx_n_s_name);
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_v__getattr, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __pyx_f_4lxml_5etree__utf8(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_tag, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":60
 *         except AttributeError:
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:             # <<<<<<<<<<<<<<
 *                 tag = tag.split(b'.')[-1]
 *         try:
 */
      __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_kp_b__4, __pyx_v_tag, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __pyx_t_8 = (__pyx_t_9 != 0);
      if (__pyx_t_8) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":61
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]             # <<<<<<<<<<<<<<
 *         try:
 *             parser = _getattr(self, 'PARSER')
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_tag, __pyx_n_s_split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_11, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;};
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_10);
        __pyx_t_10 = 0;
        goto __pyx_L24;
      }
      __pyx_L24:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_exception_handled;
    }
    goto __pyx_L15_except_error;
    __pyx_L15_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L14_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    __pyx_L20_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":62
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]
 *         try:             # <<<<<<<<<<<<<<
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":63
 *                 tag = tag.split(b'.')[-1]
 *         try:
 *             parser = _getattr(self, 'PARSER')             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             parser = None
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      __Pyx_INCREF(__pyx_n_s_PARSER);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_PARSER);
      __Pyx_GIVEREF(__pyx_n_s_PARSER);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v__getattr, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
      __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L32_try_end;
    __pyx_L25_error:;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":64
 *         try:
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             parser = None
 *             for child in children:
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":65
 *             parser = _getattr(self, 'PARSER')
 *         except AttributeError:
 *             parser = None             # <<<<<<<<<<<<<<
 *             for child in children:
 *                 if isinstance(child, _Element):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":66
 *         except AttributeError:
 *             parser = None
 *             for child in children:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 */
      __pyx_t_10 = __pyx_v_children; __Pyx_INCREF(__pyx_t_10); __pyx_t_12 = 0;
      for (;;) {
        if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_11); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
        #else
        __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
        #endif
        __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":67
 *             parser = None
 *             for child in children:
 *                 if isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 */
        __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_child, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
        __pyx_t_9 = (__pyx_t_8 != 0);
        if (__pyx_t_9) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":68
 *             for child in children:
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser             # <<<<<<<<<<<<<<
 *                     break
 *         if isinstance(parser, HTMLParser):
 */
          __pyx_t_11 = ((PyObject *)((struct LxmlElement *)__pyx_v_child)->_doc->_parser);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_11));
          __pyx_t_11 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":69
 *                 if isinstance(child, _Element):
 *                     parser = (<_Element>child)._doc._parser
 *                     break             # <<<<<<<<<<<<<<
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 */
          goto __pyx_L36_break;
        }
      }
      __pyx_L36_break:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L26_exception_handled;
    }
    goto __pyx_L27_except_error;
    __pyx_L27_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L26_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L32_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":70
 *                     parser = (<_Element>child)._doc._parser
 *                     break
 *         if isinstance(parser, HTMLParser):             # <<<<<<<<<<<<<<
 *             is_html = 1
 *         if namespace is None:
 */
  __pyx_t_9 = __Pyx_TypeCheck(((PyObject *)__pyx_v_parser), ((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)); 
  __pyx_t_8 = (__pyx_t_9 != 0);
  if (__pyx_t_8) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":71
 *                     break
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1             # <<<<<<<<<<<<<<
 *         if namespace is None:
 *             try:
 */
    __pyx_v_is_html = 1;
    goto __pyx_L38;
  }
  __pyx_L38:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":72
 *         if isinstance(parser, HTMLParser):
 *             is_html = 1
 *         if namespace is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 */
  __pyx_t_8 = (__pyx_v_namespace == Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":73
 *             is_html = 1
 *         if namespace is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":74
 *         if namespace is None:
 *             try:
 *                 is_html = _getattr(self, 'HTML')             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 pass
 */
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L40_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        __Pyx_INCREF(__pyx_n_s_HTML);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_HTML);
        __Pyx_GIVEREF(__pyx_n_s_HTML);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v__getattr, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L40_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L40_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_is_html = __pyx_t_9;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L47_try_end;
      __pyx_L40_error:;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":75
 *             try:
 *                 is_html = _getattr(self, 'HTML')
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,
 */
      __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_6) {
        PyErr_Restore(0,0,0);
        goto __pyx_L41_exception_handled;
      }
      goto __pyx_L42_except_error;
      __pyx_L42_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      goto __pyx_L1_error;
      __pyx_L41_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_L47_try_end:;
    }
    goto __pyx_L39;
  }
  __pyx_L39:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":77
 *             except AttributeError:
 *                 pass
 *         _initNewElement(self, is_html, tag, namespace, parser,             # <<<<<<<<<<<<<<
 *                         attrib, nsmap, _extra)
 *         last_child = None
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree__initNewElement(((struct LxmlElement *)__pyx_v_self), __pyx_v_is_html, __pyx_v_tag, __pyx_v_namespace, __pyx_v_parser, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":79
 *         _initNewElement(self, is_html, tag, namespace, parser,
 *                         attrib, nsmap, _extra)
 *         last_child = None             # <<<<<<<<<<<<<<
 *         for child in children:
 *             if _isString(child):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_last_child = ((struct LxmlElement *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":80
 *                         attrib, nsmap, _extra)
 *         last_child = None
 *         for child in children:             # <<<<<<<<<<<<<<
 *             if _isString(child):
 *                 if last_child is None:
 */
  __pyx_t_5 = __pyx_v_children; __Pyx_INCREF(__pyx_t_5); __pyx_t_12 = 0;
  for (;;) {
    if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_7); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":81
 *         last_child = None
 *         for child in children:
 *             if _isString(child):             # <<<<<<<<<<<<<<
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,
 */
    __pyx_t_9 = (_isString(__pyx_v_child) != 0);
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":82
 *         for child in children:
 *             if _isString(child):
 *                 if last_child is None:             # <<<<<<<<<<<<<<
 *                     _setNodeText(self._c_node,
 *                                  (_collectText(self._c_node.children) or '') + child)
 */
      __pyx_t_9 = (((PyObject *)__pyx_v_last_child) == Py_None);
      __pyx_t_8 = (__pyx_t_9 != 0);
      if (__pyx_t_8) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":84
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,
 *                                  (_collectText(self._c_node.children) or '') + child)             # <<<<<<<<<<<<<<
 *                 else:
 *                     _setTailText(last_child._c_node,
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__collectText(__pyx_v_self->__pyx_base._c_node->children); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (!__pyx_t_8) {
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_INCREF(__pyx_kp_s__15);
          __pyx_t_1 = __pyx_kp_s__15;
        } else {
          __pyx_t_1 = __pyx_t_7;
          __pyx_t_7 = 0;
        }
        __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_child); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":83
 *             if _isString(child):
 *                 if last_child is None:
 *                     _setNodeText(self._c_node,             # <<<<<<<<<<<<<<
 *                                  (_collectText(self._c_node.children) or '') + child)
 *                 else:
 */
        __pyx_t_6 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_self->__pyx_base._c_node, __pyx_t_7); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L51;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":87
 *                 else:
 *                     _setTailText(last_child._c_node,
 *                                  (_collectText(last_child._c_node.next) or '') + child)             # <<<<<<<<<<<<<<
 *             elif isinstance(child, _Element):
 *                 last_child = child
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__collectText(__pyx_v_last_child->_c_node->next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (!__pyx_t_8) {
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_INCREF(__pyx_kp_s__15);
          __pyx_t_1 = __pyx_kp_s__15;
        } else {
          __pyx_t_1 = __pyx_t_7;
          __pyx_t_7 = 0;
        }
        __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_child); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":86
 *                                  (_collectText(self._c_node.children) or '') + child)
 *                 else:
 *                     _setTailText(last_child._c_node,             # <<<<<<<<<<<<<<
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):
 */
        __pyx_t_6 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_last_child->_c_node, __pyx_t_7); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_L51:;
      goto __pyx_L50;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":88
 *                     _setTailText(last_child._c_node,
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):             # <<<<<<<<<<<<<<
 *                 last_child = child
 *                 _appendChild(self, last_child)
 */
    __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_child, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":89
 *                                  (_collectText(last_child._c_node.next) or '') + child)
 *             elif isinstance(child, _Element):
 *                 last_child = child             # <<<<<<<<<<<<<<
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 */
      if (!(likely(((__pyx_v_child) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_child, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = __pyx_v_child;
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_last_child, ((struct LxmlElement *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":90
 *             elif isinstance(child, _Element):
 *                 last_child = child
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L50;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":91
 *                 last_child = child
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):             # <<<<<<<<<<<<<<
 *                 last_child = child()
 *                 _appendChild(self, last_child)
 */
    __pyx_t_9 = PyType_Check(__pyx_v_child); 
    if ((__pyx_t_9 != 0)) {
      __pyx_t_8 = PyObject_IsSubclass(__pyx_v_child, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = (__pyx_t_8 != 0);
    } else {
      __pyx_t_13 = (__pyx_t_9 != 0);
    }
    if (__pyx_t_13) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":92
 *                 _appendChild(self, last_child)
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()             # <<<<<<<<<<<<<<
 *                 _appendChild(self, last_child)
 *             else:
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_child, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF_SET(__pyx_v_last_child, ((struct LxmlElement *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":93
 *             elif isinstance(child, type) and issubclass(child, ElementBase):
 *                 last_child = child()
 *                 _appendChild(self, last_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, "Invalid child type: %r" % type(child)
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_v_self), __pyx_v_last_child); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L50;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":95
 *                 _appendChild(self, last_child)
 *             else:
 *                 raise TypeError, "Invalid child type: %r" % type(child)             # <<<<<<<<<<<<<<
 * 
 * cdef class CommentBase(_Comment):
 */
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_child_type_r, ((PyObject *)Py_TYPE(__pyx_v_child))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      {__pyx_filename = __pyx_f[9]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L50:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":42
 *     hierarchies that implement a common namespace.
 *     """
 *     def __init__(self, *children, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""ElementBase(*children, attrib=None, nsmap=None, **_extra)
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree.ElementBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF((PyObject *)__pyx_v_last_child);
  __Pyx_XDECREF(__pyx_v__getattr);
  __Pyx_XDECREF(__pyx_v_namespace);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":109
 *     called after object creation.
 *     """
 *     def __init__(self, text):             # <<<<<<<<<<<<<<
 *         # copied from Comment() factory
 *         cdef _Document doc
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11CommentBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_11CommentBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_text = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.CommentBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11CommentBase___init__(((struct __pyx_obj_4lxml_5etree_CommentBase *)__pyx_v_self), __pyx_v_text);

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

static int __pyx_pf_4lxml_5etree_11CommentBase___init__(struct __pyx_obj_4lxml_5etree_CommentBase *__pyx_v_self, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":113
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
 */
  __pyx_t_1 = (__pyx_v_text == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":114
 *         cdef xmlDoc*   c_doc
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__15);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__15);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":116
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":117
 *         else:
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":118
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":119
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))             # <<<<<<<<<<<<<<
 *         if self._c_node is NULL:
 *             raise MemoryError()
 */
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createComment(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":120
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 */
  __pyx_t_2 = ((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":121
 *         self._c_node = _createComment(c_doc, _xcstr(text))
 *         if self._c_node is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":122
 *         if self._c_node is NULL:
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":123
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)             # <<<<<<<<<<<<<<
 *         self._init()
 * 
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__registerProxy(((struct LxmlElement *)__pyx_v_self), __pyx_v_doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":124
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * cdef class PIBase(_ProcessingInstruction):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 124; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":109
 *     called after object creation.
 *     """
 *     def __init__(self, text):             # <<<<<<<<<<<<<<
 *         # copied from Comment() factory
 *         cdef _Document doc
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.CommentBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":139
 *     called after object creation.
 *     """
 *     def __init__(self, target, text=None):             # <<<<<<<<<<<<<<
 *         # copied from PI() factory
 *         cdef _Document doc
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_6PIBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_6PIBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_text,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_target = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.PIBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_6PIBase___init__(((struct __pyx_obj_4lxml_5etree_PIBase *)__pyx_v_self), __pyx_v_target, __pyx_v_text);

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

static int __pyx_pf_4lxml_5etree_6PIBase___init__(struct __pyx_obj_4lxml_5etree_PIBase *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_text) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  xmlDoc *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":143
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)             # <<<<<<<<<<<<<<
 *         if text is None:
 *             text = b''
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_target); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":144
 *         cdef xmlDoc*   c_doc
 *         target = _utf8(target)
 *         if text is None:             # <<<<<<<<<<<<<<
 *             text = b''
 *         else:
 */
  __pyx_t_2 = (__pyx_v_text == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":145
 *         target = _utf8(target)
 *         if text is None:
 *             text = b''             # <<<<<<<<<<<<<<
 *         else:
 *             text = _utf8(text)
 */
    __Pyx_INCREF(__pyx_kp_b__15);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_kp_b__15);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":147
 *             text = b''
 *         else:
 *             text = _utf8(text)             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":148
 *         else:
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":149
 *             text = _utf8(text)
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":150
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))             # <<<<<<<<<<<<<<
 *         if self._c_node is NULL:
 *             raise MemoryError()
 */
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createPI(__pyx_v_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_target), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_text));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":151
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 */
  __pyx_t_3 = ((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":152
 *         self._c_node = _createPI(c_doc, _xcstr(target), _xcstr(text))
 *         if self._c_node is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":153
 *         if self._c_node is NULL:
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":154
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)             # <<<<<<<<<<<<<<
 *         self._init()
 * 
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__registerProxy(((struct LxmlElement *)__pyx_v_self), __pyx_v_doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":155
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * cdef class EntityBase(_Entity):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 155; __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_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":139
 *     called after object creation.
 *     """
 *     def __init__(self, target, text=None):             # <<<<<<<<<<<<<<
 *         # copied from PI() factory
 *         cdef _Document doc
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.PIBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":169
 *     called after object creation.
 *     """
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10EntityBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10EntityBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.EntityBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10EntityBase___init__(((struct __pyx_obj_4lxml_5etree_EntityBase *)__pyx_v_self), __pyx_v_name);

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

static int __pyx_pf_4lxml_5etree_10EntityBase___init__(struct __pyx_obj_4lxml_5etree_EntityBase *__pyx_v_self, PyObject *__pyx_v_name) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_v_name_utf = NULL;
  const xmlChar *__pyx_v_c_name;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":172
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 *         name_utf = _utf8(name)             # <<<<<<<<<<<<<<
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":173
 *         cdef xmlDoc*   c_doc
 *         name_utf = _utf8(name)
 *         c_name = _xcstr(name_utf)             # <<<<<<<<<<<<<<
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
 */
  __pyx_v_c_name = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":174
 *         name_utf = _utf8(name)
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':             # <<<<<<<<<<<<<<
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 */
  __pyx_t_2 = (((__pyx_v_c_name[0]) == '#') != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":175
 *         c_name = _xcstr(name_utf)
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):             # <<<<<<<<<<<<<<
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 *         elif not _xmlNameIsValid(c_name):
 */
    __pyx_t_2 = ((!(__pyx_f_4lxml_5etree__characterReferenceIsValid((__pyx_v_c_name + 1)) != 0)) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":176
 *         if c_name[0] == c'#':
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, u"Invalid character reference: '%s'" % name             # <<<<<<<<<<<<<<
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 */
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Invalid_character_reference_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[9]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":177
 *             if not _characterReferenceIsValid(c_name + 1):
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 *         elif not _xmlNameIsValid(c_name):             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 *         c_doc = _newXMLDoc()
 */
  __pyx_t_2 = ((!(__pyx_f_4lxml_5etree__xmlNameIsValid(__pyx_v_c_name) != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":178
 *                 raise ValueError, u"Invalid character reference: '%s'" % name
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, u"Invalid entity reference: '%s'" % name             # <<<<<<<<<<<<<<
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 */
    __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Invalid_entity_reference_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":179
 *         elif not _xmlNameIsValid(c_name):
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 *         c_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":180
 *             raise ValueError, u"Invalid entity reference: '%s'" % name
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)             # <<<<<<<<<<<<<<
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":181
 *         c_doc = _newXMLDoc()
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)             # <<<<<<<<<<<<<<
 *         if self._c_node is NULL:
 *             raise MemoryError()
 */
  __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node = __pyx_f_4lxml_5etree__createEntity(__pyx_v_c_doc, __pyx_v_c_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":182
 *         doc = _documentFactory(c_doc, None)
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 */
  __pyx_t_2 = ((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":183
 *         self._c_node = _createEntity(c_doc, c_name)
 *         if self._c_node is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":184
 *         if self._c_node is NULL:
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)             # <<<<<<<<<<<<<<
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()
 */
  xmlAddChild(((xmlNode *)__pyx_v_c_doc), __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":185
 *             raise MemoryError()
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)             # <<<<<<<<<<<<<<
 *         self._init()
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__registerProxy(((struct LxmlElement *)__pyx_v_self), __pyx_v_doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._c_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":186
 *         tree.xmlAddChild(<xmlNode*>c_doc, self._c_node)
 *         _registerProxy(self, doc, self._c_node)
 *         self._init()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":169
 *     called after object creation.
 *     """
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef xmlDoc*   c_doc
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.EntityBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":189
 * 
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase
 */

static int __pyx_f_4lxml_5etree__validateNodeClass(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_cls) {
  PyObject *__pyx_v_expected = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_validateNodeClass", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":196
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         expected = PIBase
 *     else:
 */
  switch (__pyx_v_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":190
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":191
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         expected = CommentBase
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase)));
    __pyx_v_expected = ((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase);
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":192
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         expected = CommentBase
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":193
 *         expected = ElementBase
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         expected = CommentBase             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_CommentBase)));
    __pyx_v_expected = ((PyObject*)__pyx_ptype_4lxml_5etree_CommentBase);
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":194
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         expected = CommentBase
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:
 */
    case XML_ENTITY_REF_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":195
 *         expected = CommentBase
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         expected = PIBase
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_EntityBase)));
    __pyx_v_expected = ((PyObject*)__pyx_ptype_4lxml_5etree_EntityBase);
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":196
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         expected = PIBase
 *     else:
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":197
 *         expected = EntityBase
 *     elif c_node.type == tree.XML_PI_NODE:
 *         expected = PIBase             # <<<<<<<<<<<<<<
 *     else:
 *         assert 0, u"Unknown node type: %s" % c_node.type
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_PIBase)));
    __pyx_v_expected = ((PyObject*)__pyx_ptype_4lxml_5etree_PIBase);
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":199
 *         expected = PIBase
 *     else:
 *         assert 0, u"Unknown node type: %s" % c_node.type             # <<<<<<<<<<<<<<
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!0)) {
        __pyx_t_1 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_Unknown_node_type_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[9]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    #endif
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":201
 *         assert 0, u"Unknown node type: %s" % c_node.type
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             "result of class lookup must be subclass of %s, got %s"
 */
  __pyx_t_3 = PyType_Check(__pyx_v_cls); 
  if ((__pyx_t_3 != 0)) {
    if (unlikely(!__pyx_v_expected)) { __Pyx_RaiseUnboundLocalError("expected"); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_4 = PyObject_IsSubclass(__pyx_v_cls, ((PyObject *)__pyx_v_expected)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (__pyx_t_4 != 0);
  } else {
    __pyx_t_5 = (__pyx_t_3 != 0);
  }
  __pyx_t_3 = ((!__pyx_t_5) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":204
 *         raise TypeError(
 *             "result of class lookup must be subclass of %s, got %s"
 *             % (type(expected), type(cls)))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    if (unlikely(!__pyx_v_expected)) { __Pyx_RaiseUnboundLocalError("expected"); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_expected))));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_expected))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_expected))));
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_cls)));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)Py_TYPE(__pyx_v_cls)));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_cls)));
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_result_of_class_lookup_must_be_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":202
 * 
 *     if not (isinstance(cls, type) and issubclass(cls, expected)):
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             "result of class lookup must be subclass of %s, got %s"
 *             % (type(expected), type(cls)))
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __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 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":205
 *             "result of class lookup must be subclass of %s, got %s"
 *             % (type(expected), type(cls)))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":189
 * 
 * 
 * cdef int _validateNodeClass(xmlNode* c_node, cls) except -1:             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         expected = ElementBase
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._validateNodeClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expected);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":220
 *     """
 *     cdef _element_class_lookup_function _lookup_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = NULL # use default lookup
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_18ElementClassLookup___cinit__(struct LxmlElementClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":221
 *     cdef _element_class_lookup_function _lookup_function
 *     def __cinit__(self):
 *         self._lookup_function = NULL # use default lookup             # <<<<<<<<<<<<<<
 * 
 * cdef public class FallbackElementClassLookup(ElementClassLookup) \
 */
  __pyx_v_self->_lookup_function = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":220
 *     """
 *     cdef _element_class_lookup_function _lookup_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = NULL # use default lookup
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":232
 *     cdef readonly ElementClassLookup fallback
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass
 */

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

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

static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup___cinit__(struct LxmlFallbackElementClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":234
 *     def __cinit__(self):
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 */
  __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":232
 *     cdef readonly ElementClassLookup fallback
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # fall back to default lookup
 *         self._fallback_function = _lookupDefaultElementClass
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":236
 *         self._fallback_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         if fallback is not None:
 *             self._setFallback(fallback)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fallback,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fallback);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.FallbackElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2__init__(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), __pyx_v_fallback);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_2__init__(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":237
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:             # <<<<<<<<<<<<<<
 *             self._setFallback(fallback)
 *         else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_fallback) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":238
 *     def __init__(self, ElementClassLookup fallback=None):
 *         if fallback is not None:
 *             self._setFallback(fallback)             # <<<<<<<<<<<<<<
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass
 */
    ((struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *)__pyx_v_self->__pyx_vtab)->_setFallback(__pyx_v_self, __pyx_v_fallback);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":240
 *             self._setFallback(fallback)
 *         else:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):
 */
    __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":236
 *         self._fallback_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         if fallback is not None:
 *             self._setFallback(fallback)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":242
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         u"""Sets the fallback scheme for this lookup method.
 *         """
 */

static void __pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  __Pyx_RefNannyDeclarations
  _element_class_lookup_function __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_setFallback", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":245
 *         u"""Sets the fallback scheme for this lookup method.
 *         """
 *         self.fallback = lookup             # <<<<<<<<<<<<<<
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GOTREF(__pyx_v_self->fallback);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->fallback));
  __pyx_v_self->fallback = __pyx_v_lookup;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":246
 *         """
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function             # <<<<<<<<<<<<<<
 *         if self._fallback_function is NULL:
 *             self._fallback_function = _lookupDefaultElementClass
 */
  __pyx_t_1 = __pyx_v_lookup->_lookup_function;
  __pyx_v_self->_fallback_function = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":247
 *         self.fallback = lookup
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:             # <<<<<<<<<<<<<<
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_fallback_function == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":248
 *         self._fallback_function = lookup._lookup_function
 *         if self._fallback_function is NULL:
 *             self._fallback_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):
 */
    __pyx_v_self->_fallback_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":242
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     cdef void _setFallback(self, ElementClassLookup lookup):             # <<<<<<<<<<<<<<
 *         u"""Sets the fallback scheme for this lookup method.
 *         """
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":250
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         u"""set_fallback(self, lookup)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback(PyObject *__pyx_v_self, PyObject *__pyx_v_lookup); /*proto*/
static char __pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback[] = "set_fallback(self, lookup)\n\n        Sets the fallback scheme for this lookup method.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback(PyObject *__pyx_v_self, PyObject *__pyx_v_lookup) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_fallback (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 0, "lookup", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_self), ((struct LxmlElementClassLookup *)__pyx_v_lookup));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_4set_fallback(struct LxmlFallbackElementClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_fallback", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":255
 *         Sets the fallback scheme for this lookup method.
 *         """
 *         self._setFallback(lookup)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,
 */
  ((struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *)__pyx_v_self->__pyx_vtab)->_setFallback(__pyx_v_self, __pyx_v_lookup);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":250
 *             self._fallback_function = _lookupDefaultElementClass
 * 
 *     def set_fallback(self, ElementClassLookup lookup not None):             # <<<<<<<<<<<<<<
 *         u"""set_fallback(self, lookup)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":230
 *     Superclass of Element class lookups with additional fallback.
 *     """
 *     cdef readonly ElementClassLookup fallback             # <<<<<<<<<<<<<<
 *     cdef _element_class_lookup_function _fallback_function
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_8fallback_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_8fallback_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(((struct LxmlFallbackElementClassLookup *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_26FallbackElementClassLookup_8fallback___get__(struct LxmlFallbackElementClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->fallback));
  __pyx_r = ((PyObject *)__pyx_v_self->fallback);
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":257
 *         self._setFallback(lookup)
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)
 */

static CYTHON_INLINE PyObject *__pyx_f_4lxml_5etree__callLookupFallback(struct LxmlFallbackElementClassLookup *__pyx_v_lookup, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_callLookupFallback", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":259
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_lookup->fallback);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_lookup->_fallback_function(__pyx_t_1, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 259; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":257
 *         self._setFallback(lookup)
 * 
 * cdef inline object _callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                        _Document doc, xmlNode* c_node):
 *     return lookup._fallback_function(lookup.fallback, doc, c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._callLookupFallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":277
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":278
 *     cdef readonly object entity_class
 *     def __cinit__(self):
 *         self._lookup_function = _lookupDefaultElementClass             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 */
  __pyx_v_self->__pyx_base._lookup_function = __pyx_f_4lxml_5etree__lookupDefaultElementClass;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":277
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":280
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):             # <<<<<<<<<<<<<<
 *         if element is None:
 *             self.element_class = _Element
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element = 0;
  PyObject *__pyx_v_comment = 0;
  PyObject *__pyx_v_pi = 0;
  PyObject *__pyx_v_entity = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_comment,&__pyx_n_s_pi,&__pyx_n_s_entity,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comment);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pi);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_entity);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_element = values[0];
    __pyx_v_comment = values[1];
    __pyx_v_pi = values[2];
    __pyx_v_entity = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_2__init__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self), __pyx_v_element, __pyx_v_comment, __pyx_v_pi, __pyx_v_entity);

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

static int __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_comment, PyObject *__pyx_v_pi, PyObject *__pyx_v_entity) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":281
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:             # <<<<<<<<<<<<<<
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 */
  __pyx_t_1 = (__pyx_v_element == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":282
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):
 *         if element is None:
 *             self.element_class = _Element             # <<<<<<<<<<<<<<
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
    __Pyx_GOTREF(__pyx_v_self->element_class);
    __Pyx_DECREF(__pyx_v_self->element_class);
    __pyx_v_self->element_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element));
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":283
 *         if element is None:
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):             # <<<<<<<<<<<<<<
 *             self.element_class = element
 *         else:
 */
  __pyx_t_2 = PyObject_IsSubclass(__pyx_v_element, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":284
 *             self.element_class = _Element
 *         elif issubclass(element, ElementBase):
 *             self.element_class = element             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"element class must be subclass of ElementBase"
 */
    __Pyx_INCREF(__pyx_v_element);
    __Pyx_GIVEREF(__pyx_v_element);
    __Pyx_GOTREF(__pyx_v_self->element_class);
    __Pyx_DECREF(__pyx_v_self->element_class);
    __pyx_v_self->element_class = __pyx_v_element;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":286
 *             self.element_class = element
 *         else:
 *             raise TypeError, u"element class must be subclass of ElementBase"             # <<<<<<<<<<<<<<
 * 
 *         if comment is None:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_element_class_must_be_subclass_o, 0, 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":288
 *             raise TypeError, u"element class must be subclass of ElementBase"
 * 
 *         if comment is None:             # <<<<<<<<<<<<<<
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 */
  __pyx_t_1 = (__pyx_v_comment == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":289
 * 
 *         if comment is None:
 *             self.comment_class = _Comment             # <<<<<<<<<<<<<<
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment)));
    __Pyx_GOTREF(__pyx_v_self->comment_class);
    __Pyx_DECREF(__pyx_v_self->comment_class);
    __pyx_v_self->comment_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment));
    goto __pyx_L4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":290
 *         if comment is None:
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):             # <<<<<<<<<<<<<<
 *             self.comment_class = comment
 *         else:
 */
  __pyx_t_2 = PyObject_IsSubclass(__pyx_v_comment, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_CommentBase))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":291
 *             self.comment_class = _Comment
 *         elif issubclass(comment, CommentBase):
 *             self.comment_class = comment             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"comment class must be subclass of CommentBase"
 */
    __Pyx_INCREF(__pyx_v_comment);
    __Pyx_GIVEREF(__pyx_v_comment);
    __Pyx_GOTREF(__pyx_v_self->comment_class);
    __Pyx_DECREF(__pyx_v_self->comment_class);
    __pyx_v_self->comment_class = __pyx_v_comment;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":293
 *             self.comment_class = comment
 *         else:
 *             raise TypeError, u"comment class must be subclass of CommentBase"             # <<<<<<<<<<<<<<
 * 
 *         if entity is None:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_comment_class_must_be_subclass_o, 0, 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":295
 *             raise TypeError, u"comment class must be subclass of CommentBase"
 * 
 *         if entity is None:             # <<<<<<<<<<<<<<
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 */
  __pyx_t_1 = (__pyx_v_entity == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":296
 * 
 *         if entity is None:
 *             self.entity_class = _Entity             # <<<<<<<<<<<<<<
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity
 */
    __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity)));
    __Pyx_GOTREF(__pyx_v_self->entity_class);
    __Pyx_DECREF(__pyx_v_self->entity_class);
    __pyx_v_self->entity_class = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity));
    goto __pyx_L5;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":297
 *         if entity is None:
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):             # <<<<<<<<<<<<<<
 *             self.entity_class = entity
 *         else:
 */
  __pyx_t_2 = PyObject_IsSubclass(__pyx_v_entity, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_EntityBase))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":298
 *             self.entity_class = _Entity
 *         elif issubclass(entity, EntityBase):
 *             self.entity_class = entity             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"Entity class must be subclass of EntityBase"
 */
    __Pyx_INCREF(__pyx_v_entity);
    __Pyx_GIVEREF(__pyx_v_entity);
    __Pyx_GOTREF(__pyx_v_self->entity_class);
    __Pyx_DECREF(__pyx_v_self->entity_class);
    __pyx_v_self->entity_class = __pyx_v_entity;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":300
 *             self.entity_class = entity
 *         else:
 *             raise TypeError, u"Entity class must be subclass of EntityBase"             # <<<<<<<<<<<<<<
 * 
 *         if pi is None:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Entity_class_must_be_subclass_of, 0, 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":302
 *             raise TypeError, u"Entity class must be subclass of EntityBase"
 * 
 *         if pi is None:             # <<<<<<<<<<<<<<
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 */
  __pyx_t_1 = (__pyx_v_pi == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":303
 * 
 *         if pi is None:
 *             self.pi_class = None # special case, see below             # <<<<<<<<<<<<<<
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->pi_class);
    __Pyx_DECREF(__pyx_v_self->pi_class);
    __pyx_v_self->pi_class = Py_None;
    goto __pyx_L6;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":304
 *         if pi is None:
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):             # <<<<<<<<<<<<<<
 *             self.pi_class = pi
 *         else:
 */
  __pyx_t_2 = PyObject_IsSubclass(__pyx_v_pi, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_PIBase))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":305
 *             self.pi_class = None # special case, see below
 *         elif issubclass(pi, PIBase):
 *             self.pi_class = pi             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"PI class must be subclass of PIBase"
 */
    __Pyx_INCREF(__pyx_v_pi);
    __Pyx_GIVEREF(__pyx_v_pi);
    __Pyx_GOTREF(__pyx_v_self->pi_class);
    __Pyx_DECREF(__pyx_v_self->pi_class);
    __pyx_v_self->pi_class = __pyx_v_pi;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":307
 *             self.pi_class = pi
 *         else:
 *             raise TypeError, u"PI class must be subclass of PIBase"             # <<<<<<<<<<<<<<
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_PI_class_must_be_subclass_of_PIB, 0, 0);
    {__pyx_filename = __pyx_f[9]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":280
 *         self._lookup_function = _lookupDefaultElementClass
 * 
 *     def __init__(self, element=None, comment=None, pi=None, entity=None):             # <<<<<<<<<<<<<<
 *         if element is None:
 *             self.element_class = _Element
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.ElementDefaultClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":273
 *     accept the respective Element classes.
 *     """
 *     cdef readonly object element_class             # <<<<<<<<<<<<<<
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13element_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13element_class_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13element_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->element_class);
  __pyx_r = __pyx_v_self->element_class;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":274
 *     """
 *     cdef readonly object element_class
 *     cdef readonly object comment_class             # <<<<<<<<<<<<<<
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13comment_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13comment_class_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_13comment_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->comment_class);
  __pyx_r = __pyx_v_self->comment_class;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":275
 *     cdef readonly object element_class
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class             # <<<<<<<<<<<<<<
 *     cdef readonly object entity_class
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_8pi_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_8pi_class_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_8pi_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->pi_class);
  __pyx_r = __pyx_v_self->pi_class;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":276
 *     cdef readonly object comment_class
 *     cdef readonly object pi_class
 *     cdef readonly object entity_class             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         self._lookup_function = _lookupDefaultElementClass
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_12entity_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_12entity_class_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_25ElementDefaultClassLookup_12entity_class___get__(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->entity_class);
  __pyx_r = __pyx_v_self->entity_class;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":309
 *             raise TypeError, u"PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */

static PyObject *__pyx_f_4lxml_5etree__lookupDefaultElementClass(PyObject *__pyx_v_state, CYTHON_UNUSED struct LxmlDocument *__pyx_v__doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_lookupDefaultElementClass", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":326
 *         else:
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 *             # special case XSLT-PI
 */
  switch (__pyx_v_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":311
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":312
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":313
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).element_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Element
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->element_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->element_class;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":315
 *             return (<ElementDefaultClassLookup>state).element_class
 *         else:
 *             return _Element             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Element));
      goto __pyx_L0;
    }
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":316
 *         else:
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":317
 *             return _Element
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 */
    __pyx_t_2 = (__pyx_v_state != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":318
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).comment_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Comment
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->comment_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->comment_class;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":320
 *             return (<ElementDefaultClassLookup>state).comment_class
 *         else:
 *             return _Comment             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Comment));
      goto __pyx_L0;
    }
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":321
 *         else:
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class
 */
    case XML_ENTITY_REF_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":322
 *             return _Comment
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:             # <<<<<<<<<<<<<<
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
 */
    __pyx_t_1 = (__pyx_v_state != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":323
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         if state is not None:
 *             return (<ElementDefaultClassLookup>state).entity_class             # <<<<<<<<<<<<<<
 *         else:
 *             return _Entity
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->entity_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->entity_class;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":325
 *             return (<ElementDefaultClassLookup>state).entity_class
 *         else:
 *             return _Entity             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Entity));
      goto __pyx_L0;
    }
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":326
 *         else:
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 *             # special case XSLT-PI
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":327
 *             return _Entity
 *     elif c_node.type == tree.XML_PI_NODE:
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:             # <<<<<<<<<<<<<<
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
 */
    __pyx_t_2 = (__pyx_v_state == Py_None);
    if (!(__pyx_t_2 != 0)) {
      __pyx_t_1 = (((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class == Py_None);
      __pyx_t_3 = (__pyx_t_1 != 0);
    } else {
      __pyx_t_3 = (__pyx_t_2 != 0);
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":329
 *         if state is None or (<ElementDefaultClassLookup>state).pi_class is None:
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:             # <<<<<<<<<<<<<<
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 */
      __pyx_t_3 = ((__pyx_v_c_node->name != NULL) != 0);
      if (__pyx_t_3) {
        __pyx_t_2 = ((__pyx_v_c_node->content != NULL) != 0);
        __pyx_t_1 = __pyx_t_2;
      } else {
        __pyx_t_1 = __pyx_t_3;
      }
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":330
 *             # special case XSLT-PI
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:             # <<<<<<<<<<<<<<
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 */
        __pyx_t_1 = ((xmlStrcmp(__pyx_v_c_node->name, ((unsigned char *)((unsigned char *)__pyx_k_xml_stylesheet))) == 0) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":331
 *             if c_node.name is not NULL and c_node.content is not NULL:
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \             # <<<<<<<<<<<<<<
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
 */
          __pyx_t_1 = ((xmlStrstr(__pyx_v_c_node->content, ((unsigned char *)((unsigned char *)__pyx_k_text_xsl))) != NULL) != 0);
          if (!__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":332
 *                 if tree.xmlStrcmp(c_node.name, <unsigned char*>"xml-stylesheet") == 0:
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:             # <<<<<<<<<<<<<<
 *                         return _XSLTProcessingInstruction
 *             return _ProcessingInstruction
 */
            __pyx_t_3 = ((xmlStrstr(__pyx_v_c_node->content, ((unsigned char *)((unsigned char *)__pyx_k_text_xml))) != NULL) != 0);
            __pyx_t_2 = __pyx_t_3;
          } else {
            __pyx_t_2 = __pyx_t_1;
          }
          if (__pyx_t_2) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":333
 *                     if tree.xmlStrstr(c_node.content, <unsigned char*>"text/xsl") is not NULL or \
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction             # <<<<<<<<<<<<<<
 *             return _ProcessingInstruction
 *         else:
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction)));
            __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTProcessingInstruction));
            goto __pyx_L0;
          }
          goto __pyx_L8;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":334
 *                            tree.xmlStrstr(c_node.content, <unsigned char*>"text/xml") is not NULL:
 *                         return _XSLTProcessingInstruction
 *             return _ProcessingInstruction             # <<<<<<<<<<<<<<
 *         else:
 *             return (<ElementDefaultClassLookup>state).pi_class
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ProcessingInstruction)));
      __pyx_r = ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ProcessingInstruction));
      goto __pyx_L0;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":336
 *             return _ProcessingInstruction
 *         else:
 *             return (<ElementDefaultClassLookup>state).pi_class             # <<<<<<<<<<<<<<
 *     else:
 *         assert 0, u"Unknown node type: %s" % c_node.type
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class);
      __pyx_r = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)__pyx_v_state)->pi_class;
      goto __pyx_L0;
    }
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":338
 *             return (<ElementDefaultClassLookup>state).pi_class
 *     else:
 *         assert 0, u"Unknown node type: %s" % c_node.type             # <<<<<<<<<<<<<<
 * 
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!0)) {
        __pyx_t_4 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_Unknown_node_type_s, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[9]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    #endif
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":309
 *             raise TypeError, u"PI class must be subclass of PIBase"
 * 
 * cdef object _lookupDefaultElementClass(state, _Document _doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     u"Trivial class lookup function that always returns the default class."
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._lookupDefaultElementClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":361
 *     cdef const_xmlChar* _c_ns
 *     cdef const_xmlChar* _c_name
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _attribute_class_lookup
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":362
 *     cdef const_xmlChar* _c_name
 *     def __cinit__(self):
 *         self._lookup_function = _attribute_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, attribute_name, class_mapping,
 */
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__attribute_class_lookup;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":361
 *     cdef const_xmlChar* _c_ns
 *     cdef const_xmlChar* _c_name
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _attribute_class_lookup
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":364
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_attribute_name = 0;
  PyObject *__pyx_v_class_mapping = 0;
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_attribute_name,&__pyx_n_s_class_mapping,&__pyx_n_s_fallback,0};
    PyObject* values[3] = {0,0,0};

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":365
 * 
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 */
    values[2] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attribute_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_class_mapping)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fallback);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_attribute_name = values[0];
    __pyx_v_class_mapping = values[1];
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_2__init__(((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_v_self), __pyx_v_attribute_name, __pyx_v_class_mapping, __pyx_v_fallback);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":364
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_32AttributeBasedElementClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_self, PyObject *__pyx_v_attribute_name, PyObject *__pyx_v_class_mapping, struct LxmlElementClassLookup *__pyx_v_fallback) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":366
 *     def __init__(self, attribute_name, class_mapping,
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)             # <<<<<<<<<<<<<<
 *         ns, name = self._pytag
 *         if ns is None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_attribute_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pytag);
  __Pyx_DECREF(__pyx_v_self->_pytag);
  __pyx_v_self->_pytag = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":367
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag             # <<<<<<<<<<<<<<
 *         if ns is None:
 *             self._c_ns = NULL
 */
  __pyx_t_1 = __pyx_v_self->_pytag;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[9]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_ns = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":368
 *         self._pytag = _getNsTag(attribute_name)
 *         ns, name = self._pytag
 *         if ns is None:             # <<<<<<<<<<<<<<
 *             self._c_ns = NULL
 *         else:
 */
  __pyx_t_4 = (__pyx_v_ns == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":369
 *         ns, name = self._pytag
 *         if ns is None:
 *             self._c_ns = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._c_ns = _xcstr(ns)
 */
    __pyx_v_self->_c_ns = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":371
 *             self._c_ns = NULL
 *         else:
 *             self._c_ns = _xcstr(ns)             # <<<<<<<<<<<<<<
 *         self._c_name = _xcstr(name)
 *         self._class_mapping = dict(class_mapping)
 */
    __pyx_v_self->_c_ns = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":372
 *         else:
 *             self._c_ns = _xcstr(ns)
 *         self._c_name = _xcstr(name)             # <<<<<<<<<<<<<<
 *         self._class_mapping = dict(class_mapping)
 * 
 */
  __pyx_v_self->_c_name = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":373
 *             self._c_ns = _xcstr(ns)
 *         self._c_name = _xcstr(name)
 *         self._class_mapping = dict(class_mapping)             # <<<<<<<<<<<<<<
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_class_mapping);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_class_mapping);
  __Pyx_GIVEREF(__pyx_v_class_mapping);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_class_mapping);
  __Pyx_DECREF(__pyx_v_self->_class_mapping);
  __pyx_v_self->_class_mapping = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":375
 *         self._class_mapping = dict(class_mapping)
 * 
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 375; __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[9]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(((PyObject *)__pyx_v_fallback));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_fallback));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fallback));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 375; __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":364
 *         self._lookup_function = _attribute_class_lookup
 * 
 *     def __init__(self, attribute_name, class_mapping,             # <<<<<<<<<<<<<<
 *                  ElementClassLookup fallback=None):
 *         self._pytag = _getNsTag(attribute_name)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.AttributeBasedElementClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":377
 *         FallbackElementClassLookup.__init__(self, fallback)
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef AttributeBasedElementClassLookup lookup
 *     cdef python.PyObject* dict_result
 */

static PyObject *__pyx_f_4lxml_5etree__attribute_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_attribute_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":381
 *     cdef python.PyObject* dict_result
 * 
 *     lookup = <AttributeBasedElementClassLookup>state             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         value = _attributeValueFromNsName(
 */
  __pyx_t_1 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":382
 * 
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
 */
  __pyx_t_2 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":383
 *     lookup = <AttributeBasedElementClassLookup>state
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         value = _attributeValueFromNsName(             # <<<<<<<<<<<<<<
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValueFromNsName(__pyx_v_c_node, __pyx_v_lookup->_c_ns, __pyx_v_lookup->_c_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":385
 *         value = _attributeValueFromNsName(
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)             # <<<<<<<<<<<<<<
 *         if dict_result is not NULL:
 *             cls = <object>dict_result
 */
    __pyx_t_1 = __pyx_v_lookup->_class_mapping;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_v_value);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":386
 *             c_node, lookup._c_ns, lookup._c_name)
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)
 */
    __pyx_t_2 = ((__pyx_v_dict_result != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":387
 *         dict_result = python.PyDict_GetItem(lookup._class_mapping, value)
 *         if dict_result is not NULL:
 *             cls = <object>dict_result             # <<<<<<<<<<<<<<
 *             _validateNodeClass(c_node, cls)
 *             return cls
 */
      __pyx_t_1 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_cls = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":388
 *         if dict_result is not NULL:
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *             return cls
 *     return _callLookupFallback(lookup, doc, c_node)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":389
 *             cls = <object>dict_result
 *             _validateNodeClass(c_node, cls)
 *             return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_cls);
      __pyx_r = __pyx_v_cls;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":390
 *             _validateNodeClass(c_node, cls)
 *             return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":377
 *         FallbackElementClassLookup.__init__(self, fallback)
 * 
 * cdef object _attribute_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef AttributeBasedElementClassLookup lookup
 *     cdef python.PyObject* dict_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._attribute_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":400
 *     Element class lookup based on the XML parser.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _parser_class_lookup
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_29ParserBasedElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":401
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _parser_class_lookup             # <<<<<<<<<<<<<<
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__parser_class_lookup;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":400
 *     Element class lookup based on the XML parser.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _parser_class_lookup
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":403
 *         self._lookup_function = _parser_class_lookup
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
 */

static PyObject *__pyx_f_4lxml_5etree__parser_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parser_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":404
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:             # <<<<<<<<<<<<<<
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc->_parser->_class_lookup) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":405
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(             # <<<<<<<<<<<<<<
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":406
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_doc->_parser->_class_lookup);
    __Pyx_INCREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":405
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(             # <<<<<<<<<<<<<<
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)
 */
    __pyx_t_4 = __pyx_v_doc->_parser->_class_lookup->_lookup_function(__pyx_t_3, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":407
 *         return doc._parser._class_lookup._lookup_function(
 *             doc._parser._class_lookup, doc, c_node)
 *     return _callLookupFallback(<FallbackElementClassLookup>state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_state), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":403
 *         self._lookup_function = _parser_class_lookup
 * 
 * cdef object _parser_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if doc._parser._class_lookup is not None:
 *         return doc._parser._class_lookup._lookup_function(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._parser_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":429
 *     If you return None from this method, the fallback will be called.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _custom_class_lookup
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_24CustomElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":430
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _custom_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def lookup(self, type, doc, namespace, name):
 */
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__custom_class_lookup;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":429
 *     If you return None from this method, the fallback will be called.
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _custom_class_lookup
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":432
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         u"lookup(self, type, doc, namespace, name)"
 *         return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup[] = "lookup(self, type, doc, namespace, name)";
static PyObject *__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_doc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_namespace = 0;
  CYTHON_UNUSED PyObject *__pyx_v_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_doc_2,&__pyx_n_s_namespace,&__pyx_n_s_name_2,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_doc_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_type = values[0];
    __pyx_v_doc = values[1];
    __pyx_v_namespace = values[2];
    __pyx_v_name = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.CustomElementClassLookup.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_24CustomElementClassLookup_2lookup(((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_v_self), __pyx_v_type, __pyx_v_doc, __pyx_v_namespace, __pyx_v_name);

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

static PyObject *__pyx_pf_4lxml_5etree_24CustomElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_namespace, CYTHON_UNUSED PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":434
 *     def lookup(self, type, doc, namespace, name):
 *         u"lookup(self, type, doc, namespace, name)"
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":432
 *         self._lookup_function = _custom_class_lookup
 * 
 *     def lookup(self, type, doc, namespace, name):             # <<<<<<<<<<<<<<
 *         u"lookup(self, type, doc, namespace, name)"
 *         return None
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":436
 *         return None
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef CustomElementClassLookup lookup
 * 
 */

static PyObject *__pyx_f_4lxml_5etree__custom_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *__pyx_v_lookup = 0;
  PyObject *__pyx_v_element_type = NULL;
  PyObject *__pyx_v_name = NULL;
  const xmlChar *__pyx_v_c_str;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_custom_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":439
 *     cdef CustomElementClassLookup lookup
 * 
 *     lookup = <CustomElementClassLookup>state             # <<<<<<<<<<<<<<
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":447
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"entity"
 *     else:
 */
  switch (__pyx_v_c_node->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":441
 *     lookup = <CustomElementClassLookup>state
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 */
    case XML_ELEMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":442
 * 
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = u"element"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = u"comment"
 */
    __Pyx_INCREF(__pyx_n_u_element);
    __pyx_v_element_type = __pyx_n_u_element;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":443
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         element_type = u"element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 */
    case XML_COMMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":444
 *         element_type = u"element"
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = u"comment"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"
 */
    __Pyx_INCREF(__pyx_n_u_comment);
    __pyx_v_element_type = __pyx_n_u_comment;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":445
 *     elif c_node.type == tree.XML_COMMENT_NODE:
 *         element_type = u"comment"
 *     elif c_node.type == tree.XML_PI_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 */
    case XML_PI_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":446
 *         element_type = u"comment"
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = u"entity"
 */
    __Pyx_INCREF(__pyx_n_u_PI);
    __pyx_v_element_type = __pyx_n_u_PI;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":447
 *     elif c_node.type == tree.XML_PI_NODE:
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:             # <<<<<<<<<<<<<<
 *         element_type = u"entity"
 *     else:
 */
    case XML_ENTITY_REF_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":448
 *         element_type = u"PI"
 *     elif c_node.type == tree.XML_ENTITY_REF_NODE:
 *         element_type = u"entity"             # <<<<<<<<<<<<<<
 *     else:
 *         element_type = u"element"
 */
    __Pyx_INCREF(__pyx_n_u_entity);
    __pyx_v_element_type = __pyx_n_u_entity;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":450
 *         element_type = u"entity"
 *     else:
 *         element_type = u"element"             # <<<<<<<<<<<<<<
 *     if c_node.name is NULL:
 *         name = None
 */
    __Pyx_INCREF(__pyx_n_u_element);
    __pyx_v_element_type = __pyx_n_u_element;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":451
 *     else:
 *         element_type = u"element"
 *     if c_node.name is NULL:             # <<<<<<<<<<<<<<
 *         name = None
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_c_node->name == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":452
 *         element_type = u"element"
 *     if c_node.name is NULL:
 *         name = None             # <<<<<<<<<<<<<<
 *     else:
 *         name = funicode(c_node.name)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_name = Py_None;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":454
 *         name = None
 *     else:
 *         name = funicode(c_node.name)             # <<<<<<<<<<<<<<
 *     c_str = tree._getNs(c_node)
 *     ns = funicode(c_str) if c_str is not NULL else None
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_name = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":455
 *     else:
 *         name = funicode(c_node.name)
 *     c_str = tree._getNs(c_node)             # <<<<<<<<<<<<<<
 *     ns = funicode(c_str) if c_str is not NULL else None
 * 
 */
  __pyx_v_c_str = _getNs(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":456
 *         name = funicode(c_node.name)
 *     c_str = tree._getNs(c_node)
 *     ns = funicode(c_str) if c_str is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 */
  if (((__pyx_v_c_str != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_v_ns = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":458
 *     ns = funicode(c_str) if c_str is not NULL else None
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)             # <<<<<<<<<<<<<<
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lookup), __pyx_n_s_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_element_type);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_element_type);
  __Pyx_GIVEREF(__pyx_v_element_type);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_INCREF(__pyx_v_ns);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_cls = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":459
 * 
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
 */
  __pyx_t_2 = (__pyx_v_cls != Py_None);
  __pyx_t_5 = (__pyx_t_2 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":460
 *     cls = lookup.lookup(element_type, doc, ns, name)
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":461
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)
 *         return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_r = __pyx_v_cls;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":462
 *         _validateNodeClass(c_node, cls)
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":436
 *         return None
 * 
 * cdef object _custom_class_lookup(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef CustomElementClassLookup lookup
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._custom_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF(__pyx_v_element_type);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":511
 *     See http://codespeak.net/lxml/element_classes.html
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _python_class_lookup
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_24PythonElementClassLookup___cinit__(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":512
 *     """
 *     def __cinit__(self):
 *         self._lookup_function = _python_class_lookup             # <<<<<<<<<<<<<<
 * 
 *     def lookup(self, doc, element):
 */
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__python_class_lookup;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":511
 *     See http://codespeak.net/lxml/element_classes.html
 *     """
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._lookup_function = _python_class_lookup
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":514
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         u"""lookup(self, doc, element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup[] = "lookup(self, doc, element)\n\n        Override this method to implement your own lookup scheme.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_doc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_element = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_doc_2,&__pyx_n_s_element,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_doc_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_doc = values[0];
    __pyx_v_element = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.PythonElementClassLookup.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_24PythonElementClassLookup_2lookup(((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_v_self), __pyx_v_doc, __pyx_v_element);

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

static PyObject *__pyx_pf_4lxml_5etree_24PythonElementClassLookup_2lookup(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_doc, CYTHON_UNUSED PyObject *__pyx_v_element) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":519
 *         Override this method to implement your own lookup scheme.
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":514
 *         self._lookup_function = _python_class_lookup
 * 
 *     def lookup(self, doc, element):             # <<<<<<<<<<<<<<
 *         u"""lookup(self, doc, element)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":521
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyElementProxy proxy
 */

static PyObject *__pyx_f_4lxml_5etree__python_class_lookup(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *__pyx_v_lookup = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *__pyx_v_proxy = 0;
  PyObject *__pyx_v_cls = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_python_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":524
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyElementProxy proxy
 *     lookup = <PythonElementClassLookup>state             # <<<<<<<<<<<<<<
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
 */
  __pyx_t_1 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":526
 *     lookup = <PythonElementClassLookup>state
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)             # <<<<<<<<<<<<<<
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":527
 * 
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)             # <<<<<<<<<<<<<<
 *     _freeReadOnlyProxies(proxy)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lookup), __pyx_n_s_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 527; __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[9]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_INCREF(((PyObject *)__pyx_v_proxy));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_proxy));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_proxy));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cls = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":528
 *     proxy = _newReadOnlyProxy(None, c_node)
 *     cls = lookup.lookup(doc, proxy)
 *     _freeReadOnlyProxies(proxy)             # <<<<<<<<<<<<<<
 * 
 *     if cls is not None:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_v_proxy)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":530
 *     _freeReadOnlyProxies(proxy)
 * 
 *     if cls is not None:             # <<<<<<<<<<<<<<
 *         _validateNodeClass(c_node, cls)
 *         return cls
 */
  __pyx_t_4 = (__pyx_v_cls != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":531
 * 
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)             # <<<<<<<<<<<<<<
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__validateNodeClass(__pyx_v_c_node, __pyx_v_cls); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":532
 *     if cls is not None:
 *         _validateNodeClass(c_node, cls)
 *         return cls             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cls);
    __pyx_r = __pyx_v_cls;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":533
 *         _validateNodeClass(c_node, cls)
 *         return cls
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":521
 *         return None
 * 
 * cdef object _python_class_lookup(state, _Document doc, tree.xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef PythonElementClassLookup lookup
 *     cdef _ReadOnlyElementProxy proxy
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._python_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_XDECREF(__pyx_v_cls);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":541
 * cdef object ELEMENT_CLASS_LOOKUP_STATE
 * 
 * cdef void _setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 */

static void __pyx_f_4lxml_5etree__setElementClassLookupFunction(_element_class_lookup_function __pyx_v_function, PyObject *__pyx_v_state) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  _element_class_lookup_function __pyx_t_2;
  __Pyx_RefNannySetupContext("_setElementClassLookupFunction", 0);
  __Pyx_INCREF(__pyx_v_state);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":544
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:             # <<<<<<<<<<<<<<
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 */
  __pyx_t_1 = ((__pyx_v_function == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":545
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 *     if function is NULL:
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP             # <<<<<<<<<<<<<<
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":546
 *     if function is NULL:
 *         state    = DEFAULT_ELEMENT_CLASS_LOOKUP
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function             # <<<<<<<<<<<<<<
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state
 */
    __pyx_t_2 = __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP->__pyx_base.__pyx_base._lookup_function;
    __pyx_v_function = __pyx_t_2;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":548
 *         function = DEFAULT_ELEMENT_CLASS_LOOKUP._lookup_function
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state             # <<<<<<<<<<<<<<
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 */
  __Pyx_INCREF(__pyx_v_state);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE, __pyx_v_state);
  __Pyx_GIVEREF(__pyx_v_state);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":549
 * 
 *     ELEMENT_CLASS_LOOKUP_STATE = state
 *     LOOKUP_ELEMENT_CLASS = function             # <<<<<<<<<<<<<<
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):
 */
  __pyx_v_4lxml_5etree_LOOKUP_ELEMENT_CLASS = __pyx_v_function;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":541
 * cdef object ELEMENT_CLASS_LOOKUP_STATE
 * 
 * cdef void _setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, object state):
 *     global LOOKUP_ELEMENT_CLASS, ELEMENT_CLASS_LOOKUP_STATE
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":551
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     u"""set_element_class_lookup(lookup = None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_39set_element_class_lookup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_38set_element_class_lookup[] = "set_element_class_lookup(lookup = None)\n\n    Set the global default element class lookup method.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_39set_element_class_lookup = {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pw_4lxml_5etree_39set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_38set_element_class_lookup)};
static PyObject *__pyx_pw_4lxml_5etree_39set_element_class_lookup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lookup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_element_class_lookup") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_38set_element_class_lookup(__pyx_self, __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_38set_element_class_lookup(CYTHON_UNUSED PyObject *__pyx_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("set_element_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":556
 *     Set the global default element class lookup method.
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:             # <<<<<<<<<<<<<<
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_lookup) == Py_None);
  if (!(__pyx_t_1 != 0)) {
    __pyx_t_2 = ((__pyx_v_lookup->_lookup_function == NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":557
 *     """
 *     if lookup is None or lookup._lookup_function is NULL:
 *         _setElementClassLookupFunction(NULL, None)             # <<<<<<<<<<<<<<
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)
 */
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(NULL, Py_None);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":559
 *         _setElementClassLookupFunction(NULL, None)
 *     else:
 *         _setElementClassLookupFunction(lookup._lookup_function, lookup)             # <<<<<<<<<<<<<<
 * 
 * # default setup: parser delegation
 */
    __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_lookup->_lookup_function, ((PyObject *)__pyx_v_lookup));
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":551
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     u"""set_element_class_lookup(lookup = None)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":21
 *     cdef dict _entries
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):             # <<<<<<<<<<<<<<
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ns_uri = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ns_uri,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ns_uri)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_ns_uri = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), __pyx_v_ns_uri);

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

static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry___cinit__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_ns_uri) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":22
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri             # <<<<<<<<<<<<<<
 *         if ns_uri is None:
 *             self._ns_uri_utf = None
 */
  __Pyx_INCREF(__pyx_v_ns_uri);
  __Pyx_GIVEREF(__pyx_v_ns_uri);
  __Pyx_GOTREF(__pyx_v_self->_ns_uri);
  __Pyx_DECREF(__pyx_v_self->_ns_uri);
  __pyx_v_self->_ns_uri = __pyx_v_ns_uri;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":23
 *     def __cinit__(self, ns_uri):
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:             # <<<<<<<<<<<<<<
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL
 */
  __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":24
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
 *             self._ns_uri_utf = None             # <<<<<<<<<<<<<<
 *             self._c_ns_uri_utf = NULL
 *         else:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_ns_uri_utf);
    __Pyx_DECREF(__pyx_v_self->_ns_uri_utf);
    __pyx_v_self->_ns_uri_utf = ((PyObject*)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":25
 *         if ns_uri is None:
 *             self._ns_uri_utf = None
 *             self._c_ns_uri_utf = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
 */
    __pyx_v_self->_c_ns_uri_utf = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":27
 *             self._c_ns_uri_utf = NULL
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)
 *         self._entries = {}
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_ns_uri_utf);
    __Pyx_DECREF(__pyx_v_self->_ns_uri_utf);
    __pyx_v_self->_ns_uri_utf = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":28
 *         else:
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)             # <<<<<<<<<<<<<<
 *         self._entries = {}
 * 
 */
    __pyx_t_3 = __pyx_v_self->_ns_uri_utf;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_self->_c_ns_uri_utf = PyBytes_AS_STRING(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":29
 *             self._ns_uri_utf = _utf8(ns_uri)
 *             self._c_ns_uri_utf = _cstr(self._ns_uri_utf)
 *         self._entries = {}             # <<<<<<<<<<<<<<
 * 
 *     def update(self, class_dict_iterable):
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_entries);
  __Pyx_DECREF(__pyx_v_self->_entries);
  __pyx_v_self->_entries = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":21
 *     cdef dict _entries
 *     cdef char* _c_ns_uri_utf
 *     def __cinit__(self, ns_uri):             # <<<<<<<<<<<<<<
 *         self._ns_uri = ns_uri
 *         if ns_uri is None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":31
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         u"""update(self, class_dict_iterable)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update(PyObject *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable); /*proto*/
static char __pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update[] = "update(self, class_dict_iterable)\n\n        Forgivingly update the registry.\n\n        ``class_dict_iterable`` may be a dict or some other iterable\n        that yields (name, value) pairs.\n\n        If a value does not match the required type for this registry,\n        or if the name starts with '_', it will be silently discarded.\n        This allows registrations at the module or class level using\n        vars(), globals() etc.";
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update(PyObject *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_class_dict_iterable));

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

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_2update(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_class_dict_iterable) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_INCREF(__pyx_v_class_dict_iterable);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":43
 *         This allows registrations at the module or class level using
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, u'items'):             # <<<<<<<<<<<<<<
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_class_dict_iterable, __pyx_n_u_items); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":44
 *         vars(), globals() etc."""
 *         if hasattr(class_dict_iterable, u'items'):
 *             class_dict_iterable = class_dict_iterable.items()             # <<<<<<<<<<<<<<
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_class_dict_iterable, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_class_dict_iterable, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":45
 *         if hasattr(class_dict_iterable, u'items'):
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:             # <<<<<<<<<<<<<<
 *             if (name is None or name[:1] != '_') and callable(item):
 *                 self[name] = item
 */
  if (PyList_CheckExact(__pyx_v_class_dict_iterable) || PyTuple_CheckExact(__pyx_v_class_dict_iterable)) {
    __pyx_t_4 = __pyx_v_class_dict_iterable; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_class_dict_iterable); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_3 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[10]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":46
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):             # <<<<<<<<<<<<<<
 *                 self[name] = item
 * 
 */
    __pyx_t_2 = (__pyx_v_name == Py_None);
    if (!__pyx_t_2) {
      __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, 1, NULL, NULL, &__pyx_slice__45, 0, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s__46, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = __pyx_t_1;
    } else {
      __pyx_t_11 = __pyx_t_2;
    }
    if (__pyx_t_11) {
      __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_t_2;
    } else {
      __pyx_t_1 = __pyx_t_11;
    }
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":47
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):
 *                 self[name] = item             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, name):
 */
      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_item) < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":31
 *         self._entries = {}
 * 
 *     def update(self, class_dict_iterable):             # <<<<<<<<<<<<<<
 *         u"""update(self, class_dict_iterable)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_class_dict_iterable);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":49
 *                 self[name] = item
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__getitem__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name));

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

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_4__getitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":50
 * 
 *     def __getitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         return self._get(name)
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":51
 *     def __getitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         return self._get(name)
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":52
 *         if name is not None:
 *             name = _utf8(name)
 *         return self._get(name)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":49
 *                 self[name] = item
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":54
 *         return self._get(name)
 * 
 *     def __delitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static int __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_6__delitem__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name));

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

static int __pyx_pf_4lxml_5etree_18_NamespaceRegistry_6__delitem__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":55
 * 
 *     def __delitem__(self, name):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         del self._entries[name]
 */
  __pyx_t_1 = (__pyx_v_name != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":56
 *     def __delitem__(self, name):
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         del self._entries[name]
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":57
 *         if name is not None:
 *             name = _utf8(name)
 *         del self._entries[name]             # <<<<<<<<<<<<<<
 * 
 *     cdef object _get(self, object name):
 */
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (PyDict_DelItem(__pyx_v_self->_entries, __pyx_v_name) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":54
 *         return self._get(name)
 * 
 *     def __delitem__(self, name):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             name = _utf8(name)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":59
 *         del self._entries[name]
 * 
 *     cdef object _get(self, object name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 */

static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__get(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":61
 *     cdef object _get(self, object name):
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)             # <<<<<<<<<<<<<<
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 */
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_v_name);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":62
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result
 */
  __pyx_t_2 = ((__pyx_v_dict_result == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":63
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_kp_u_Name_not_registered, 0, 0);
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":64
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *     cdef object _getForString(self, char* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
  __pyx_r = ((PyObject *)__pyx_v_dict_result);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":59
 *         del self._entries[name]
 * 
 *     cdef object _get(self, object name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":66
 *         return <object>dict_result
 * 
 *     cdef object _getForString(self, char* name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 */

static PyObject *__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self, char *__pyx_v_name) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getForString", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":68
 *     cdef object _getForString(self, char* name):
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)             # <<<<<<<<<<<<<<
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 */
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":69
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result
 */
  __pyx_t_3 = ((__pyx_v_dict_result == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":70
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."             # <<<<<<<<<<<<<<
 *         return <object>dict_result
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_kp_u_Name_not_registered, 0, 0);
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":71
 *         if dict_result is NULL:
 *             raise KeyError, u"Name not registered."
 *         return <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
  __pyx_r = ((PyObject *)__pyx_v_dict_result);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":66
 *         return <object>dict_result
 * 
 *     cdef object _getForString(self, char* name):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* dict_result
 *         dict_result = python.PyDict_GetItem(self._entries, name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry._getForString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":73
 *         return <object>dict_result
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_8__iter__(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_8__iter__(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":74
 * 
 *     def __iter__(self):
 *         return iter(self._entries)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_entries;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 74; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":73
 *         return <object>dict_result
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":76
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_10items(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_10items(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":77
 * 
 *     def items(self):
 *         return list(self._entries.items())             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_entries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 77; __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[10]; __pyx_lineno = 77; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":76
 *         return iter(self._entries)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return list(self._entries.items())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":79
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_12iteritems(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_12iteritems(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":80
 * 
 *     def iteritems(self):
 *         return iter(self._entries.items())             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_entries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 80; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":79
 *         return list(self._entries.items())
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         return iter(self._entries.items())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":82
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_NamespaceRegistry_14clear(((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_18_NamespaceRegistry_14clear(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":83
 * 
 *     def clear(self):
 *         self._entries.clear()             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  if (unlikely(__pyx_v_self->_entries == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_self->_entries); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":82
 *         return iter(self._entries.items())
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self._entries.clear()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._NamespaceRegistry.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":89
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_item));

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

static int __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":90
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 u"Registered element classes must be subtypes of ElementBase"
 */
  __pyx_t_1 = ((!(PyType_Check(__pyx_v_item) != 0)) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = PyObject_IsSubclass(__pyx_v_item, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ElementBase))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":91
 *     def __setitem__(self, name, item):
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 u"Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_NamespaceRegistryError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, __pyx_kp_u_Registered_element_classes_must, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":93
 *             raise NamespaceRegistryError, \
 *                 u"Registered element classes must be subtypes of ElementBase"
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             name = _utf8(name)
 *         self._entries[name] = item
 */
  __pyx_t_2 = (__pyx_v_name != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":94
 *                 u"Registered element classes must be subtypes of ElementBase"
 *         if name is not None:
 *             name = _utf8(name)             # <<<<<<<<<<<<<<
 *         self._entries[name] = item
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":95
 *         if name is not None:
 *             name = _utf8(name)
 *         self._entries[name] = item             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx_base._entries, __pyx_v_name, __pyx_v_item) < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":89
 * cdef class _ClassNamespaceRegistry(_NamespaceRegistry):
 *     u"Dictionary-like registry for namespace implementation classes"
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not python.PyType_Check(item) or not issubclass(item, ElementBase):
 *             raise NamespaceRegistryError, \
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":97
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"Namespace(%r)" % self._ns_uri
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_2__repr__(((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_23_ClassNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":98
 * 
 *     def __repr__(self):
 *         return u"Namespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_Namespace_r, __pyx_v_self->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":97
 *         self._entries[name] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"Namespace(%r)" % self._ns_uri
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ClassNamespaceRegistry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":108
 *     """
 *     cdef dict _namespace_registries
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._namespace_registries = {}
 * 
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":109
 *     cdef dict _namespace_registries
 *     def __cinit__(self):
 *         self._namespace_registries = {}             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_namespace_registries);
  __Pyx_DECREF(__pyx_v_self->_namespace_registries);
  __pyx_v_self->_namespace_registries = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":108
 *     """
 *     cdef dict _namespace_registries
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._namespace_registries = {}
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":111
 *         self._namespace_registries = {}
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_fallback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fallback,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fallback);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fallback = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fallback), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "fallback", 0))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2__init__(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self), __pyx_v_fallback);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_2__init__(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_fallback) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":112
 * 
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)             # <<<<<<<<<<<<<<
 *         self._lookup_function = _find_nselement_class
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_FallbackElementClassLookup)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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[10]; __pyx_lineno = 112; __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_INCREF(((PyObject *)__pyx_v_fallback));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_fallback));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fallback));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":113
 *     def __init__(self, ElementClassLookup fallback=None):
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class             # <<<<<<<<<<<<<<
 * 
 *     def get_namespace(self, ns_uri):
 */
  __pyx_v_self->__pyx_base.__pyx_base._lookup_function = __pyx_f_4lxml_5etree__find_nselement_class;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":111
 *         self._namespace_registries = {}
 * 
 *     def __init__(self, ElementClassLookup fallback=None):             # <<<<<<<<<<<<<<
 *         FallbackElementClassLookup.__init__(self, fallback)
 *         self._lookup_function = _find_nselement_class
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":115
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         u"""get_namespace(self, ns_uri)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace(PyObject *__pyx_v_self, PyObject *__pyx_v_ns_uri); /*proto*/
static char __pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace[] = "get_namespace(self, ns_uri)\n\n        Retrieve the namespace object associated with the given URI.\n        Pass None for the empty namespace.\n\n        Creates a new namespace object if it does not yet exist.";
static PyObject *__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace(PyObject *__pyx_v_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_namespace (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_v_self), ((PyObject *)__pyx_v_ns_uri));

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

static PyObject *__pyx_pf_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_ns_utf = NULL;
  struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *__pyx_v_registry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_namespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":122
 * 
 *         Creates a new namespace object if it does not yet exist."""
 *         if ns_uri:             # <<<<<<<<<<<<<<
 *             ns_utf = _utf8(ns_uri)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":123
 *         Creates a new namespace object if it does not yet exist."""
 *         if ns_uri:
 *             ns_utf = _utf8(ns_uri)             # <<<<<<<<<<<<<<
 *         else:
 *             ns_utf = None
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ns_utf = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":125
 *             ns_utf = _utf8(ns_uri)
 *         else:
 *             ns_utf = None             # <<<<<<<<<<<<<<
 *         try:
 *             return self._namespace_registries[ns_utf]
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_ns_utf = Py_None;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":126
 *         else:
 *             ns_utf = None
 *         try:             # <<<<<<<<<<<<<<
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":127
 *             ns_utf = None
 *         try:
 *             return self._namespace_registries[ns_utf]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_v_self->_namespace_registries == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[10]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      }
      __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->_namespace_registries, __pyx_v_ns_utf); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L4_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L8_try_return;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":128
 *         try:
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":130
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *             return registry
 * 
 */
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_ns_uri);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ns_uri);
      __Pyx_GIVEREF(__pyx_v_ns_uri);
      __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ClassNamespaceRegistry)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_INCREF(__pyx_t_10);
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":129
 *             return self._namespace_registries[ns_utf]
 *         except KeyError:
 *             registry = self._namespace_registries[ns_utf] = \             # <<<<<<<<<<<<<<
 *                        _ClassNamespaceRegistry(ns_uri)
 *             return registry
 */
      if (unlikely(__pyx_v_self->_namespace_registries == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[10]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      if (unlikely(PyDict_SetItem(__pyx_v_self->_namespace_registries, __pyx_v_ns_utf, __pyx_t_10) < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":131
 *             registry = self._namespace_registries[ns_utf] = \
 *                        _ClassNamespaceRegistry(ns_uri)
 *             return registry             # <<<<<<<<<<<<<<
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_registry));
      __pyx_r = ((PyObject *)__pyx_v_registry);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L11_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":115
 *         self._lookup_function = _find_nselement_class
 * 
 *     def get_namespace(self, ns_uri):             # <<<<<<<<<<<<<<
 *         u"""get_namespace(self, ns_uri)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree.ElementNamespaceClassLookup.get_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":133
 *             return registry
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef python.PyObject* dict_result
 *     cdef ElementNamespaceClassLookup lookup
 */

static PyObject *__pyx_f_4lxml_5etree__find_nselement_class(PyObject *__pyx_v_state, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_v_dict_result;
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *__pyx_v_lookup = 0;
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *__pyx_v_registry = 0;
  const xmlChar *__pyx_v_c_namespace_utf;
  PyObject *__pyx_v_classes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_nselement_class", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":137
 *     cdef ElementNamespaceClassLookup lookup
 *     cdef _NamespaceRegistry registry
 *     if state is None:             # <<<<<<<<<<<<<<
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 */
  __pyx_t_1 = (__pyx_v_state == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":138
 *     cdef _NamespaceRegistry registry
 *     if state is None:
 *         return _lookupDefaultElementClass(None, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(Py_None, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":140
 *         return _lookupDefaultElementClass(None, doc, c_node)
 * 
 *     lookup = <ElementNamespaceClassLookup>state             # <<<<<<<<<<<<<<
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         return _callLookupFallback(lookup, doc, c_node)
 */
  __pyx_t_3 = __pyx_v_state;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_lookup = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":141
 * 
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 */
  __pyx_t_2 = ((__pyx_v_c_node->type != XML_ELEMENT_NODE) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":142
 *     lookup = <ElementNamespaceClassLookup>state
 *     if c_node.type != tree.XML_ELEMENT_NODE:
 *         return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     c_namespace_utf = _getNs(c_node)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":144
 *         return _callLookupFallback(lookup, doc, c_node)
 * 
 *     c_namespace_utf = _getNs(c_node)             # <<<<<<<<<<<<<<
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(
 */
  __pyx_v_c_namespace_utf = _getNs(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":145
 * 
 *     c_namespace_utf = _getNs(c_node)
 *     if c_namespace_utf is not NULL:             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 */
  __pyx_t_2 = ((__pyx_v_c_namespace_utf != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":147
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)             # <<<<<<<<<<<<<<
 *     else:
 *         dict_result = python.PyDict_GetItem(
 */
    __pyx_t_3 = __pyx_v_lookup->_namespace_registries;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_namespace_utf)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":146
 *     c_namespace_utf = _getNs(c_node)
 *     if c_namespace_utf is not NULL:
 *         dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 *     else:
 */
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_3, __pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":150
 *     else:
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)             # <<<<<<<<<<<<<<
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 */
    __pyx_t_4 = __pyx_v_lookup->_namespace_registries;
    __Pyx_INCREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":149
 *             lookup._namespace_registries, <unsigned char*>c_namespace_utf)
 *     else:
 *         dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
 */
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_4, Py_None);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":151
 *         dict_result = python.PyDict_GetItem(
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries
 */
  __pyx_t_2 = ((__pyx_v_dict_result != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":152
 *             lookup._namespace_registries, None)
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result             # <<<<<<<<<<<<<<
 *         classes = registry._entries
 * 
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_dict_result);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":153
 *     if dict_result is not NULL:
 *         registry = <_NamespaceRegistry>dict_result
 *         classes = registry._entries             # <<<<<<<<<<<<<<
 * 
 *         if c_node.name is not NULL:
 */
    __pyx_t_4 = __pyx_v_registry->_entries;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_classes = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":155
 *         classes = registry._entries
 * 
 *         if c_node.name is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)
 */
    __pyx_t_2 = ((__pyx_v_c_node->name != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":157
 *         if c_node.name is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 classes, <unsigned char*>c_node.name)             # <<<<<<<<<<<<<<
 *         else:
 *             dict_result = NULL
 */
      __pyx_t_4 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_node->name)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":156
 * 
 *         if c_node.name is not NULL:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 classes, <unsigned char*>c_node.name)
 *         else:
 */
      __pyx_v_dict_result = PyDict_GetItem(__pyx_v_classes, __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":159
 *                 classes, <unsigned char*>c_node.name)
 *         else:
 *             dict_result = NULL             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is NULL:
 */
      __pyx_v_dict_result = NULL;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":161
 *             dict_result = NULL
 * 
 *         if dict_result is NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 */
    __pyx_t_2 = ((__pyx_v_dict_result == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":162
 * 
 *         if dict_result is NULL:
 *             dict_result = python.PyDict_GetItem(classes, None)             # <<<<<<<<<<<<<<
 * 
 *         if dict_result is not NULL:
 */
      __pyx_v_dict_result = PyDict_GetItem(__pyx_v_classes, Py_None);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":164
 *             dict_result = python.PyDict_GetItem(classes, None)
 * 
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)
 */
    __pyx_t_2 = ((__pyx_v_dict_result != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":165
 * 
 *         if dict_result is not NULL:
 *             return <object>dict_result             # <<<<<<<<<<<<<<
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;
    }
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":166
 *         if dict_result is not NULL:
 *             return <object>dict_result
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_4lxml_5etree__callLookupFallback(((struct LxmlFallbackElementClassLookup *)__pyx_v_lookup), __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":133
 *             return registry
 * 
 * cdef object _find_nselement_class(state, _Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef python.PyObject* dict_result
 *     cdef ElementNamespaceClassLookup lookup
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._find_nselement_class", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lookup);
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XDECREF(__pyx_v_classes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":175
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     u"""FunctionNamespace(ns_uri)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_41FunctionNamespace(PyObject *__pyx_self, PyObject *__pyx_v_ns_uri); /*proto*/
static char __pyx_doc_4lxml_5etree_40FunctionNamespace[] = "FunctionNamespace(ns_uri)\n\n    Retrieve the function namespace object associated with the given\n    URI.\n\n    Creates a new one if it does not yet exist. A function namespace\n    can only be used to register extension functions.";
static PyMethodDef __pyx_mdef_4lxml_5etree_41FunctionNamespace = {__Pyx_NAMESTR("FunctionNamespace"), (PyCFunction)__pyx_pw_4lxml_5etree_41FunctionNamespace, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_40FunctionNamespace)};
static PyObject *__pyx_pw_4lxml_5etree_41FunctionNamespace(PyObject *__pyx_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("FunctionNamespace (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_40FunctionNamespace(__pyx_self, ((PyObject *)__pyx_v_ns_uri));

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

static PyObject *__pyx_pf_4lxml_5etree_40FunctionNamespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_ns_utf = NULL;
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_registry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("FunctionNamespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":183
 *     Creates a new one if it does not yet exist. A function namespace
 *     can only be used to register extension functions."""
 *     ns_utf = _utf8(ns_uri) if ns_uri else None             # <<<<<<<<<<<<<<
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_v_ns_utf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":184
 *     can only be used to register extension functions."""
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:             # <<<<<<<<<<<<<<
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":185
 *     ns_utf = _utf8(ns_uri) if ns_uri else None
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[10]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, __pyx_v_ns_utf); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 185; __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_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":186
 *     try:
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("lxml.etree.FunctionNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":188
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)             # <<<<<<<<<<<<<<
 *         return registry
 * 
 */
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_ns_uri);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ns_uri);
      __Pyx_GIVEREF(__pyx_v_ns_uri);
      __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_INCREF(__pyx_t_10);
      __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":187
 *         return __FUNCTION_NAMESPACE_REGISTRIES[ns_utf]
 *     except KeyError:
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \             # <<<<<<<<<<<<<<
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 *         return registry
 */
      if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[10]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      if (unlikely(PyDict_SetItem(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, __pyx_v_ns_utf, __pyx_t_10) < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":189
 *         registry = __FUNCTION_NAMESPACE_REGISTRIES[ns_utf] = \
 *                    _XPathFunctionNamespaceRegistry(ns_uri)
 *         return registry             # <<<<<<<<<<<<<<
 * 
 * @cython.internal
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_registry));
      __pyx_r = ((PyObject *)__pyx_v_registry);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_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_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":175
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     u"""FunctionNamespace(ns_uri)
 * 
 */

  /* function exit code */
  __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_AddTraceback("lxml.etree.FunctionNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":193
 * @cython.internal
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not callable(item):
 *             raise NamespaceRegistryError, \
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item); /*proto*/
static int __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_item));

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

static int __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry___setitem__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_item) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":194
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):
 *         if not callable(item):             # <<<<<<<<<<<<<<
 *             raise NamespaceRegistryError, \
 *                 u"Registered functions must be callable."
 */
  __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":195
 *     def __setitem__(self, name, item):
 *         if not callable(item):
 *             raise NamespaceRegistryError, \             # <<<<<<<<<<<<<<
 *                 u"Registered functions must be callable."
 *         if not name:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NamespaceRegistryError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, __pyx_kp_u_Registered_functions_must_be_cal, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":197
 *             raise NamespaceRegistryError, \
 *                 u"Registered functions must be callable."
 *         if not name:             # <<<<<<<<<<<<<<
 *             raise ValueError, \
 *                 u"extensions must have non empty names"
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":198
 *                 u"Registered functions must be callable."
 *         if not name:
 *             raise ValueError, \             # <<<<<<<<<<<<<<
 *                 u"extensions must have non empty names"
 *         self._entries[_utf8(name)] = item
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_extensions_must_have_non_empty_n, 0, 0);
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":200
 *             raise ValueError, \
 *                 u"extensions must have non empty names"
 *         self._entries[_utf8(name)] = item             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  if (unlikely(__pyx_v_self->__pyx_base._entries == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx_base._entries, __pyx_t_3, __pyx_v_item) < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":193
 * @cython.internal
 * cdef class _FunctionNamespaceRegistry(_NamespaceRegistry):
 *     def __setitem__(self, name, item):             # <<<<<<<<<<<<<<
 *         if not callable(item):
 *             raise NamespaceRegistryError, \
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":202
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"FunctionNamespace(%r)" % self._ns_uri
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_2__repr__(((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_26_FunctionNamespaceRegistry_2__repr__(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":203
 * 
 *     def __repr__(self):
 *         return u"FunctionNamespace(%r)" % self._ns_uri             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_FunctionNamespace_r, __pyx_v_self->__pyx_base._ns_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":202
 *         self._entries[_utf8(name)] = item
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return u"FunctionNamespace(%r)" % self._ns_uri
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FunctionNamespaceRegistry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":213
 *     property prefix:
 *         u"Namespace prefix for extension functions."
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix___del__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":214
 *         u"Namespace prefix for extension functions."
 *         def __del__(self):
 *             self._prefix = None # no prefix configured             # <<<<<<<<<<<<<<
 *             self._prefix_utf = None
 *         def __get__(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_prefix);
  __Pyx_DECREF(__pyx_v_self->_prefix);
  __pyx_v_self->_prefix = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":215
 *         def __del__(self):
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None             # <<<<<<<<<<<<<<
 *         def __get__(self):
 *             if self._prefix is None:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_prefix_utf);
  __Pyx_DECREF(__pyx_v_self->_prefix_utf);
  __pyx_v_self->_prefix_utf = ((PyObject*)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":213
 *     property prefix:
 *         u"Namespace prefix for extension functions."
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":216
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._prefix is None:
 *                 return ''
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_3__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_3__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__get__(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_2__get__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":217
 *             self._prefix_utf = None
 *         def __get__(self):
 *             if self._prefix is None:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_1 = (__pyx_v_self->_prefix == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":218
 *         def __get__(self):
 *             if self._prefix is None:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._prefix
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s__15);
    __pyx_r = __pyx_kp_s__15;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":220
 *                 return ''
 *             else:
 *                 return self._prefix             # <<<<<<<<<<<<<<
 *         def __set__(self, prefix):
 *             if prefix == '':
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_prefix);
    __pyx_r = __pyx_v_self->_prefix;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":216
 *             self._prefix = None # no prefix configured
 *             self._prefix_utf = None
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._prefix is None:
 *                 return ''
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":221
 *             else:
 *                 return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             if prefix == '':
 *                 prefix = None # empty prefix
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_5__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /*proto*/
static int __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_5__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_4__set__(((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_prefix));

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

static int __pyx_pf_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_4__set__(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_self, PyObject *__pyx_v_prefix) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_prefix);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":222
 *                 return self._prefix
 *         def __set__(self, prefix):
 *             if prefix == '':             # <<<<<<<<<<<<<<
 *                 prefix = None # empty prefix
 *             if prefix is None:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_prefix, __pyx_kp_s__15, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":223
 *         def __set__(self, prefix):
 *             if prefix == '':
 *                 prefix = None # empty prefix             # <<<<<<<<<<<<<<
 *             if prefix is None:
 *                 self._prefix_utf = None
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_prefix, Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":224
 *             if prefix == '':
 *                 prefix = None # empty prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 self._prefix_utf = None
 *             else:
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":225
 *                 prefix = None # empty prefix
 *             if prefix is None:
 *                 self._prefix_utf = None             # <<<<<<<<<<<<<<
 *             else:
 *                 self._prefix_utf = _utf8(prefix)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_prefix_utf);
    __Pyx_DECREF(__pyx_v_self->_prefix_utf);
    __pyx_v_self->_prefix_utf = ((PyObject*)Py_None);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":227
 *                 self._prefix_utf = None
 *             else:
 *                 self._prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *             self._prefix = prefix
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_prefix_utf);
    __Pyx_DECREF(__pyx_v_self->_prefix_utf);
    __pyx_v_self->_prefix_utf = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":228
 *             else:
 *                 self._prefix_utf = _utf8(prefix)
 *             self._prefix = prefix             # <<<<<<<<<<<<<<
 * 
 * cdef list _find_all_extension_prefixes():
 */
  __Pyx_INCREF(__pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  __Pyx_GOTREF(__pyx_v_self->_prefix);
  __Pyx_DECREF(__pyx_v_self->_prefix);
  __pyx_v_self->_prefix = __pyx_v_prefix;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":221
 *             else:
 *                 return self._prefix
 *         def __set__(self, prefix):             # <<<<<<<<<<<<<<
 *             if prefix == '':
 *                 prefix = None # empty prefix
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathFunctionNamespaceRegistry.prefix.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":230
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     u"Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
 */

static PyObject *__pyx_f_4lxml_5etree__find_all_extension_prefixes(void) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *__pyx_v_registry = 0;
  PyObject *__pyx_v_ns_prefixes = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_all_extension_prefixes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":233
 *     u"Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
 *     cdef list ns_prefixes = []             # <<<<<<<<<<<<<<
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":234
 *     cdef _XPathFunctionNamespaceRegistry registry
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():             # <<<<<<<<<<<<<<
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "itervalues");
    {__pyx_filename = __pyx_f[10]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, 1, __pyx_n_s_itervalues, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry))))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_registry, ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":235
 *     cdef list ns_prefixes = []
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:             # <<<<<<<<<<<<<<
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
 */
    __pyx_t_7 = (__pyx_v_registry->_prefix_utf != ((PyObject*)Py_None));
    __pyx_t_8 = (__pyx_t_7 != 0);
    if (__pyx_t_8) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":236
 *     for registry in __FUNCTION_NAMESPACE_REGISTRIES.itervalues():
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:             # <<<<<<<<<<<<<<
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 */
      __pyx_t_8 = (__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf != ((PyObject*)Py_None));
      __pyx_t_7 = (__pyx_t_8 != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":238
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))             # <<<<<<<<<<<<<<
 *     return ns_prefixes
 */
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_registry->_prefix_utf);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_registry->_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_registry->_prefix_utf);
        __Pyx_INCREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_registry->__pyx_base.__pyx_base._ns_uri_utf);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":237
 *         if registry._prefix_utf is not None:
 *             if registry._ns_uri_utf is not None:
 *                 ns_prefixes.append(             # <<<<<<<<<<<<<<
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 *     return ns_prefixes
 */
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_ns_prefixes, __pyx_t_5); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L6;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":239
 *                 ns_prefixes.append(
 *                     (registry._prefix_utf, registry._ns_uri_utf))
 *     return ns_prefixes             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ns_prefixes);
  __pyx_r = __pyx_v_ns_prefixes;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":230
 *             self._prefix = prefix
 * 
 * cdef list _find_all_extension_prefixes():             # <<<<<<<<<<<<<<
 *     u"Internal lookup function to find all function prefixes for XSLT/XPath."
 *     cdef _XPathFunctionNamespaceRegistry registry
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._find_all_extension_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XDECREF(__pyx_v_ns_prefixes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":19
 *     cdef bint _close_file
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._type = PARSER_DATA_INVALID
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_14_InputDocument___cinit__(struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":20
 * 
 *     def __cinit__(self):
 *         self._type = PARSER_DATA_INVALID             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->_type = __pyx_e_4lxml_5etree_PARSER_DATA_INVALID;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":19
 *     cdef bint _close_file
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._type = PARSER_DATA_INVALID
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     u"This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         u"""resolve(self, system_url, public_id, context)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_1resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_resolve[] = "resolve(self, system_url, public_id, context)\n\n        Override this method to resolve an external source by\n        ``system_url`` and ``public_id``.  The third argument is an\n        opaque context object.\n\n        Return the result of one of the ``resolve_*()`` methods.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_1resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_system_url = 0;
  CYTHON_UNUSED PyObject *__pyx_v_public_id = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_system_url,&__pyx_n_s_public_id,&__pyx_n_s_context,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_system_url)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_public_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "resolve") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_resolve(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context);

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

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_resolve(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_system_url, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":34
 *         Return the result of one of the ``resolve_*()`` methods.
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def resolve_empty(self, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":25
 * cdef class Resolver:
 *     u"This is the base class of all resolvers."
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         u"""resolve(self, system_url, public_id, context)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         u"""resolve_empty(self, context)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty(PyObject *__pyx_v_self, PyObject *__pyx_v_context); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_2resolve_empty[] = "resolve_empty(self, context)\n\n        Return an empty input document.\n\n        Pass context as parameter.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty(PyObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_empty (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), ((PyObject *)__pyx_v_context));

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

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_2resolve_empty(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_empty", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":44
 *         """
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_EMPTY
 *         return doc_ref
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":45
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_EMPTY             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":46
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_EMPTY
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_string(self, string, context, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":36
 *         return None
 * 
 *     def resolve_empty(self, context):             # <<<<<<<<<<<<<<
 *         u"""resolve_empty(self, context)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_empty", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""resolve_string(self, string, context, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_5resolve_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_4resolve_string[] = "resolve_string(self, string, context, base_url=None)\n\n        Return a parsable string as input document.\n\n        Pass data string and context as parameters.  You can pass the\n        source URL or filename through the ``base_url`` keyword\n        argument.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_5resolve_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_string = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_string (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_string_2,&__pyx_n_s_context,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_string_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "resolve_string") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_string = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_4resolve_string(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_string, __pyx_v_context, __pyx_v_base_url);

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

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_4resolve_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_string, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_string", 0);
  __Pyx_INCREF(__pyx_v_string);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":58
 *         """
 *         cdef _InputDocument doc_ref
 *         if isinstance(string, unicode):             # <<<<<<<<<<<<<<
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_string); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":59
 *         cdef _InputDocument doc_ref
 *         if isinstance(string, unicode):
 *             string = (<unicode>string).encode('utf8')             # <<<<<<<<<<<<<<
 *         elif not isinstance(string, bytes):
 *             raise TypeError, "argument must be a byte string or unicode string"
 */
    if (unlikely(__pyx_v_string == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
      {__pyx_filename = __pyx_f[11]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_string)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_string, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":60
 *         if isinstance(string, unicode):
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):             # <<<<<<<<<<<<<<
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_string); 
  __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":61
 *             string = (<unicode>string).encode('utf8')
 *         elif not isinstance(string, bytes):
 *             raise TypeError, "argument must be a byte string or unicode string"             # <<<<<<<<<<<<<<
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_argument_must_be_a_byte_string_o, 0, 0);
    {__pyx_filename = __pyx_f[11]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":62
 *         elif not isinstance(string, bytes):
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":63
 *             raise TypeError, "argument must be a byte string or unicode string"
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING             # <<<<<<<<<<<<<<
 *         doc_ref._data_bytes = string
 *         if base_url is not None:
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_STRING;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":64
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string             # <<<<<<<<<<<<<<
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_string))||((__pyx_v_string) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_string)->tp_name), 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_string;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_doc_ref->_data_bytes);
  __Pyx_DECREF(__pyx_v_doc_ref->_data_bytes);
  __pyx_v_doc_ref->_data_bytes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":65
 *         doc_ref._type = PARSER_DATA_STRING
 *         doc_ref._data_bytes = string
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref
 */
  __pyx_t_1 = (__pyx_v_base_url != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":66
 *         doc_ref._data_bytes = string
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":67
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_filename(self, filename, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":48
 *         return doc_ref
 * 
 *     def resolve_string(self, string, context, *, base_url=None):             # <<<<<<<<<<<<<<
 *         u"""resolve_string(self, string, context, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XDECREF(__pyx_v_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         u"""resolve_filename(self, filename, context)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_6resolve_filename[] = "resolve_filename(self, filename, context)\n\n        Return the name of a parsable file as input document.\n\n        Pass filename and context as parameters.  You can also pass a\n        URL with an HTTP, FTP or file target.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_filename (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_context,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "resolve_filename") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_filename = values[0];
    __pyx_v_context = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_filename", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_6resolve_filename(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_filename, __pyx_v_context);

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

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_6resolve_filename(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_context) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_filename", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":78
 *         """
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":79
 *         cdef _InputDocument doc_ref
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILENAME             # <<<<<<<<<<<<<<
 *         doc_ref._filename = _encodeFilename(filename)
 *         return doc_ref
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":80
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
  __Pyx_DECREF(__pyx_v_doc_ref->_filename);
  __pyx_v_doc_ref->_filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":81
 *         doc_ref._type = PARSER_DATA_FILENAME
 *         doc_ref._filename = _encodeFilename(filename)
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":69
 *         return doc_ref
 * 
 *     def resolve_filename(self, filename, context):             # <<<<<<<<<<<<<<
 *         u"""resolve_filename(self, filename, context)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         u"""resolve_file(self, f, context, base_url=None, close=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_9resolve_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8Resolver_8resolve_file[] = "resolve_file(self, f, context, base_url=None, close=True)\n\n        Return an open file-like object as input document.\n\n        Pass open file and context as parameters.  You can pass the\n        base URL or filename of the file through the ``base_url``\n        keyword argument.  If the ``close`` flag is True (the\n        default), the file will be closed after reading.\n\n        Note that using ``.resolve_filename()`` is more efficient,\n        especially in threaded environments.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_8Resolver_9resolve_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_v_close;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_file (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_context,&__pyx_n_s_base_url,&__pyx_n_s_close,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 2; index < 4 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "resolve_file") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_f = values[0];
    __pyx_v_context = values[1];
    __pyx_v_base_url = values[2];
    if (values[3]) {
      __pyx_v_close = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_close == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_close = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_file", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8Resolver_8resolve_file(((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_self), __pyx_v_f, __pyx_v_context, __pyx_v_base_url, __pyx_v_close);

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

static PyObject *__pyx_pf_4lxml_5etree_8Resolver_8resolve_file(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_context, PyObject *__pyx_v_base_url, int __pyx_v_close) {
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_file", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":97
 *         """
 *         cdef _InputDocument doc_ref
 *         try:             # <<<<<<<<<<<<<<
 *             f.read
 *         except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":98
 *         cdef _InputDocument doc_ref
 *         try:
 *             f.read             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             raise TypeError, u"Argument is not a file-like object"
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":99
 *         try:
 *             f.read
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"Argument is not a file-like object"
 *         doc_ref = _InputDocument()
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":100
 *             f.read
 *         except AttributeError:
 *             raise TypeError, u"Argument is not a file-like object"             # <<<<<<<<<<<<<<
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
 */
      __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Argument_is_not_a_file_like_obje, 0, 0);
      {__pyx_filename = __pyx_f[11]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":101
 *         except AttributeError:
 *             raise TypeError, u"Argument is not a file-like object"
 *         doc_ref = _InputDocument()             # <<<<<<<<<<<<<<
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__InputDocument)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":102
 *             raise TypeError, u"Argument is not a file-like object"
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE             # <<<<<<<<<<<<<<
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)
 */
  __pyx_v_doc_ref->_type = __pyx_e_4lxml_5etree_PARSER_DATA_FILE;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":103
 *         doc_ref = _InputDocument()
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
 */
  __pyx_t_8 = (__pyx_v_base_url != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":104
 *         doc_ref._type = PARSER_DATA_FILE
 *         if base_url is not None:
 *             doc_ref._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":106
 *             doc_ref._filename = _encodeFilename(base_url)
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)             # <<<<<<<<<<<<<<
 *         doc_ref._close_file = close
 *         doc_ref._file = f
 */
    __pyx_t_7 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_f); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_doc_ref->_filename);
    __Pyx_DECREF(__pyx_v_doc_ref->_filename);
    __pyx_v_doc_ref->_filename = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":107
 *         else:
 *             doc_ref._filename = _getFilenameForFile(f)
 *         doc_ref._close_file = close             # <<<<<<<<<<<<<<
 *         doc_ref._file = f
 *         return doc_ref
 */
  __pyx_v_doc_ref->_close_file = __pyx_v_close;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":108
 *             doc_ref._filename = _getFilenameForFile(f)
 *         doc_ref._close_file = close
 *         doc_ref._file = f             # <<<<<<<<<<<<<<
 *         return doc_ref
 * 
 */
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_GIVEREF(__pyx_v_f);
  __Pyx_GOTREF(__pyx_v_doc_ref->_file);
  __Pyx_DECREF(__pyx_v_doc_ref->_file);
  __pyx_v_doc_ref->_file = __pyx_v_f;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":109
 *         doc_ref._close_file = close
 *         doc_ref._file = f
 *         return doc_ref             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc_ref));
  __pyx_r = ((PyObject *)__pyx_v_doc_ref);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":83
 *         return doc_ref
 * 
 *     def resolve_file(self, f, context, *, base_url=None, bint close=True):             # <<<<<<<<<<<<<<
 *         u"""resolve_file(self, f, context, base_url=None, close=True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.Resolver.resolve_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":116
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):             # <<<<<<<<<<<<<<
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17_ResolverRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17_ResolverRegistry_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_default_resolver,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default_resolver);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_default_resolver), __pyx_ptype_4lxml_5etree_Resolver, 1, "default_resolver", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_default_resolver);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17_ResolverRegistry___cinit__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_default_resolver) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":117
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):
 *         self._resolvers = set()             # <<<<<<<<<<<<<<
 *         self._default_resolver = default_resolver
 * 
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_resolvers);
  __Pyx_DECREF(__pyx_v_self->_resolvers);
  __pyx_v_self->_resolvers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":118
 *     def __cinit__(self, Resolver default_resolver=None):
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver             # <<<<<<<<<<<<<<
 * 
 *     def add(self, Resolver resolver not None):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_default_resolver));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_default_resolver));
  __Pyx_GOTREF(__pyx_v_self->_default_resolver);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_default_resolver));
  __pyx_v_self->_default_resolver = __pyx_v_default_resolver;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":116
 *     cdef object _resolvers
 *     cdef Resolver _default_resolver
 *     def __cinit__(self, Resolver default_resolver=None):             # <<<<<<<<<<<<<<
 *         self._resolvers = set()
 *         self._default_resolver = default_resolver
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         u"""add(self, resolver)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_2add[] = "add(self, resolver)\n\n        Register a resolver.\n\n        For each requested entity, the 'resolve' method of the resolver will\n        be called and the result will be passed to the parser.  If this method\n        returns None, the request will be delegated to other resolvers or the\n        default resolver.  The resolvers will be tested in an arbitrary order\n        until the first match is found.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_resolver), __pyx_ptype_4lxml_5etree_Resolver, 0, "resolver", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree_Resolver *)__pyx_v_resolver));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_2add(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, struct __pyx_obj_4lxml_5etree_Resolver *__pyx_v_resolver) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":131
 *         until the first match is found.
 *         """
 *         self._resolvers.add(resolver)             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, resolver):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_resolvers, __pyx_n_s_add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 131; __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[11]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_resolver));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_resolver));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_resolver));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 131; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":120
 *         self._default_resolver = default_resolver
 * 
 *     def add(self, Resolver resolver not None):             # <<<<<<<<<<<<<<
 *         u"""add(self, resolver)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         u"remove(self, resolver)"
 *         self._resolvers.discard(resolver)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove[] = "remove(self, resolver)";
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove(PyObject *__pyx_v_self, PyObject *__pyx_v_resolver) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), ((PyObject *)__pyx_v_resolver));

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

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_4remove(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_resolver) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":135
 *     def remove(self, resolver):
 *         u"remove(self, resolver)"
 *         self._resolvers.discard(resolver)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ResolverRegistry _copy(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_resolvers, __pyx_n_s_discard); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 135; __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[11]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_resolver);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_resolver);
  __Pyx_GIVEREF(__pyx_v_resolver);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 135; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":133
 *         self._resolvers.add(resolver)
 * 
 *     def remove(self, resolver):             # <<<<<<<<<<<<<<
 *         u"remove(self, resolver)"
 *         self._resolvers.discard(resolver)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":137
 *         self._resolvers.discard(resolver)
 * 
 *     cdef _ResolverRegistry _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
 */

static struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_registry = 0;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":139
 *     cdef _ResolverRegistry _copy(self):
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)             # <<<<<<<<<<<<<<
 *         registry._resolvers = self._resolvers.copy()
 *         return registry
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_default_resolver));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->_default_resolver));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_default_resolver));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ResolverRegistry)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_registry = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":140
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
 *         registry._resolvers = self._resolvers.copy()             # <<<<<<<<<<<<<<
 *         return registry
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_resolvers, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_registry->_resolvers);
  __Pyx_DECREF(__pyx_v_registry->_resolvers);
  __pyx_v_registry->_resolvers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":141
 *         registry = _ResolverRegistry(self._default_resolver)
 *         registry._resolvers = self._resolvers.copy()
 *         return registry             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_registry));
  __pyx_r = __pyx_v_registry;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":137
 *         self._resolvers.discard(resolver)
 * 
 *     cdef _ResolverRegistry _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ResolverRegistry registry
 *         registry = _ResolverRegistry(self._default_resolver)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_registry);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"copy(self)"
 *         return self._copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy[] = "copy(self)";
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_6copy(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_6copy(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":145
 *     def copy(self):
 *         u"copy(self)"
 *         return self._copy()             # <<<<<<<<<<<<<<
 * 
 *     def resolve(self, system_url, public_id, context):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":143
 *         return registry
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"copy(self)"
 *         return self._copy()
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve[] = "resolve(self, system_url, public_id, context)";
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_system_url = 0;
  PyObject *__pyx_v_public_id = 0;
  PyObject *__pyx_v_context = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_system_url,&__pyx_n_s_public_id,&__pyx_n_s_context,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_system_url)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_public_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, 2); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "resolve") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_system_url = values[0];
    __pyx_v_public_id = values[1];
    __pyx_v_context = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_8resolve(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self), __pyx_v_system_url, __pyx_v_public_id, __pyx_v_context);

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

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_8resolve(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self, PyObject *__pyx_v_system_url, PyObject *__pyx_v_public_id, PyObject *__pyx_v_context) {
  PyObject *__pyx_v_resolver = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":149
 *     def resolve(self, system_url, public_id, context):
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:             # <<<<<<<<<<<<<<
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
 */
  if (PyList_CheckExact(__pyx_v_self->_resolvers) || PyTuple_CheckExact(__pyx_v_self->_resolvers)) {
    __pyx_t_1 = __pyx_v_self->_resolvers; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_resolver, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":150
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)             # <<<<<<<<<<<<<<
 *             if result is not None:
 *                 return result
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_resolver, __pyx_n_s_resolve); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_system_url);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_system_url);
    __Pyx_GIVEREF(__pyx_v_system_url);
    __Pyx_INCREF(__pyx_v_public_id);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_public_id);
    __Pyx_GIVEREF(__pyx_v_public_id);
    __Pyx_INCREF(__pyx_v_context);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_context);
    __Pyx_GIVEREF(__pyx_v_context);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 150; __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_XDECREF_SET(__pyx_v_result, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":151
 *         for resolver in self._resolvers:
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 return result
 *         if self._default_resolver is None:
 */
    __pyx_t_7 = (__pyx_v_result != Py_None);
    __pyx_t_8 = (__pyx_t_7 != 0);
    if (__pyx_t_8) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":152
 *             result = resolver.resolve(system_url, public_id, context)
 *             if result is not None:
 *                 return result             # <<<<<<<<<<<<<<
 *         if self._default_resolver is None:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":153
 *             if result is not None:
 *                 return result
 *         if self._default_resolver is None:             # <<<<<<<<<<<<<<
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)
 */
  __pyx_t_8 = (((PyObject *)__pyx_v_self->_default_resolver) == Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":154
 *                 return result
 *         if self._default_resolver is None:
 *             return None             # <<<<<<<<<<<<<<
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":155
 *         if self._default_resolver is None:
 *             return None
 *         return self._default_resolver.resolve(system_url, public_id, context)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_default_resolver), __pyx_n_s_resolve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_system_url);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_system_url);
  __Pyx_GIVEREF(__pyx_v_system_url);
  __Pyx_INCREF(__pyx_v_public_id);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  __Pyx_INCREF(__pyx_v_context);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_context);
  __Pyx_GIVEREF(__pyx_v_context);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":147
 *         return self._copy()
 * 
 *     def resolve(self, system_url, public_id, context):             # <<<<<<<<<<<<<<
 *         u"resolve(self, system_url, public_id, context)"
 *         for resolver in self._resolvers:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.resolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_resolver);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":157
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(self._resolvers)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_ResolverRegistry_10__repr__(((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_ResolverRegistry_10__repr__(struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":158
 * 
 *     def __repr__(self):
 *         return repr(self._resolvers)             # <<<<<<<<<<<<<<
 * 
 * @cython.internal
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_resolvers;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 158; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":157
 *         return self._default_resolver.resolve(system_url, public_id, context)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(self._resolvers)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ResolverRegistry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":165
 *     cdef _TempStore _storage
 * 
 *     cdef void clear(self):             # <<<<<<<<<<<<<<
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 */

static void __pyx_f_4lxml_5etree_16_ResolverContext_clear(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":166
 * 
 *     cdef void clear(self):
 *         _ExceptionContext.clear(self)             # <<<<<<<<<<<<<<
 *         self._storage.clear()
 * 
 */
  __pyx_vtabptr_4lxml_5etree__ExceptionContext->clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":167
 *     cdef void clear(self):
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()             # <<<<<<<<<<<<<<
 * 
 * cdef _initResolverContext(_ResolverContext context,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_TempStore_clear(__pyx_v_self->_storage); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":165
 *     cdef _TempStore _storage
 * 
 *     cdef void clear(self):             # <<<<<<<<<<<<<<
 *         _ExceptionContext.clear(self)
 *         self._storage.clear()
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._ResolverContext.clear", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":169
 *         self._storage.clear()
 * 
 * cdef _initResolverContext(_ResolverContext context,             # <<<<<<<<<<<<<<
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 */

static PyObject *__pyx_f_4lxml_5etree__initResolverContext(struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initResolverContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":171
 * cdef _initResolverContext(_ResolverContext context,
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:             # <<<<<<<<<<<<<<
 *         context._resolvers = _ResolverRegistry()
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_resolvers) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":172
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 *         context._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 *     else:
 *         context._resolvers = resolvers
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ResolverRegistry)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_context->_resolvers);
    __Pyx_DECREF(((PyObject *)__pyx_v_context->_resolvers));
    __pyx_v_context->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":174
 *         context._resolvers = _ResolverRegistry()
 *     else:
 *         context._resolvers = resolvers             # <<<<<<<<<<<<<<
 *     context._storage = _TempStore()
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_resolvers));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_resolvers));
    __Pyx_GOTREF(__pyx_v_context->_resolvers);
    __Pyx_DECREF(((PyObject *)__pyx_v_context->_resolvers));
    __pyx_v_context->_resolvers = __pyx_v_resolvers;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":175
 *     else:
 *         context._resolvers = resolvers
 *     context._storage = _TempStore()             # <<<<<<<<<<<<<<
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__TempStore)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_context->_storage);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_storage));
  __pyx_v_context->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/docloader.pxi":169
 *         self._storage.clear()
 * 
 * cdef _initResolverContext(_ResolverContext context,             # <<<<<<<<<<<<<<
 *                           _ResolverRegistry resolvers):
 *     if resolvers is None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._initResolverContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":18
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_10ParseError_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_4lxml_5etree_10ParseError_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_10ParseError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_v_line = 0;
  PyObject *__pyx_v_column = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,&__pyx_n_s_code,&__pyx_n_s_line,&__pyx_n_s_column,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_code)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_line)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_column)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_code = values[2];
    __pyx_v_line = values[3];
    __pyx_v_column = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ParseError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10ParseError___init__(__pyx_self, __pyx_v_self, __pyx_v_message, __pyx_v_code, __pyx_v_line, __pyx_v_column);

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

static PyObject *__pyx_pf_4lxml_5etree_10ParseError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_code, PyObject *__pyx_v_line, PyObject *__pyx_v_column) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":19
 *     """
 *     def __init__(self, message, code, line, column):
 *         if python.PY_VERSION_HEX >= 0x02050000:             # <<<<<<<<<<<<<<
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_ParseError, self).__init__(message)
 */
  __pyx_t_1 = ((PY_VERSION_HEX >= 0x02050000) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":21
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 *             super(_ParseError, self).__init__(message)             # <<<<<<<<<<<<<<
 *         else:
 *             _LxmlSyntaxError.__init__(self, message)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_4lxml_5etree__ParseError);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__ParseError);
    __Pyx_GIVEREF(__pyx_v_4lxml_5etree__ParseError);
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 21; __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[6]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":23
 *             super(_ParseError, self).__init__(message)
 *         else:
 *             _LxmlSyntaxError.__init__(self, message)             # <<<<<<<<<<<<<<
 *         self.position = (line, column)
 *         self.code = code
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__LxmlSyntaxError, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":24
 *         else:
 *             _LxmlSyntaxError.__init__(self, message)
 *         self.position = (line, column)             # <<<<<<<<<<<<<<
 *         self.code = code
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_line);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
  __Pyx_GIVEREF(__pyx_v_line);
  __Pyx_INCREF(__pyx_v_column);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_column);
  __Pyx_GIVEREF(__pyx_v_column);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_position, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":25
 *             _LxmlSyntaxError.__init__(self, message)
 *         self.position = (line, column)
 *         self.code = code             # <<<<<<<<<<<<<<
 * 
 * cdef object _LxmlSyntaxError = LxmlSyntaxError
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code, __pyx_v_code) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":18
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ParseError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":56
 *     cdef list _implied_parser_contexts
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_dict = NULL
 *         self._implied_parser_contexts = []
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":57
 * 
 *     def __cinit__(self):
 *         self._c_dict = NULL             # <<<<<<<<<<<<<<
 *         self._implied_parser_contexts = []
 * 
 */
  __pyx_v_self->_c_dict = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":58
 *     def __cinit__(self):
 *         self._c_dict = NULL
 *         self._implied_parser_contexts = []             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_implied_parser_contexts);
  __Pyx_DECREF(__pyx_v_self->_implied_parser_contexts);
  __pyx_v_self->_implied_parser_contexts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":56
 *     cdef list _implied_parser_contexts
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_dict = NULL
 *         self._implied_parser_contexts = []
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":60
 *         self._implied_parser_contexts = []
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_24_ParserDictionaryContext_2__dealloc__(((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":61
 * 
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_c_dict != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":62
 *     def __dealloc__(self):
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initMainParserContext(self):
 */
    xmlDictFree(__pyx_v_self->_c_dict);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":60
 *         self._implied_parser_contexts = []
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_dict is not NULL:
 *             xmlparser.xmlDictFree(self._c_dict)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":64
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef void initMainParserContext(self):             # <<<<<<<<<<<<<<
 *         u"""Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  PyObject *__pyx_v_thread_dict;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initMainParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":69
 *         cdef python.PyObject* thread_dict
 *         cdef python.PyObject* result
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":70
 *         cdef python.PyObject* result
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:             # <<<<<<<<<<<<<<
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 * 
 */
  __pyx_t_1 = ((__pyx_v_thread_dict != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":71
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is not NULL:
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):
 */
    if (unlikely(((PyObject *)__pyx_v_thread_dict) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (unlikely(PyDict_SetItem(((PyObject*)__pyx_v_thread_dict), __pyx_n_u_ParserDictionaryContext, ((PyObject *)__pyx_v_self)) < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":64
 *             xmlparser.xmlDictFree(self._c_dict)
 * 
 *     cdef void initMainParserContext(self):             # <<<<<<<<<<<<<<
 *         u"""Put the global context into the thread dictionary of the main
 *         thread.  To be called once and only in the main thread."""
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.initMainParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":73
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         u"Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef python.PyObject* thread_dict
 */

static struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  PyObject *__pyx_v_thread_dict;
  PyObject *__pyx_v_result;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  PyObject *__pyx_v_d = NULL;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findThreadParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":78
 *         cdef python.PyObject* result
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()             # <<<<<<<<<<<<<<
 *         if thread_dict is NULL:
 *             return self
 */
  __pyx_v_thread_dict = PyThreadState_GetDict();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":79
 *         cdef _ParserDictionaryContext context
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:             # <<<<<<<<<<<<<<
 *             return self
 *         d = <dict>thread_dict
 */
  __pyx_t_1 = ((__pyx_v_thread_dict == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":80
 *         thread_dict = python.PyThreadState_GetDict()
 *         if thread_dict is NULL:
 *             return self             # <<<<<<<<<<<<<<
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":81
 *         if thread_dict is NULL:
 *             return self
 *         d = <dict>thread_dict             # <<<<<<<<<<<<<<
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 *         if result is not NULL:
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_thread_dict);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_d = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":82
 *             return self
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             return <object>result
 */
  __pyx_v_result = PyDict_GetItem(__pyx_v_d, __pyx_n_u_ParserDictionaryContext);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":83
 *         d = <dict>thread_dict
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>result
 *         context = _ParserDictionaryContext()
 */
  __pyx_t_1 = ((__pyx_v_result != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":84
 *         result = python.PyDict_GetItem(d, u"_ParserDictionaryContext")
 *         if result is not NULL:
 *             return <object>result             # <<<<<<<<<<<<<<
 *         context = _ParserDictionaryContext()
 *         d[u"_ParserDictionaryContext"] = context
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    if (!(likely(((((PyObject *)__pyx_v_result)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_4lxml_5etree__ParserDictionaryContext))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)__pyx_v_result));
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)((PyObject *)__pyx_v_result));
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":85
 *         if result is not NULL:
 *             return <object>result
 *         context = _ParserDictionaryContext()             # <<<<<<<<<<<<<<
 *         d[u"_ParserDictionaryContext"] = context
 *         return context
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserDictionaryContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":86
 *             return <object>result
 *         context = _ParserDictionaryContext()
 *         d[u"_ParserDictionaryContext"] = context             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  if (unlikely(__pyx_v_d == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_u_ParserDictionaryContext, ((PyObject *)__pyx_v_context)) < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":87
 *         context = _ParserDictionaryContext()
 *         d[u"_ParserDictionaryContext"] = context
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void setDefaultParser(self, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":73
 *             (<dict>thread_dict)[u"_ParserDictionaryContext"] = self
 * 
 *     cdef _ParserDictionaryContext _findThreadParserContext(self):             # <<<<<<<<<<<<<<
 *         u"Find (or create) the _ParserDictionaryContext object for the current thread"
 *         cdef python.PyObject* thread_dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext._findThreadParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":89
 *         return context
 * 
 *     cdef void setDefaultParser(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         u"Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setDefaultParser", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":92
 *         u"Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._default_parser = parser
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":93
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._default_parser = parser             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseParser getDefaultParser(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_context->_default_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_default_parser));
  __pyx_v_context->_default_parser = __pyx_v_parser;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":89
 *         return context
 * 
 *     cdef void setDefaultParser(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         u"Set the default parser for the current thread"
 *         cdef _ParserDictionaryContext context
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.setDefaultParser", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":95
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         u"Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
 */

static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getDefaultParser", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":98
 *         u"Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._default_parser is None:
 *             if self._default_parser is None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":99
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:             # <<<<<<<<<<<<<<
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_context->_default_parser) == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":100
 *         context = self._findThreadParserContext()
 *         if context._default_parser is None:
 *             if self._default_parser is None:             # <<<<<<<<<<<<<<
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_self->_default_parser) == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":101
 *         if context._default_parser is None:
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()             # <<<<<<<<<<<<<<
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()
 */
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._copy(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_default_parser);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_default_parser));
      __pyx_v_self->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":102
 *             if self._default_parser is None:
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser
 */
    __pyx_t_2 = (__pyx_v_context != __pyx_v_self);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":103
 *                 self._default_parser = __DEFAULT_XML_PARSER._copy()
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()             # <<<<<<<<<<<<<<
 *         return context._default_parser
 * 
 */
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->_default_parser->__pyx_vtab)->_copy(__pyx_v_self->_default_parser)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_context->_default_parser);
      __Pyx_DECREF(((PyObject *)__pyx_v_context->_default_parser));
      __pyx_v_context->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":104
 *             if context is not self:
 *                 context._default_parser = self._default_parser._copy()
 *         return context._default_parser             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context->_default_parser));
  __pyx_r = __pyx_v_context->_default_parser;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":95
 *         context._default_parser = parser
 * 
 *     cdef _BaseParser getDefaultParser(self):             # <<<<<<<<<<<<<<
 *         u"Return (or create) the default parser of the current thread"
 *         cdef _ParserDictionaryContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.getDefaultParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":106
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         u"Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
 */

static xmlDict *__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict *__pyx_v_default) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  xmlDict *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getThreadDict", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":109
 *         u"Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":110
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         if context._c_dict is NULL:             # <<<<<<<<<<<<<<
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
 */
  __pyx_t_2 = ((__pyx_v_context->_c_dict == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":112
 *         if context._c_dict is NULL:
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:             # <<<<<<<<<<<<<<
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
 */
    __pyx_t_2 = ((__pyx_v_default != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":113
 *             # thread dict not yet set up => use default or create a new one
 *             if default is not NULL:
 *                 context._c_dict = default             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 */
      __pyx_v_context->_c_dict = __pyx_v_default;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":114
 *             if default is not NULL:
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)             # <<<<<<<<<<<<<<
 *                 return default
 *             if self._c_dict is NULL:
 */
      xmlDictReference(__pyx_v_default);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":115
 *                 context._c_dict = default
 *                 xmlparser.xmlDictReference(default)
 *                 return default             # <<<<<<<<<<<<<<
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
 */
      __pyx_r = __pyx_v_default;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":116
 *                 xmlparser.xmlDictReference(default)
 *                 return default
 *             if self._c_dict is NULL:             # <<<<<<<<<<<<<<
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
 */
    __pyx_t_2 = ((__pyx_v_self->_c_dict == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":117
 *                 return default
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()             # <<<<<<<<<<<<<<
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 */
      __pyx_v_self->_c_dict = xmlDictCreate();
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":118
 *             if self._c_dict is NULL:
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:             # <<<<<<<<<<<<<<
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict
 */
    __pyx_t_2 = (__pyx_v_context != __pyx_v_self);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":119
 *                 self._c_dict = xmlparser.xmlDictCreate()
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)             # <<<<<<<<<<<<<<
 *         return context._c_dict
 * 
 */
      __pyx_v_context->_c_dict = xmlDictCreateSub(__pyx_v_self->_c_dict);
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":120
 *             if context is not self:
 *                 context._c_dict = xmlparser.xmlDictCreateSub(self._c_dict)
 *         return context._c_dict             # <<<<<<<<<<<<<<
 * 
 *     cdef void initThreadDictRef(self, tree.xmlDict** c_dict_ref):
 */
  __pyx_r = __pyx_v_context->_c_dict;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":106
 *         return context._default_parser
 * 
 *     cdef tree.xmlDict* _getThreadDict(self, tree.xmlDict* default):             # <<<<<<<<<<<<<<
 *         u"Return the thread-local dict or create a new one if necessary."
 *         cdef _ParserDictionaryContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext._getThreadDict", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":122
 *         return context._c_dict
 * 
 *     cdef void initThreadDictRef(self, tree.xmlDict** c_dict_ref):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlDict* c_dict
 *         cdef tree.xmlDict* c_thread_dict
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDict **__pyx_v_c_dict_ref) {
  xmlDict *__pyx_v_c_dict;
  xmlDict *__pyx_v_c_thread_dict;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("initThreadDictRef", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":125
 *         cdef tree.xmlDict* c_dict
 *         cdef tree.xmlDict* c_thread_dict
 *         c_dict = c_dict_ref[0]             # <<<<<<<<<<<<<<
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
 */
  __pyx_v_c_dict = (__pyx_v_c_dict_ref[0]);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":126
 *         cdef tree.xmlDict* c_thread_dict
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)             # <<<<<<<<<<<<<<
 *         if c_dict is c_thread_dict:
 *             return
 */
  __pyx_v_c_thread_dict = __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(__pyx_v_self, __pyx_v_c_dict);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":127
 *         c_dict = c_dict_ref[0]
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:             # <<<<<<<<<<<<<<
 *             return
 *         if c_dict is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_c_dict == __pyx_v_c_thread_dict) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":128
 *         c_thread_dict = self._getThreadDict(c_dict)
 *         if c_dict is c_thread_dict:
 *             return             # <<<<<<<<<<<<<<
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":129
 *         if c_dict is c_thread_dict:
 *             return
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 */
  __pyx_t_1 = ((__pyx_v_c_dict != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":130
 *             return
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)
 */
    xmlDictFree(__pyx_v_c_dict);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":131
 *         if c_dict is not NULL:
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 */
  (__pyx_v_c_dict_ref[0]) = __pyx_v_c_thread_dict;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":132
 *             xmlparser.xmlDictFree(c_dict)
 *         c_dict_ref[0] = c_thread_dict
 *         xmlparser.xmlDictReference(c_thread_dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):
 */
  xmlDictReference(__pyx_v_c_thread_dict);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":122
 *         return context._c_dict
 * 
 *     cdef void initThreadDictRef(self, tree.xmlDict** c_dict_ref):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlDict* c_dict
 *         cdef tree.xmlDict* c_thread_dict
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":134
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):             # <<<<<<<<<<<<<<
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlParserCtxt *__pyx_v_pctxt) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initParserDict", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":136
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 *         pctxt.dictNames = 1
 * 
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":137
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 *         pctxt.dictNames = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):
 */
  __pyx_v_pctxt->dictNames = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":134
 *         xmlparser.xmlDictReference(c_thread_dict)
 * 
 *     cdef void initParserDict(self, xmlparser.xmlParserCtxt* pctxt):             # <<<<<<<<<<<<<<
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":139
 *         pctxt.dictNames = 1
 * 
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):             # <<<<<<<<<<<<<<
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlXPathContext *__pyx_v_pctxt) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initXPathParserDict", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":141
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef void initDocDict(self, xmlDoc* result):
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_pctxt->dict));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":139
 *         pctxt.dictNames = 1
 * 
 *     cdef void initXPathParserDict(self, xpath.xmlXPathContext* pctxt):             # <<<<<<<<<<<<<<
 *         u"Assure we always use the same string dictionary."
 *         self.initThreadDictRef(&pctxt.dict)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":143
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef void initDocDict(self, xmlDoc* result):             # <<<<<<<<<<<<<<
 *         u"Store dict of last object parsed if no shared dict yet"
 *         # XXX We also free the result dict here if there already was one.
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initDocDict", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":148
 *         # This case should only occur for new documents with empty dicts,
 *         # otherwise we'd free data that's in use => segfault
 *         self.initThreadDictRef(&result.dict)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext findImpliedContext(self):
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_self, (&__pyx_v_result->dict));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":143
 *         self.initThreadDictRef(&pctxt.dict)
 * 
 *     cdef void initDocDict(self, xmlDoc* result):             # <<<<<<<<<<<<<<
 *         u"Store dict of last object parsed if no shared dict yet"
 *         # XXX We also free the result dict here if there already was one.
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":150
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         u"""Return any current implied xml parser context for the current
 *         thread.  This is used when the resolver functions are called
 */

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_implied_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findImpliedContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":160
 * 
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         if context._implied_parser_contexts:
 *             implied_context = context._implied_parser_contexts[-1]
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":161
 *         # see if we have a current implied parser
 *         context = self._findThreadParserContext()
 *         if context._implied_parser_contexts:             # <<<<<<<<<<<<<<
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
 */
  __pyx_t_2 = (__pyx_v_context->_implied_parser_contexts != Py_None) && (PyList_GET_SIZE(__pyx_v_context->_implied_parser_contexts) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":162
 *         context = self._findThreadParserContext()
 *         if context._implied_parser_contexts:
 *             implied_context = context._implied_parser_contexts[-1]             # <<<<<<<<<<<<<<
 *             return implied_context
 *         return None
 */
    if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_context->_implied_parser_contexts, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ParserContext))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_implied_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":163
 *         if context._implied_parser_contexts:
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_implied_context));
    __pyx_r = __pyx_v_implied_context;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":164
 *             implied_context = context._implied_parser_contexts[-1]
 *             return implied_context
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(Py_None);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":150
 *         self.initThreadDictRef(&result.dict)
 * 
 *     cdef _ParserContext findImpliedContext(self):             # <<<<<<<<<<<<<<
 *         u"""Return any current implied xml parser context for the current
 *         thread.  This is used when the resolver functions are called
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParserDictionaryContext.findImpliedContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_implied_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":166
 *         return None
 * 
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pushImpliedContextFromParser", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":168
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:             # <<<<<<<<<<<<<<
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":169
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:
 *             self.pushImpliedContext(parser._getParserContext())             # <<<<<<<<<<<<<<
 *         else:
 *             self.pushImpliedContext(None)
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_parser->__pyx_vtab)->_getParserContext(__pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":171
 *             self.pushImpliedContext(parser._getParserContext())
 *         else:
 *             self.pushImpliedContext(None)             # <<<<<<<<<<<<<<
 * 
 *     cdef void pushImpliedContext(self, _ParserContext parser_context):
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(__pyx_v_self, ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None));
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":166
 *         return None
 * 
 *     cdef void pushImpliedContextFromParser(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         u"Push a new implied context object taken from the parser."
 *         if parser is not None:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.pushImpliedContextFromParser", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":173
 *             self.pushImpliedContext(None)
 * 
 *     cdef void pushImpliedContext(self, _ParserContext parser_context):             # <<<<<<<<<<<<<<
 *         u"Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_parser_context) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pushImpliedContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":176
 *         u"Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._implied_parser_contexts.append(parser_context)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":177
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.append(parser_context)             # <<<<<<<<<<<<<<
 * 
 *     cdef void popImpliedContext(self):
 */
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyList_Append(__pyx_v_context->_implied_parser_contexts, ((PyObject *)__pyx_v_parser_context)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":173
 *             self.pushImpliedContext(None)
 * 
 *     cdef void pushImpliedContext(self, _ParserContext parser_context):             # <<<<<<<<<<<<<<
 *         u"Push a new implied context object."
 *         cdef _ParserDictionaryContext context
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.pushImpliedContext", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":179
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef void popImpliedContext(self):             # <<<<<<<<<<<<<<
 *         u"Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 */

static void __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *__pyx_v_context = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("popImpliedContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":182
 *         u"Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()             # <<<<<<<<<<<<<<
 *         context._implied_parser_contexts.pop()
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":183
 *         cdef _ParserDictionaryContext context
 *         context = self._findThreadParserContext()
 *         context._implied_parser_contexts.pop()             # <<<<<<<<<<<<<<
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
 */
  if (unlikely(__pyx_v_context->_implied_parser_contexts == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_context->_implied_parser_contexts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":179
 *         context._implied_parser_contexts.append(parser_context)
 * 
 *     cdef void popImpliedContext(self):             # <<<<<<<<<<<<<<
 *         u"Pop the current implied context object."
 *         cdef _ParserDictionaryContext context
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree._ParserDictionaryContext.popImpliedContext", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":196
 * cdef const_char* _UNICODE_ENCODING = NULL
 * 
 * cdef int _setupPythonUnicode() except -1:             # <<<<<<<<<<<<<<
 *     u"""Sets _UNICODE_ENCODING to the internal encoding name of Python unicode
 *     strings if libxml2 supports reading native Python unicode.  This depends
 */

static int __pyx_f_4lxml_5etree__setupPythonUnicode(void) {
  xmlCharEncodingHandler *__pyx_v_enchandler;
  const char *__pyx_v_enc;
  Py_UNICODE *__pyx_v_uchars;
  const xmlChar *__pyx_v_buffer;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_UNICODE __pyx_t_1[7];
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_setupPythonUnicode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":205
 *     cdef Py_ssize_t l
 *     cdef const_char* enc
 *     cdef Py_UNICODE *uchars = [c'<', c't', c'e', c's', c't', c'/', c'>']             # <<<<<<<<<<<<<<
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 */
  __pyx_t_1[0] = '<';
  __pyx_t_1[1] = 't';
  __pyx_t_1[2] = 'e';
  __pyx_t_1[3] = 's';
  __pyx_t_1[4] = 't';
  __pyx_t_1[5] = '/';
  __pyx_t_1[6] = '>';
  __pyx_v_uchars = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":206
 *     cdef const_char* enc
 *     cdef Py_UNICODE *uchars = [c'<', c't', c'e', c's', c't', c'/', c'>']
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars             # <<<<<<<<<<<<<<
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and
 */
  __pyx_v_buffer = ((const xmlChar *)__pyx_v_uchars);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":208
 *     cdef const_xmlChar* buffer = <const_xmlChar*>uchars
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
 */
  __pyx_t_2 = (((__pyx_v_buffer[0]) == '<') != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = (((__pyx_v_buffer[1]) == '\x00') != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":209
 *     # apparently, libxml2 can't detect UTF-16 on some systems
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and
 *             buffer[2] == c't' and buffer[3] == c'\0'):             # <<<<<<<<<<<<<<
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 */
      __pyx_t_4 = (((__pyx_v_buffer[2]) == 't') != 0);
      if (__pyx_t_4) {
        __pyx_t_5 = (((__pyx_v_buffer[3]) == '\x00') != 0);
        __pyx_t_6 = __pyx_t_5;
      } else {
        __pyx_t_6 = __pyx_t_4;
      }
      __pyx_t_4 = __pyx_t_6;
    } else {
      __pyx_t_4 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_4;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":210
 *     if (buffer[0] == c'<' and buffer[1] == c'\0' and
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"             # <<<<<<<<<<<<<<
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 */
    __pyx_v_enc = __pyx_k_UTF_16LE;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":211
 *             buffer[2] == c't' and buffer[3] == c'\0'):
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and             # <<<<<<<<<<<<<<
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 *         enc = "UTF-16BE"
 */
  __pyx_t_3 = (((__pyx_v_buffer[0]) == '\x00') != 0);
  if (__pyx_t_3) {
    __pyx_t_2 = (((__pyx_v_buffer[1]) == '<') != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":212
 *         enc = "UTF-16LE"
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 *             buffer[2] == c'\0' and buffer[3] == c't'):             # <<<<<<<<<<<<<<
 *         enc = "UTF-16BE"
 *     else:
 */
      __pyx_t_4 = (((__pyx_v_buffer[2]) == '\x00') != 0);
      if (__pyx_t_4) {
        __pyx_t_6 = (((__pyx_v_buffer[3]) == 't') != 0);
        __pyx_t_5 = __pyx_t_6;
      } else {
        __pyx_t_5 = __pyx_t_4;
      }
      __pyx_t_4 = __pyx_t_5;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":213
 *     elif (buffer[0] == c'\0' and buffer[1] == c'<' and
 *             buffer[2] == c'\0' and buffer[3] == c't'):
 *         enc = "UTF-16BE"             # <<<<<<<<<<<<<<
 *     else:
 *         # let libxml2 give it a try
 */
    __pyx_v_enc = __pyx_k_UTF_16BE;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":216
 *     else:
 *         # let libxml2 give it a try
 *         enc = _findEncodingName(buffer, sizeof(Py_UNICODE) * 7)             # <<<<<<<<<<<<<<
 *         if enc is NULL:
 *             # not my fault, it's YOUR broken system :)
 */
    __pyx_v_enc = __pyx_f_4lxml_5etree__findEncodingName(__pyx_v_buffer, ((sizeof(Py_UNICODE)) * 7));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":217
 *         # let libxml2 give it a try
 *         enc = _findEncodingName(buffer, sizeof(Py_UNICODE) * 7)
 *         if enc is NULL:             # <<<<<<<<<<<<<<
 *             # not my fault, it's YOUR broken system :)
 *             return 0
 */
    __pyx_t_2 = ((__pyx_v_enc == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":219
 *         if enc is NULL:
 *             # not my fault, it's YOUR broken system :)
 *             return 0             # <<<<<<<<<<<<<<
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":220
 *             # not my fault, it's YOUR broken system :)
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)             # <<<<<<<<<<<<<<
 *     if enchandler is not NULL:
 *         global _UNICODE_ENCODING
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_enc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":221
 *             return 0
 *     enchandler = tree.xmlFindCharEncodingHandler(enc)
 *     if enchandler is not NULL:             # <<<<<<<<<<<<<<
 *         global _UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  __pyx_t_2 = ((__pyx_v_enchandler != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":223
 *     if enchandler is not NULL:
 *         global _UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         _UNICODE_ENCODING = enc
 *     return 0
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":224
 *         global _UNICODE_ENCODING
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _UNICODE_ENCODING = enc             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_4lxml_5etree__UNICODE_ENCODING = __pyx_v_enc;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":225
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         _UNICODE_ENCODING = enc
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":196
 * cdef const_char* _UNICODE_ENCODING = NULL
 * 
 * cdef int _setupPythonUnicode() except -1:             # <<<<<<<<<<<<<<
 *     u"""Sets _UNICODE_ENCODING to the internal encoding name of Python unicode
 *     strings if libxml2 supports reading native Python unicode.  This depends
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":227
 *     return 0
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size):             # <<<<<<<<<<<<<<
 *     u"Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 */

static const char *__pyx_f_4lxml_5etree__findEncodingName(const xmlChar *__pyx_v_buffer, int __pyx_v_size) {
  xmlCharEncoding __pyx_v_enc;
  const char *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_findEncodingName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":230
 *     u"Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)             # <<<<<<<<<<<<<<
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         return "UTF-16LE"
 */
  __pyx_v_enc = xmlDetectCharEncoding(__pyx_v_buffer, __pyx_v_size);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":239
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     else:
 */
  switch (__pyx_v_enc) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":231
 *     cdef tree.xmlCharEncoding enc
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:             # <<<<<<<<<<<<<<
 *         return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 */
    case XML_CHAR_ENCODING_UTF16LE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":232
 *     enc = tree.xmlDetectCharEncoding(buffer, size)
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         return "UTF-16LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
 */
    __pyx_r = __pyx_k_UTF_16LE;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":233
 *     if enc == tree.XML_CHAR_ENCODING_UTF16LE:
 *         return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:             # <<<<<<<<<<<<<<
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 */
    case XML_CHAR_ENCODING_UTF16BE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":234
 *         return "UTF-16LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"
 */
    __pyx_r = __pyx_k_UTF_16BE;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":235
 *     elif enc == tree.XML_CHAR_ENCODING_UTF16BE:
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:             # <<<<<<<<<<<<<<
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 */
    case XML_CHAR_ENCODING_UCS4LE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":236
 *         return "UTF-16BE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 */
    __pyx_r = __pyx_k_UCS_4LE;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":237
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4LE:
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:             # <<<<<<<<<<<<<<
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 */
    case XML_CHAR_ENCODING_UCS4BE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":238
 *         return "UCS-4LE"
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"             # <<<<<<<<<<<<<<
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL
 */
    __pyx_r = __pyx_k_UCS_4BE;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":239
 *     elif enc == tree.XML_CHAR_ENCODING_UCS4BE:
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:             # <<<<<<<<<<<<<<
 *         return NULL
 *     else:
 */
    case XML_CHAR_ENCODING_NONE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":240
 *         return "UCS-4BE"
 *     elif enc == tree.XML_CHAR_ENCODING_NONE:
 *         return NULL             # <<<<<<<<<<<<<<
 *     else:
 *         # returns a constant char*, no need to free it
 */
    __pyx_r = NULL;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":243
 *     else:
 *         # returns a constant char*, no need to free it
 *         return tree.xmlGetCharEncodingName(enc)             # <<<<<<<<<<<<<<
 * 
 * _setupPythonUnicode()
 */
    __pyx_r = xmlGetCharEncodingName(__pyx_v_enc);
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":227
 *     return 0
 * 
 * cdef const_char* _findEncodingName(const_xmlChar* buffer, int size):             # <<<<<<<<<<<<<<
 *     u"Work around bug in libxml2: find iconv name of encoding on our own."
 *     cdef tree.xmlCharEncoding enc
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":263
 *     cdef bint _close_file_after_read
 * 
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):             # <<<<<<<<<<<<<<
 *         self._exc_context = exc_context
 *         self._filelike = filelike
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_FileReaderContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_FileReaderContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filelike = 0;
  PyObject *__pyx_v_exc_context = 0;
  PyObject *__pyx_v_url = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_close_file;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filelike,&__pyx_n_s_exc_context,&__pyx_n_s_url,&__pyx_n_s_encoding,&__pyx_n_s_close_file,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filelike)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_context)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_url)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_close_file);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filelike = values[0];
    __pyx_v_exc_context = values[1];
    __pyx_v_url = values[2];
    __pyx_v_encoding = values[3];
    if (values[4]) {
      __pyx_v_close_file = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_close_file == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_close_file = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._FileReaderContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_exc_context) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "exc_context"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_self), __pyx_v_filelike, __pyx_v_exc_context, __pyx_v_url, __pyx_v_encoding, __pyx_v_close_file);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_FileReaderContext___cinit__(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_url, PyObject *__pyx_v_encoding, int __pyx_v_close_file) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":264
 * 
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):
 *         self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         self._close_file_after_read = close_file
 */
  if (!(likely(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext)))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_exc_context;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_exc_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_exc_context));
  __pyx_v_self->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":265
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):
 *         self._exc_context = exc_context
 *         self._filelike = filelike             # <<<<<<<<<<<<<<
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding
 */
  __Pyx_INCREF(__pyx_v_filelike);
  __Pyx_GIVEREF(__pyx_v_filelike);
  __Pyx_GOTREF(__pyx_v_self->_filelike);
  __Pyx_DECREF(__pyx_v_self->_filelike);
  __pyx_v_self->_filelike = __pyx_v_filelike;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":266
 *         self._exc_context = exc_context
 *         self._filelike = filelike
 *         self._close_file_after_read = close_file             # <<<<<<<<<<<<<<
 *         self._encoding = encoding
 *         if url is None:
 */
  __pyx_v_self->_close_file_after_read = __pyx_v_close_file;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":267
 *         self._filelike = filelike
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding             # <<<<<<<<<<<<<<
 *         if url is None:
 *             self._c_url = NULL
 */
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = __pyx_v_encoding;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":268
 *         self._close_file_after_read = close_file
 *         self._encoding = encoding
 *         if url is None:             # <<<<<<<<<<<<<<
 *             self._c_url = NULL
 *         else:
 */
  __pyx_t_2 = (__pyx_v_url == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":269
 *         self._encoding = encoding
 *         if url is None:
 *             self._c_url = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             url = _encodeFilename(url)
 */
    __pyx_v_self->_c_url = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":271
 *             self._c_url = NULL
 *         else:
 *             url = _encodeFilename(url)             # <<<<<<<<<<<<<<
 *             self._c_url = _cstr(url)
 *         self._url = url
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_url); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":272
 *         else:
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)             # <<<<<<<<<<<<<<
 *         self._url = url
 *         self._bytes  = b''
 */
    __pyx_v_self->_c_url = PyBytes_AS_STRING(__pyx_v_url);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":273
 *             url = _encodeFilename(url)
 *             self._c_url = _cstr(url)
 *         self._url = url             # <<<<<<<<<<<<<<
 *         self._bytes  = b''
 *         self._bytes_read = 0
 */
  __Pyx_INCREF(__pyx_v_url);
  __Pyx_GIVEREF(__pyx_v_url);
  __Pyx_GOTREF(__pyx_v_self->_url);
  __Pyx_DECREF(__pyx_v_self->_url);
  __pyx_v_self->_url = __pyx_v_url;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":274
 *             self._c_url = _cstr(url)
 *         self._url = url
 *         self._bytes  = b''             # <<<<<<<<<<<<<<
 *         self._bytes_read = 0
 * 
 */
  __Pyx_INCREF(__pyx_kp_b__15);
  __Pyx_GIVEREF(__pyx_kp_b__15);
  __Pyx_GOTREF(__pyx_v_self->_bytes);
  __Pyx_DECREF(__pyx_v_self->_bytes);
  __pyx_v_self->_bytes = __pyx_kp_b__15;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":275
 *         self._url = url
 *         self._bytes  = b''
 *         self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _close_file(self):
 */
  __pyx_v_self->_bytes_read = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":263
 *     cdef bint _close_file_after_read
 * 
 *     def __cinit__(self, filelike, exc_context not None, url, encoding=None, bint close_file=False):             # <<<<<<<<<<<<<<
 *         self._exc_context = exc_context
 *         self._filelike = filelike
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FileReaderContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":277
 *         self._bytes_read = 0
 * 
 *     cdef _close_file(self):             # <<<<<<<<<<<<<<
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 */

static PyObject *__pyx_f_4lxml_5etree_18_FileReaderContext__close_file(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  PyObject *__pyx_v_close = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close_file", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":278
 * 
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
  __pyx_t_1 = (__pyx_v_self->_filelike == Py_None);
  if (!(__pyx_t_1 != 0)) {
    __pyx_t_2 = ((!(__pyx_v_self->_close_file_after_read != 0)) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":279
 *     cdef _close_file(self):
 *         if self._filelike is None or not self._close_file_after_read:
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             close = self._filelike.close
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":280
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._filelike.close
 *         except AttributeError:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":281
 *             return
 *         try:
 *             close = self._filelike.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_n_s_close); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_close = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":282
 *         try:
 *             close = self._filelike.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
 */
      __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_8) {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext._close_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_10);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":283
 *             close = self._filelike.close
 *         except AttributeError:
 *             close = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self._filelike = None
 */
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_close, Py_None);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L8_exception_handled;
      }
      goto __pyx_L9_except_error;
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":285
 *             close = None
 *         finally:
 *             self._filelike = None             # <<<<<<<<<<<<<<
 *         if close is not None:
 *             close()
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_filelike);
      __Pyx_DECREF(__pyx_v_self->_filelike);
      __pyx_v_self->_filelike = Py_None;
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_8 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_filelike);
        __Pyx_DECREF(__pyx_v_self->_filelike);
        __pyx_v_self->_filelike = Py_None;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_5, __pyx_t_4);
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":286
 *         finally:
 *             self._filelike = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  __pyx_t_3 = (__pyx_v_close != Py_None);
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":287
 *             self._filelike = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self):
 */
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_close, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":277
 *         self._bytes_read = 0
 * 
 *     cdef _close_file(self):             # <<<<<<<<<<<<<<
 *         if self._filelike is None or not self._close_file_after_read:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._FileReaderContext._close_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_close);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":289
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self):             # <<<<<<<<<<<<<<
 *         cdef stdio.FILE* c_stream
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 */

static xmlParserInputBuffer *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  FILE *__pyx_v_c_stream;
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInputBuffer *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_createParserInputBuffer", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":292
 *         cdef stdio.FILE* c_stream
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = xmlparser.xmlAllocParserInputBuffer(0)             # <<<<<<<<<<<<<<
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:
 */
  __pyx_v_c_buffer = xmlAllocParserInputBuffer(0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":293
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         c_stream = python.PyFile_AsFile(self._filelike)             # <<<<<<<<<<<<<<
 *         if c_stream is NULL:
 *             c_buffer.readcallback  = _readFilelikeParser
 */
  __pyx_t_1 = __pyx_v_self->_filelike;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c_stream = PyFile_AsFile(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":294
 *         c_buffer = xmlparser.xmlAllocParserInputBuffer(0)
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:             # <<<<<<<<<<<<<<
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*>self
 */
  __pyx_t_2 = ((__pyx_v_c_stream == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":295
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:
 *             c_buffer.readcallback  = _readFilelikeParser             # <<<<<<<<<<<<<<
 *             c_buffer.context = <python.PyObject*>self
 *         else:
 */
    __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFilelikeParser;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":296
 *         if c_stream is NULL:
 *             c_buffer.readcallback  = _readFilelikeParser
 *             c_buffer.context = <python.PyObject*>self             # <<<<<<<<<<<<<<
 *         else:
 *             c_buffer.readcallback  = _readFileParser
 */
    __pyx_v_c_buffer->context = ((PyObject *)__pyx_v_self);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":298
 *             c_buffer.context = <python.PyObject*>self
 *         else:
 *             c_buffer.readcallback  = _readFileParser             # <<<<<<<<<<<<<<
 *             c_buffer.context = c_stream
 *         return c_buffer
 */
    __pyx_v_c_buffer->readcallback = __pyx_f_4lxml_5etree__readFileParser;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":299
 *         else:
 *             c_buffer.readcallback  = _readFileParser
 *             c_buffer.context = c_stream             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
 */
    __pyx_v_c_buffer->context = __pyx_v_c_stream;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":300
 *             c_buffer.readcallback  = _readFileParser
 *             c_buffer.context = c_stream
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(
 */
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":289
 *             close()
 * 
 *     cdef xmlparser.xmlParserInputBuffer* _createParserInputBuffer(self):             # <<<<<<<<<<<<<<
 *         cdef stdio.FILE* c_stream
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":302
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 */

static xmlParserInput *__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlParserInput *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_createParserInput", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":305
 *             self, xmlparser.xmlParserCtxt* ctxt):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 */
  __pyx_v_c_buffer = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":306
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlDtd* _readDtd(self):
 */
  __pyx_r = xmlNewIOInputStream(__pyx_v_ctxt, __pyx_v_c_buffer, 0);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":302
 *         return c_buffer
 * 
 *     cdef xmlparser.xmlParserInput* _createParserInput(             # <<<<<<<<<<<<<<
 *             self, xmlparser.xmlParserCtxt* ctxt):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":308
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 */

static xmlDtd *__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self) {
  xmlParserInputBuffer *__pyx_v_c_buffer;
  xmlDtd *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_readDtd", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":310
 *     cdef tree.xmlDtd* _readDtd(self):
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()             # <<<<<<<<<<<<<<
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 */
  __pyx_v_c_buffer = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":311
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":312
 *         c_buffer = self._createParserInputBuffer()
 *         with nogil:
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options):
 */
        __pyx_r = xmlIOParseDTD(NULL, __pyx_v_c_buffer, 0);
        goto __pyx_L3_return;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":311
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 *         with nogil:             # <<<<<<<<<<<<<<
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 */
      /*finally:*/ {
        __pyx_L3_return: {
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L0;
        }
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":308
 *         return xmlparser.xmlNewIOInputStream(ctxt, c_buffer, 0)
 * 
 *     cdef tree.xmlDtd* _readDtd(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserInputBuffer* c_buffer
 *         c_buffer = self._createParserInputBuffer()
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":314
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options):             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef char* c_encoding
 */

static xmlDoc *__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, xmlParserCtxt *__pyx_v_ctxt, int __pyx_v_options) {
  xmlDoc *__pyx_v_result;
  char *__pyx_v_c_encoding;
  FILE *__pyx_v_c_stream;
  xmlInputReadCallback __pyx_v_c_read_callback;
  void *__pyx_v_c_callback_context;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_readDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":322
 *         cdef void* c_callback_context
 * 
 *         if self._encoding is None:             # <<<<<<<<<<<<<<
 *             c_encoding = NULL
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_encoding == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":323
 * 
 *         if self._encoding is None:
 *             c_encoding = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             c_encoding = _cstr(self._encoding)
 */
    __pyx_v_c_encoding = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":325
 *             c_encoding = NULL
 *         else:
 *             c_encoding = _cstr(self._encoding)             # <<<<<<<<<<<<<<
 * 
 *         c_stream = python.PyFile_AsFile(self._filelike)
 */
    __pyx_t_3 = __pyx_v_self->_encoding;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":327
 *             c_encoding = _cstr(self._encoding)
 * 
 *         c_stream = python.PyFile_AsFile(self._filelike)             # <<<<<<<<<<<<<<
 *         if c_stream is NULL:
 *             c_read_callback  = _readFilelikeParser
 */
  __pyx_t_3 = __pyx_v_self->_filelike;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_c_stream = PyFile_AsFile(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":328
 * 
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:             # <<<<<<<<<<<<<<
 *             c_read_callback  = _readFilelikeParser
 *             c_callback_context = <python.PyObject*>self
 */
  __pyx_t_2 = ((__pyx_v_c_stream == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":329
 *         c_stream = python.PyFile_AsFile(self._filelike)
 *         if c_stream is NULL:
 *             c_read_callback  = _readFilelikeParser             # <<<<<<<<<<<<<<
 *             c_callback_context = <python.PyObject*>self
 *         else:
 */
    __pyx_v_c_read_callback = __pyx_f_4lxml_5etree__readFilelikeParser;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":330
 *         if c_stream is NULL:
 *             c_read_callback  = _readFilelikeParser
 *             c_callback_context = <python.PyObject*>self             # <<<<<<<<<<<<<<
 *         else:
 *             c_read_callback  = _readFileParser
 */
    __pyx_v_c_callback_context = ((PyObject *)__pyx_v_self);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":332
 *             c_callback_context = <python.PyObject*>self
 *         else:
 *             c_read_callback  = _readFileParser             # <<<<<<<<<<<<<<
 *             c_callback_context = c_stream
 * 
 */
    __pyx_v_c_read_callback = __pyx_f_4lxml_5etree__readFileParser;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":333
 *         else:
 *             c_read_callback  = _readFileParser
 *             c_callback_context = c_stream             # <<<<<<<<<<<<<<
 * 
 *         orig_options = ctxt.options
 */
    __pyx_v_c_callback_context = __pyx_v_c_stream;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":335
 *             c_callback_context = c_stream
 * 
 *         orig_options = ctxt.options             # <<<<<<<<<<<<<<
 *         with nogil:
 *             if ctxt.html:
 */
  __pyx_t_4 = __pyx_v_ctxt->options;
  __pyx_v_orig_options = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":336
 * 
 *         orig_options = ctxt.options
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":337
 *         orig_options = ctxt.options
 *         with nogil:
 *             if ctxt.html:             # <<<<<<<<<<<<<<
 *                 result = htmlparser.htmlCtxtReadIO(
 *                         ctxt, c_read_callback, NULL, c_callback_context,
 */
        __pyx_t_2 = (__pyx_v_ctxt->html != 0);
        if (__pyx_t_2) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":338
 *         with nogil:
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(             # <<<<<<<<<<<<<<
 *                         ctxt, c_read_callback, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 */
          __pyx_v_result = htmlCtxtReadIO(__pyx_v_ctxt, __pyx_v_c_read_callback, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":341
 *                         ctxt, c_read_callback, NULL, c_callback_context,
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:             # <<<<<<<<<<<<<<
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 */
          __pyx_t_2 = ((__pyx_v_result != NULL) != 0);
          if (__pyx_t_2) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":342
 *                         self._c_url, c_encoding, options)
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL
 */
            __pyx_t_2 = ((__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_ctxt->dict, __pyx_v_result) < 0) != 0);
            if (__pyx_t_2) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":343
 *                 if result is not NULL:
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                         result = NULL
 *             else:
 */
              xmlFreeDoc(__pyx_v_result);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":344
 *                     if _fixHtmlDictNames(ctxt.dict, result) < 0:
 *                         tree.xmlFreeDoc(result)
 *                         result = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(
 */
              __pyx_v_result = NULL;
              goto __pyx_L10;
            }
            __pyx_L10:;
            goto __pyx_L9;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":346
 *                         result = NULL
 *             else:
 *                 result = xmlparser.xmlCtxtReadIO(             # <<<<<<<<<<<<<<
 *                     ctxt, c_read_callback, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
 */
          __pyx_v_result = xmlCtxtReadIO(__pyx_v_ctxt, __pyx_v_c_read_callback, NULL, __pyx_v_c_callback_context, __pyx_v_self->_c_url, __pyx_v_c_encoding, __pyx_v_options);
        }
        __pyx_L8:;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":336
 * 
 *         orig_options = ctxt.options
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if ctxt.html:
 *                 result = htmlparser.htmlCtxtReadIO(
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":349
 *                     ctxt, c_read_callback, NULL, c_callback_context,
 *                     self._c_url, c_encoding, options)
 *         ctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 *         try:
 *             self._close_file()
 */
  __pyx_v_ctxt->options = __pyx_v_orig_options;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":350
 *                     self._c_url, c_encoding, options)
 *         ctxt.options = orig_options # work around libxml2 problem
 *         try:             # <<<<<<<<<<<<<<
 *             self._close_file()
 *         except:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":351
 *         ctxt.options = orig_options # work around libxml2 problem
 *         try:
 *             self._close_file()             # <<<<<<<<<<<<<<
 *         except:
 *             self._exc_context._store_raised()
 */
        __pyx_t_3 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L21_try_end;
      __pyx_L14_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":352
 *         try:
 *             self._close_file()
 *         except:             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext._readDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":353
 *             self._close_file()
 *         except:
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return result  # swallow any exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L15_exception_handled;
      }
      __pyx_L16_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L12_error;
      __pyx_L15_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L21_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":355
 *             self._exc_context._store_raised()
 *         finally:
 *             return result  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_result;
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L12_error:;
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        __pyx_r = __pyx_v_result;
        goto __pyx_L24_return;
      }
      __pyx_L24_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":314
 *             return xmlparser.xmlIOParseDTD(NULL, c_buffer, 0)
 * 
 *     cdef xmlDoc* _readDoc(self, xmlparser.xmlParserCtxt* ctxt, int options):             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* result
 *         cdef char* c_encoding
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":357
 *             return result  # swallow any exceptions
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested):             # <<<<<<<<<<<<<<
 *         cdef int c_byte_count = 0
 *         cdef char* c_start
 */

static int __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_c_requested) {
  int __pyx_v_c_byte_count;
  char *__pyx_v_c_start;
  Py_ssize_t __pyx_v_byte_count;
  Py_ssize_t __pyx_v_remaining;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copyToBuffer", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":358
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested):
 *         cdef int c_byte_count = 0             # <<<<<<<<<<<<<<
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 */
  __pyx_v_c_byte_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":361
 *         cdef char* c_start
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         try:
 */
  __pyx_t_1 = ((__pyx_v_self->_bytes_read < 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":362
 *         cdef Py_ssize_t byte_count, remaining
 *         if self._bytes_read < 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         try:
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":363
 *         if self._bytes_read < 0:
 *             return 0
 *         try:             # <<<<<<<<<<<<<<
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":364
 *             return 0
 *         try:
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)             # <<<<<<<<<<<<<<
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:
 */
        __pyx_t_5 = __pyx_v_self->_bytes;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_byte_count = PyBytes_GET_SIZE(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":365
 *         try:
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read             # <<<<<<<<<<<<<<
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 */
        __pyx_v_remaining = (__pyx_v_byte_count - __pyx_v_self->_bytes_read);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":366
 *             byte_count = python.PyBytes_GET_SIZE(self._bytes)
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 */
        while (1) {
          __pyx_t_1 = ((__pyx_v_c_requested > __pyx_v_remaining) != 0);
          if (!__pyx_t_1) break;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":367
 *             remaining  = byte_count - self._bytes_read
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining
 */
          __pyx_t_5 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_5) + __pyx_v_self->_bytes_read);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":368
 *             while c_requested > remaining:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)             # <<<<<<<<<<<<<<
 *                 c_byte_count += remaining
 *                 c_buffer += remaining
 */
          memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_remaining);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":369
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining             # <<<<<<<<<<<<<<
 *                 c_buffer += remaining
 *                 c_requested -= remaining
 */
          __pyx_v_c_byte_count = (__pyx_v_c_byte_count + __pyx_v_remaining);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":370
 *                 cstring_h.memcpy(c_buffer, c_start, remaining)
 *                 c_byte_count += remaining
 *                 c_buffer += remaining             # <<<<<<<<<<<<<<
 *                 c_requested -= remaining
 * 
 */
          __pyx_v_c_buffer = (__pyx_v_c_buffer + __pyx_v_remaining);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":371
 *                 c_byte_count += remaining
 *                 c_buffer += remaining
 *                 c_requested -= remaining             # <<<<<<<<<<<<<<
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 */
          __pyx_v_c_requested = (__pyx_v_c_requested - __pyx_v_remaining);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":373
 *                 c_requested -= remaining
 * 
 *                 self._bytes = self._filelike.read(c_requested)             # <<<<<<<<<<<<<<
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_n_s_read); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_c_requested); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_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 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GIVEREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_v_self->_bytes);
          __Pyx_DECREF(__pyx_v_self->_bytes);
          __pyx_v_self->_bytes = __pyx_t_6;
          __pyx_t_6 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":374
 * 
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):             # <<<<<<<<<<<<<<
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:
 */
          __pyx_t_6 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_1 = PyBytes_Check(__pyx_t_6); 
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_8 = ((!(__pyx_t_1 != 0)) != 0);
          if (__pyx_t_8) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":375
 *                 self._bytes = self._filelike.read(c_requested)
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):             # <<<<<<<<<<<<<<
 *                         if self._encoding is None:
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 */
            __pyx_t_6 = __pyx_v_self->_bytes;
            __Pyx_INCREF(__pyx_t_6);
            __pyx_t_8 = PyUnicode_Check(__pyx_t_6); 
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_1 = (__pyx_t_8 != 0);
            if (__pyx_t_1) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":376
 *                 if not isinstance(self._bytes, bytes):
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:             # <<<<<<<<<<<<<<
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 */
              __pyx_t_1 = (__pyx_v_self->_encoding == Py_None);
              __pyx_t_8 = (__pyx_t_1 != 0);
              if (__pyx_t_8) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":377
 *                     if isinstance(self._bytes, unicode):
 *                         if self._encoding is None:
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')             # <<<<<<<<<<<<<<
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
 */
                if (unlikely(__pyx_v_self->_bytes == Py_None)) {
                  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
                  {__pyx_filename = __pyx_f[6]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                }
                __pyx_t_6 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_self->_bytes)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_GIVEREF(__pyx_t_6);
                __Pyx_GOTREF(__pyx_v_self->_bytes);
                __Pyx_DECREF(__pyx_v_self->_bytes);
                __pyx_v_self->_bytes = __pyx_t_6;
                __pyx_t_6 = 0;
                goto __pyx_L19;
              }
              /*else*/ {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":380
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(
 *                                 self._bytes, _cstr(self._encoding), NULL)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._close_file()
 */
                __pyx_t_6 = __pyx_v_self->_bytes;
                __Pyx_INCREF(__pyx_t_6);
                __pyx_t_7 = __pyx_v_self->_encoding;
                __Pyx_INCREF(__pyx_t_7);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":379
 *                             self._bytes = (<unicode>self._bytes).encode('utf8')
 *                         else:
 *                             self._bytes = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 */
                __pyx_t_5 = PyUnicode_AsEncodedString(__pyx_t_6, PyBytes_AS_STRING(__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                __Pyx_GIVEREF(__pyx_t_5);
                __Pyx_GOTREF(__pyx_v_self->_bytes);
                __Pyx_DECREF(__pyx_v_self->_bytes);
                __pyx_v_self->_bytes = __pyx_t_5;
                __pyx_t_5 = 0;
              }
              __pyx_L19:;
              goto __pyx_L18;
            }
            /*else*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":382
 *                                 self._bytes, _cstr(self._encoding), NULL)
 *                     else:
 *                         self._close_file()             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             u"reading from file-like objects must return byte strings or unicode strings"
 */
              __pyx_t_5 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":383
 *                     else:
 *                         self._close_file()
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             u"reading from file-like objects must return byte strings or unicode strings"
 * 
 */
              __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_reading_from_file_like_objects_m, 0, 0);
              {__pyx_filename = __pyx_f[6]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            __pyx_L18:;
            goto __pyx_L17;
          }
          __pyx_L17:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":386
 *                             u"reading from file-like objects must return byte strings or unicode strings"
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)             # <<<<<<<<<<<<<<
 *                 if remaining == 0:
 *                     self._bytes_read = -1
 */
          __pyx_t_5 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_remaining = PyBytes_GET_SIZE(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":387
 * 
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:             # <<<<<<<<<<<<<<
 *                     self._bytes_read = -1
 *                     self._close_file()
 */
          __pyx_t_8 = ((__pyx_v_remaining == 0) != 0);
          if (__pyx_t_8) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":388
 *                 remaining = python.PyBytes_GET_SIZE(self._bytes)
 *                 if remaining == 0:
 *                     self._bytes_read = -1             # <<<<<<<<<<<<<<
 *                     self._close_file()
 *                     return c_byte_count
 */
            __pyx_v_self->_bytes_read = -1;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":389
 *                 if remaining == 0:
 *                     self._bytes_read = -1
 *                     self._close_file()             # <<<<<<<<<<<<<<
 *                     return c_byte_count
 *                 self._bytes_read = 0
 */
            __pyx_t_5 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":390
 *                     self._bytes_read = -1
 *                     self._close_file()
 *                     return c_byte_count             # <<<<<<<<<<<<<<
 *                 self._bytes_read = 0
 * 
 */
            __pyx_r = __pyx_v_c_byte_count;
            goto __pyx_L11_try_return;
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":391
 *                     self._close_file()
 *                     return c_byte_count
 *                 self._bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *             if c_requested > 0:
 */
          __pyx_v_self->_bytes_read = 0;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":393
 *                 self._bytes_read = 0
 * 
 *             if c_requested > 0:             # <<<<<<<<<<<<<<
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 */
        __pyx_t_8 = ((__pyx_v_c_requested > 0) != 0);
        if (__pyx_t_8) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":394
 * 
 *             if c_requested > 0:
 *                 c_start = _cstr(self._bytes) + self._bytes_read             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested
 */
          __pyx_t_5 = __pyx_v_self->_bytes;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_c_start = (PyBytes_AS_STRING(__pyx_t_5) + __pyx_v_self->_bytes_read);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":395
 *             if c_requested > 0:
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)             # <<<<<<<<<<<<<<
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested
 */
          memcpy(__pyx_v_c_buffer, __pyx_v_c_start, __pyx_v_c_requested);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":396
 *                 c_start = _cstr(self._bytes) + self._bytes_read
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested             # <<<<<<<<<<<<<<
 *                 self._bytes_read += c_requested
 *         except:
 */
          __pyx_v_c_byte_count = (__pyx_v_c_byte_count + __pyx_v_c_requested);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":397
 *                 cstring_h.memcpy(c_buffer, c_start, c_requested)
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested             # <<<<<<<<<<<<<<
 *         except:
 *             c_byte_count = -1
 */
          __pyx_v_self->_bytes_read = (__pyx_v_self->_bytes_read + __pyx_v_c_requested);
          goto __pyx_L21;
        }
        __pyx_L21:;
      }
      __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;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":398
 *                 c_byte_count += c_requested
 *                 self._bytes_read += c_requested
 *         except:             # <<<<<<<<<<<<<<
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FileReaderContext.copyToBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_6);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":399
 *                 self._bytes_read += c_requested
 *         except:
 *             c_byte_count = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *             try:
 */
        __pyx_v_c_byte_count = -1;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":400
 *         except:
 *             c_byte_count = -1
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *             try:
 *                 self._close_file()
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":401
 *             c_byte_count = -1
 *             self._exc_context._store_raised()
 *             try:             # <<<<<<<<<<<<<<
 *                 self._close_file()
 *             except:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":402
 *             self._exc_context._store_raised()
 *             try:
 *                 self._close_file()             # <<<<<<<<<<<<<<
 *             except:
 *                 self._exc_context._store_raised()
 */
            __pyx_t_12 = __pyx_f_4lxml_5etree_18_FileReaderContext__close_file(__pyx_v_self); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L31_try_end;
          __pyx_L24_error:;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":403
 *             try:
 *                 self._close_file()
 *             except:             # <<<<<<<<<<<<<<
 *                 self._exc_context._store_raised()
 *         finally:
 */
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree._FileReaderContext.copyToBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_GOTREF(__pyx_t_14);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":404
 *                 self._close_file()
 *             except:
 *                 self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return c_byte_count  # swallow any exceptions
 */
            ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            goto __pyx_L25_exception_handled;
          }
          __pyx_L26_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L9_except_error;
          __pyx_L25_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          __pyx_L31_try_end:;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L5_error;
      __pyx_L11_try_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_return;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":406
 *                 self._exc_context._store_raised()
 *         finally:
 *             return c_byte_count  # swallow any exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      {
        __pyx_r = __pyx_v_c_byte_count;
        goto __pyx_L34_return;
      }
      __pyx_L34_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0;
      goto __pyx_L0;
    }
    __pyx_L4_return: {
      __pyx_r = __pyx_v_c_byte_count;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":357
 *             return result  # swallow any exceptions
 * 
 *     cdef int copyToBuffer(self, char* c_buffer, int c_requested):             # <<<<<<<<<<<<<<
 *         cdef int c_byte_count = 0
 *         cdef char* c_start
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":408
 *             return c_byte_count  # swallow any exceptions
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:             # <<<<<<<<<<<<<<
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 */

static int __pyx_f_4lxml_5etree__readFilelikeParser(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_c_size) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_readFilelikeParser", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":409
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)             # <<<<<<<<<<<<<<
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:
 */
  __pyx_r = __pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer(((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_v_ctxt), __pyx_v_c_buffer, __pyx_v_c_size);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":408
 *             return c_byte_count  # swallow any exceptions
 * 
 * cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil:             # <<<<<<<<<<<<<<
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":411
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:             # <<<<<<<<<<<<<<
 *     return stdio.fread(c_buffer, 1,  c_size, <stdio.FILE*>ctxt)
 * 
 */

static int __pyx_f_4lxml_5etree__readFileParser(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_c_size) {
  int __pyx_r;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":412
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:
 *     return stdio.fread(c_buffer, 1,  c_size, <stdio.FILE*>ctxt)             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_r = fread(__pyx_v_c_buffer, 1, __pyx_v_c_size, ((FILE *)__pyx_v_ctxt));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":411
 *     return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size)
 * 
 * cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil:             # <<<<<<<<<<<<<<
 *     return stdio.fread(c_buffer, 1,  c_size, <stdio.FILE*>ctxt)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":418
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(const_char* c_url, const_char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) with gil:
 *     cdef _ResolverContext context
 */

static xmlParserInput *__pyx_f_4lxml_5etree__local_resolver(const char *__pyx_v_c_url, const char *__pyx_v_c_pubid, xmlParserCtxt *__pyx_v_c_context) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *__pyx_v_context = 0;
  xmlParserInput *__pyx_v_c_input;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_file_context = 0;
  PyObject *__pyx_v_url = NULL;
  PyObject *__pyx_v_pubid = NULL;
  PyObject *__pyx_v_data = NULL;
  char *__pyx_v_c_filename;
  xmlParserInput *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  const xmlChar *__pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_local_resolver", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":427
 *     # passed, check to see if the thread state object has an implied
 *     # context.
 *     if c_context._private is not NULL:             # <<<<<<<<<<<<<<
 *         context = <_ResolverContext>c_context._private
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_context->_private != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":428
 *     # context.
 *     if c_context._private is not NULL:
 *         context = <_ResolverContext>c_context._private             # <<<<<<<<<<<<<<
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_c_context->_private);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":430
 *         context = <_ResolverContext>c_context._private
 *     else:
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()             # <<<<<<<<<<<<<<
 * 
 *     if context is None:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":432
 *         context = __GLOBAL_PARSER_CONTEXT.findImpliedContext()
 * 
 *     if context is None:             # <<<<<<<<<<<<<<
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_context) == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":433
 * 
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *             return NULL
 *         with nogil:
 */
    __pyx_t_3 = ((__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":434
 *     if context is None:
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL             # <<<<<<<<<<<<<<
 *         with nogil:
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 */
      __pyx_r = NULL;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":435
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":437
 *         with nogil:
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)             # <<<<<<<<<<<<<<
 *         return c_input
 * 
 */
          __pyx_v_c_input = __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER(__pyx_v_c_url, __pyx_v_c_pubid, __pyx_v_c_context);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":435
 *         if __DEFAULT_ENTITY_LOADER is NULL:
 *             return NULL
 *         with nogil:             # <<<<<<<<<<<<<<
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":438
 *             # free the GIL as we might do serious I/O here (e.g. HTTP)
 *             c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 *         return c_input             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_r = __pyx_v_c_input;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":440
 *         return c_input
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if c_url is NULL:
 *             url = None
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":441
 * 
 *     try:
 *         if c_url is NULL:             # <<<<<<<<<<<<<<
 *             url = None
 *         else:
 */
      __pyx_t_3 = ((__pyx_v_c_url == NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":442
 *     try:
 *         if c_url is NULL:
 *             url = None             # <<<<<<<<<<<<<<
 *         else:
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 */
        __Pyx_INCREF(Py_None);
        __pyx_v_url = Py_None;
        goto __pyx_L17;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":445
 *         else:
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(<const_xmlChar*>c_url)             # <<<<<<<<<<<<<<
 *         if c_pubid is NULL:
 *             pubid = None
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__decodeFilename(((const xmlChar *)__pyx_v_c_url)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_url = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L17:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":446
 *             # parsing a related document (DTD etc.) => UTF-8 encoded URL?
 *             url = _decodeFilename(<const_xmlChar*>c_url)
 *         if c_pubid is NULL:             # <<<<<<<<<<<<<<
 *             pubid = None
 *         else:
 */
      __pyx_t_3 = ((__pyx_v_c_pubid == NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":447
 *             url = _decodeFilename(<const_xmlChar*>c_url)
 *         if c_pubid is NULL:
 *             pubid = None             # <<<<<<<<<<<<<<
 *         else:
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8
 */
        __Pyx_INCREF(Py_None);
        __pyx_v_pubid = Py_None;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":449
 *             pubid = None
 *         else:
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8             # <<<<<<<<<<<<<<
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(((const xmlChar *)__pyx_v_c_pubid)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_pubid = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L18:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":451
 *             pubid = funicode(<const_xmlChar*>c_pubid) # always UTF-8
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)             # <<<<<<<<<<<<<<
 *     except:
 *         context._store_raised()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context->_resolvers), __pyx_n_s_resolve); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_url);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_url);
      __Pyx_GIVEREF(__pyx_v_url);
      __Pyx_INCREF(__pyx_v_pubid);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_pubid);
      __Pyx_GIVEREF(__pyx_v_pubid);
      __Pyx_INCREF(((PyObject *)__pyx_v_context));
      PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_v_context));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_4lxml_5etree__InputDocument))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
      __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_8);
      __pyx_t_8 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L16_try_end;
    __pyx_L9_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":452
 * 
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 *     except:             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *         return NULL
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._local_resolver", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":453
 *         doc_ref = context._resolvers.resolve(url, pubid, context)
 *     except:
 *         context._store_raised()             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ResolverContext *)__pyx_v_context->__pyx_base.__pyx_vtab)->__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":454
 *     except:
 *         context._store_raised()
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     if doc_ref is not None:
 */
      __pyx_r = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L12_except_return;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L10_exception_handled;
    }
    __pyx_L11_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L12_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L10_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L16_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":456
 *         return NULL
 * 
 *     if doc_ref is not None:             # <<<<<<<<<<<<<<
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":472
 *                 c_input = xmlparser.xmlNewInputFromFile(
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)
 */
    switch (__pyx_v_doc_ref->_type) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":457
 * 
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *             data = doc_ref._data_bytes
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 */
      case __pyx_e_4lxml_5etree_PARSER_DATA_STRING:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":458
 *     if doc_ref is not None:
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes             # <<<<<<<<<<<<<<
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:
 */
      __pyx_t_2 = __pyx_v_doc_ref->_data_bytes;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_data = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":459
 *         if doc_ref._type == PARSER_DATA_STRING:
 *             data = doc_ref._data_bytes
 *             c_input = xmlparser.xmlNewInputStream(c_context)             # <<<<<<<<<<<<<<
 *             if c_input is not NULL:
 *                 c_input.base = _xcstr(data)
 */
      __pyx_v_c_input = xmlNewInputStream(__pyx_v_c_context);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":460
 *             data = doc_ref._data_bytes
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:             # <<<<<<<<<<<<<<
 *                 c_input.base = _xcstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 */
      __pyx_t_1 = ((__pyx_v_c_input != NULL) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":461
 *             c_input = xmlparser.xmlNewInputStream(c_context)
 *             if c_input is not NULL:
 *                 c_input.base = _xcstr(data)             # <<<<<<<<<<<<<<
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 *                 c_input.cur = c_input.base
 */
        __pyx_v_c_input->base = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_data);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":462
 *             if c_input is not NULL:
 *                 c_input.base = _xcstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *                 c_input.cur = c_input.base
 *                 c_input.end = c_input.base + c_input.length
 */
        __pyx_v_c_input->length = PyBytes_GET_SIZE(__pyx_v_data);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":463
 *                 c_input.base = _xcstr(data)
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 *                 c_input.cur = c_input.base             # <<<<<<<<<<<<<<
 *                 c_input.end = c_input.base + c_input.length
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 */
        __pyx_t_9 = __pyx_v_c_input->base;
        __pyx_v_c_input->cur = __pyx_t_9;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":464
 *                 c_input.length = python.PyBytes_GET_SIZE(data)
 *                 c_input.cur = c_input.base
 *                 c_input.end = c_input.base + c_input.length             # <<<<<<<<<<<<<<
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             data = None
 */
        __pyx_v_c_input->end = (__pyx_v_c_input->base + __pyx_v_c_input->length);
        goto __pyx_L22;
      }
      __pyx_L22:;
      break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":465
 *                 c_input.cur = c_input.base
 *                 c_input.end = c_input.base + c_input.length
 *         elif doc_ref._type == PARSER_DATA_FILENAME:             # <<<<<<<<<<<<<<
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)
 */
      case __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":466
 *                 c_input.end = c_input.base + c_input.length
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             data = None             # <<<<<<<<<<<<<<
 *             c_filename = _cstr(doc_ref._filename)
 *             with nogil:
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_data = Py_None;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":467
 *         elif doc_ref._type == PARSER_DATA_FILENAME:
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 # free the GIL as we might do serious I/O here
 */
      __pyx_t_2 = __pyx_v_doc_ref->_filename;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":468
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 # free the GIL as we might do serious I/O here
 *                 c_input = xmlparser.xmlNewInputFromFile(
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":470
 *             with nogil:
 *                 # free the GIL as we might do serious I/O here
 *                 c_input = xmlparser.xmlNewInputFromFile(             # <<<<<<<<<<<<<<
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:
 */
            __pyx_v_c_input = xmlNewInputFromFile(__pyx_v_c_context, __pyx_v_c_filename);
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":468
 *             data = None
 *             c_filename = _cstr(doc_ref._filename)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 # free the GIL as we might do serious I/O here
 *                 c_input = xmlparser.xmlNewInputFromFile(
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L25;
            }
            __pyx_L25:;
          }
      }
      break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":472
 *                 c_input = xmlparser.xmlNewInputFromFile(
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)
 */
      case __pyx_e_4lxml_5etree_PARSER_DATA_FILE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":474
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)             # <<<<<<<<<<<<<<
 *             c_input = file_context._createParserInput(c_context)
 *             data = file_context
 */
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_doc_ref->_close_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":473
 *                     c_context, c_filename)
 *         elif doc_ref._type == PARSER_DATA_FILE:
 *             file_context = _FileReaderContext(doc_ref._file, context, url,             # <<<<<<<<<<<<<<
 *                                               None, doc_ref._close_file)
 *             c_input = file_context._createParserInput(c_context)
 */
      __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_doc_ref->_file);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_doc_ref->_file);
      __Pyx_GIVEREF(__pyx_v_doc_ref->_file);
      __Pyx_INCREF(((PyObject *)__pyx_v_context));
      PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_context));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
      __Pyx_INCREF(__pyx_v_url);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_url);
      __Pyx_GIVEREF(__pyx_v_url);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_7, 3, Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileReaderContext)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":475
 *             file_context = _FileReaderContext(doc_ref._file, context, url,
 *                                               None, doc_ref._close_file)
 *             c_input = file_context._createParserInput(c_context)             # <<<<<<<<<<<<<<
 *             data = file_context
 *         else:
 */
      __pyx_v_c_input = __pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput(__pyx_v_file_context, __pyx_v_c_context);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":476
 *                                               None, doc_ref._close_file)
 *             c_input = file_context._createParserInput(c_context)
 *             data = file_context             # <<<<<<<<<<<<<<
 *         else:
 *             data = None
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_file_context));
      __pyx_v_data = ((PyObject *)__pyx_v_file_context);
      break;
      default:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":478
 *             data = file_context
 *         else:
 *             data = None             # <<<<<<<<<<<<<<
 *             c_input = NULL
 * 
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_data = Py_None;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":479
 *         else:
 *             data = None
 *             c_input = NULL             # <<<<<<<<<<<<<<
 * 
 *         if data is not None:
 */
      __pyx_v_c_input = NULL;
      break;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":481
 *             c_input = NULL
 * 
 *         if data is not None:             # <<<<<<<<<<<<<<
 *             context._storage.add(data)
 *         if c_input is not NULL:
 */
    __pyx_t_1 = (__pyx_v_data != Py_None);
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":482
 * 
 *         if data is not None:
 *             context._storage.add(data)             # <<<<<<<<<<<<<<
 *         if c_input is not NULL:
 *             return c_input
 */
      __pyx_t_10 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_context->_storage, __pyx_v_data); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L26;
    }
    __pyx_L26:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":483
 *         if data is not None:
 *             context._storage.add(data)
 *         if c_input is not NULL:             # <<<<<<<<<<<<<<
 *             return c_input
 * 
 */
    __pyx_t_3 = ((__pyx_v_c_input != NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":484
 *             context._storage.add(data)
 *         if c_input is not NULL:
 *             return c_input             # <<<<<<<<<<<<<<
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 */
      __pyx_r = __pyx_v_c_input;
      goto __pyx_L0;
    }
    goto __pyx_L21;
  }
  __pyx_L21:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":486
 *             return c_input
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  __pyx_t_3 = ((__pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":487
 * 
 *     if __DEFAULT_ENTITY_LOADER is NULL:
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    __pyx_r = NULL;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":489
 *         return NULL
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":491
 *     with nogil:
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)             # <<<<<<<<<<<<<<
 *     return c_input
 * 
 */
        __pyx_v_c_input = __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER(__pyx_v_c_url, __pyx_v_c_pubid, __pyx_v_c_context);
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":489
 *         return NULL
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L31;
        }
        __pyx_L31:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":492
 *         # free the GIL as we might do serious I/O here (e.g. HTTP)
 *         c_input = __DEFAULT_ENTITY_LOADER(c_url, c_pubid, c_context)
 *     return c_input             # <<<<<<<<<<<<<<
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
 */
  __pyx_r = __pyx_v_c_input;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":418
 * ############################################################
 * 
 * cdef xmlparser.xmlParserInput* _local_resolver(const_char* c_url, const_char* c_pubid,             # <<<<<<<<<<<<<<
 *                                                xmlparser.xmlParserCtxt* c_context) with gil:
 *     cdef _ResolverContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("lxml.etree._local_resolver", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XDECREF((PyObject *)__pyx_v_file_context);
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_XDECREF(__pyx_v_pubid);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":511
 *     cdef _Document _doc
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:
 */

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

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

static int __pyx_pf_4lxml_5etree_14_ParserContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":512
 * 
 *     def __cinit__(self):
 *         self._c_ctxt = NULL             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_THREADING:
 *             self._lock = NULL
 */
  __pyx_v_self->_c_ctxt = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":513
 *     def __cinit__(self):
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._lock = NULL
 *         else:
 */
  __pyx_t_1 = ((!(ENABLE_THREADING != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":514
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:
 *             self._lock = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             self._lock = python.PyThread_allocate_lock()
 */
    __pyx_v_self->_lock = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":516
 *             self._lock = NULL
 *         else:
 *             self._lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */
    __pyx_v_self->_lock = PyThread_allocate_lock();
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":517
 *         else:
 *             self._lock = python.PyThread_allocate_lock()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":511
 *     cdef _Document _doc
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = NULL
 *         if not config.ENABLE_THREADING:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":519
 *         self._error_log = _ErrorLog()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_14_ParserContext_2__dealloc__(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_14_ParserContext_2__dealloc__(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":520
 * 
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_free_lock(self._lock)
 *         if self._c_ctxt is not NULL:
 */
  if ((ENABLE_THREADING != 0)) {
    __pyx_t_1 = ((__pyx_v_self->_lock != NULL) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = (ENABLE_THREADING != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":521
 *     def __dealloc__(self):
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 */
    PyThread_free_lock(__pyx_v_self->_lock);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":522
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_c_ctxt != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":523
 *             python.PyThread_free_lock(self._lock)
 *         if self._c_ctxt is not NULL:
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
 */
    xmlFreeParserCtxt(__pyx_v_self->_c_ctxt);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":519
 *         self._error_log = _ErrorLog()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_free_lock(self._lock)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":525
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         context = self.__class__()
 */

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_14_ParserContext__copy(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":527
 *     cdef _ParserContext _copy(self):
 *         cdef _ParserContext context
 *         context = self.__class__()             # <<<<<<<<<<<<<<
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__ParserContext))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":528
 *         cdef _ParserContext context
 *         context = self.__class__()
 *         context._validator = self._validator.copy()             # <<<<<<<<<<<<<<
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(__pyx_v_self->_validator)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_context->_validator);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_validator));
  __pyx_v_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":529
 *         context = self.__class__()
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree_17_ResolverRegistry__copy(__pyx_v_self->__pyx_base._resolvers)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__initParserContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 529; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":530
 *         context._validator = self._validator.copy()
 *         _initParserContext(context, self._resolvers._copy(), NULL)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":525
 *             xmlparser.xmlFreeParserCtxt(self._c_ctxt)
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         context = self.__class__()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":532
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self
 */

static void __pyx_f_4lxml_5etree_14_ParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_initParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":533
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         self._c_ctxt = c_ctxt             # <<<<<<<<<<<<<<
 *         c_ctxt._private = <void*>self
 * 
 */
  __pyx_v_self->_c_ctxt = __pyx_v_c_ctxt;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":534
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self             # <<<<<<<<<<<<<<
 * 
 *     cdef void _resetParserContext(self):
 */
  __pyx_v_c_ctxt->_private = ((void *)__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":532
 *         return context
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         self._c_ctxt = c_ctxt
 *         c_ctxt._private = <void*>self
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":536
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 */

static void __pyx_f_4lxml_5etree_14_ParserContext__resetParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_resetParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":537
 * 
 *     cdef void _resetParserContext(self):
 *         if self._c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 */
  __pyx_t_1 = ((__pyx_v_self->_c_ctxt != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":538
 *     cdef void _resetParserContext(self):
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 */
    __pyx_t_1 = (__pyx_v_self->_c_ctxt->html != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":539
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)             # <<<<<<<<<<<<<<
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             elif self._c_ctxt.spaceTab is not NULL or \
 */
      htmlCtxtReset(__pyx_v_self->_c_ctxt);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":540
 *             if self._c_ctxt.html:
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2             # <<<<<<<<<<<<<<
 *             elif self._c_ctxt.spaceTab is not NULL or \
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2
 */
      __pyx_v_self->_c_ctxt->disableSAX = 0;
      goto __pyx_L4;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":541
 *                 htmlparser.htmlCtxtReset(self._c_ctxt)
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             elif self._c_ctxt.spaceTab is not NULL or \             # <<<<<<<<<<<<<<
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 */
    __pyx_t_1 = ((__pyx_v_self->_c_ctxt->spaceTab != NULL) != 0);
    if (!__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":542
 *                 self._c_ctxt.disableSAX = 0 # work around bug in libxml2
 *             elif self._c_ctxt.spaceTab is not NULL or \
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 * 
 */
      __pyx_t_2 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20629) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":543
 *             elif self._c_ctxt.spaceTab is not NULL or \
 *                     _LIBXML_VERSION_INT >= 20629: # work around bug in libxml2
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef int prepare(self) except -1:
 */
      xmlClearParserCtxt(__pyx_v_self->_c_ctxt);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":536
 *         c_ctxt._private = <void*>self
 * 
 *     cdef void _resetParserContext(self):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt is not NULL:
 *             if self._c_ctxt.html:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":545
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 * 
 *     cdef int prepare(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 */

static int __pyx_f_4lxml_5etree_14_ParserContext_prepare(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_v_result;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":547
 *     cdef int prepare(self) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 */
  if ((ENABLE_THREADING != 0)) {
    __pyx_t_1 = ((__pyx_v_self->_lock != NULL) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = (ENABLE_THREADING != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":548
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":549
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(             # <<<<<<<<<<<<<<
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:
 */
          __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_lock, WAIT_LOCK);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":548
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":551
 *                 result = python.PyThread_acquire_lock(
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise ParserError, u"parser locking failed"
 *         self._error_log.clear()
 */
    __pyx_t_2 = ((__pyx_v_result == 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":552
 *                     self._lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise ParserError, u"parser locking failed"             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 *         self._doc = None
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ParserError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, __pyx_kp_u_parser_locking_failed, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":553
 *             if result == 0:
 *                 raise ParserError, u"parser locking failed"
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 *         self._doc = None
 *         self._c_ctxt.sax.serror = _receiveParserError
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->_error_log, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":554
 *                 raise ParserError, u"parser locking failed"
 *         self._error_log.clear()
 *         self._doc = None             # <<<<<<<<<<<<<<
 *         self._c_ctxt.sax.serror = _receiveParserError
 *         if self._validator is not None:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":555
 *         self._error_log.clear()
 *         self._doc = None
 *         self._c_ctxt.sax.serror = _receiveParserError             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)
 */
  __pyx_v_self->_c_ctxt->sax->serror = __pyx_f_4lxml_5etree__receiveParserError;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":556
 *         self._doc = None
 *         self._c_ctxt.sax.serror = _receiveParserError
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":557
 *         self._c_ctxt.sax.serror = _receiveParserError
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_error_log);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(__pyx_v_self->_validator, __pyx_v_self->_c_ctxt, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":558
 *         if self._validator is not None:
 *             self._validator.connect(self._c_ctxt, self._error_log)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int cleanup(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":545
 *                 xmlparser.xmlClearParserCtxt(self._c_ctxt)
 * 
 *     cdef int prepare(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._ParserContext.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":560
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.disconnect()
 */

static int __pyx_f_4lxml_5etree_14_ParserContext_cleanup(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("cleanup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":561
 * 
 *     cdef int cleanup(self) except -1:
 *         if self._validator is not None:             # <<<<<<<<<<<<<<
 *             self._validator.disconnect()
 *         self._resetParserContext()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_validator) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":562
 *     cdef int cleanup(self) except -1:
 *         if self._validator is not None:
 *             self._validator.disconnect()             # <<<<<<<<<<<<<<
 *         self._resetParserContext()
 *         self.clear()
 */
    __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self->_validator);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":563
 *         if self._validator is not None:
 *             self._validator.disconnect()
 *         self._resetParserContext()             # <<<<<<<<<<<<<<
 *         self.clear()
 *         self._doc = None
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_resetParserContext(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":564
 *             self._validator.disconnect()
 *         self._resetParserContext()
 *         self.clear()             # <<<<<<<<<<<<<<
 *         self._doc = None
 *         self._c_ctxt.sax.serror = NULL
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":565
 *         self._resetParserContext()
 *         self.clear()
 *         self._doc = None             # <<<<<<<<<<<<<<
 *         self._c_ctxt.sax.serror = NULL
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":566
 *         self.clear()
 *         self._doc = None
 *         self._c_ctxt.sax.serror = NULL             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_release_lock(self._lock)
 */
  __pyx_v_self->_c_ctxt->sax->serror = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":567
 *         self._doc = None
 *         self._c_ctxt.sax.serror = NULL
 *         if config.ENABLE_THREADING and self._lock is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._lock)
 *         return 0
 */
  if ((ENABLE_THREADING != 0)) {
    __pyx_t_2 = ((__pyx_v_self->_lock != NULL) != 0);
    __pyx_t_1 = __pyx_t_2;
  } else {
    __pyx_t_1 = (ENABLE_THREADING != 0);
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":568
 *         self._c_ctxt.sax.serror = NULL
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_release_lock(self._lock)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    PyThread_release_lock(__pyx_v_self->_lock);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":569
 *         if config.ENABLE_THREADING and self._lock is not NULL:
 *             python.PyThread_release_lock(self._lock)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":560
 *         return 0
 * 
 *     cdef int cleanup(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._validator is not None:
 *             self._validator.disconnect()
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":571
 *         return 0
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 */

static PyObject *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  xmlDoc *__pyx_v_c_doc;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":573
 *     cdef object _handleParseResult(self, _BaseParser parser,
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)             # <<<<<<<<<<<<<<
 *         if self._doc is not None and self._doc._c_doc is c_doc:
 *             return self._doc
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_self, __pyx_v_parser, __pyx_v_result, __pyx_v_filename); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":574
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 *         if self._doc is not None and self._doc._c_doc is c_doc:             # <<<<<<<<<<<<<<
 *             return self._doc
 *         else:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_self->_doc) != Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = ((__pyx_v_self->_doc->_c_doc == __pyx_v_c_doc) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":575
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 *         if self._doc is not None and self._doc._c_doc is c_doc:
 *             return self._doc             # <<<<<<<<<<<<<<
 *         else:
 *             return _documentFactory(c_doc, parser)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->_doc));
    __pyx_r = ((PyObject *)__pyx_v_self->_doc);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":577
 *             return self._doc
 *         else:
 *             return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":571
 *         return 0
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                    xmlDoc* result, filename):
 *         c_doc = self._handleParseResultDoc(parser, result, filename)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":579
 *             return _documentFactory(c_doc, parser)
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 */

static xmlDoc *__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlDoc *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResultDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":581
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         return _handleParseResult(self, self._c_ctxt, result,
 *                                   filename, recover,
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":584
 *         return _handleParseResult(self, self._c_ctxt, result,
 *                                   filename, recover,
 *                                   free_doc=self._doc is None)             # <<<<<<<<<<<<<<
 * 
 * cdef _initParserContext(_ParserContext context,
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":582
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         return _handleParseResult(self, self._c_ctxt, result,             # <<<<<<<<<<<<<<
 *                                   filename, recover,
 *                                   free_doc=self._doc is None)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__handleParseResult(__pyx_v_self, __pyx_v_self->_c_ctxt, __pyx_v_result, __pyx_v_filename, __pyx_v_recover, __pyx_t_1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":579
 *             return _documentFactory(c_doc, parser)
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":586
 *                                   free_doc=self._doc is None)
 * 
 * cdef _initParserContext(_ParserContext context,             # <<<<<<<<<<<<<<
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 */

static PyObject *__pyx_f_4lxml_5etree__initParserContext(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers, xmlParserCtxt *__pyx_v_c_ctxt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":589
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)             # <<<<<<<<<<<<<<
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__initResolverContext(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_context), __pyx_v_resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":590
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *         context._initParserContext(c_ctxt)
 * 
 */
  __pyx_t_2 = ((__pyx_v_c_ctxt != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":591
 *     _initResolverContext(context, resolvers)
 *     if c_ctxt is not NULL:
 *         context._initParserContext(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil:
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_initParserContext(__pyx_v_context, __pyx_v_c_ctxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":586
 *                                   free_doc=self._doc is None)
 * 
 * cdef _initParserContext(_ParserContext context,             # <<<<<<<<<<<<<<
 *                         _ResolverRegistry resolvers,
 *                         xmlparser.xmlParserCtxt* c_ctxt):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._initParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":593
 *         context._initParserContext(c_ctxt)
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil:             # <<<<<<<<<<<<<<
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 */

static void __pyx_f_4lxml_5etree__forwardParserError(xmlParserCtxt *__pyx_v__parser_context, xmlError *__pyx_v_error) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_forwardParserError", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":594
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil:
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil:
 */
  __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v__parser_context->_private)->_error_log), __pyx_v_error);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":593
 *         context._initParserContext(c_ctxt)
 * 
 * cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil:             # <<<<<<<<<<<<<<
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":596
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 * cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
 */

static void __pyx_f_4lxml_5etree__receiveParserError(void *__pyx_v_c_context, xmlError *__pyx_v_error) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":598
 * cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil:
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:             # <<<<<<<<<<<<<<
 *             _forwardError(NULL, error)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_c_context == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((((xmlParserCtxt *)__pyx_v_c_context)->_private == NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":599
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
 *             _forwardError(NULL, error)             # <<<<<<<<<<<<<<
 *         else:
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 */
    __pyx_f_4lxml_5etree__forwardError(NULL, __pyx_v_error);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":601
 *             _forwardError(NULL, error)
 *         else:
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)             # <<<<<<<<<<<<<<
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 */
    __pyx_f_4lxml_5etree__forwardParserError(((xmlParserCtxt *)__pyx_v_c_context), __pyx_v_error);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":596
 *     (<_ParserContext>_parser_context._private)._error_log._receive(error)
 * 
 * cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     if __DEBUG:
 *         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":603
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \
 */

static int __pyx_f_4lxml_5etree__raiseParseError(xmlParserCtxt *__pyx_v_ctxt, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_error_log) {
  PyObject *__pyx_v_message = NULL;
  int __pyx_v_code;
  int __pyx_v_line;
  int __pyx_v_column;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  const xmlChar *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raiseParseError", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":605
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \             # <<<<<<<<<<<<<<
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
 */
  __pyx_t_1 = (__pyx_v_filename != Py_None);
  if ((__pyx_t_1 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":606
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:             # <<<<<<<<<<<<<<
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(
 */
    __pyx_t_2 = ((__pyx_v_ctxt->lastError.domain == XML_FROM_IO) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":607
 *     if filename is not None and \
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):             # <<<<<<<<<<<<<<
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
 */
    __pyx_t_3 = PyBytes_Check(__pyx_v_filename); 
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":609
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.message is not NULL:
 *             try:
 */
      __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (unlikely(__pyx_v_filename == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[6]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = PyBytes_GET_SIZE(((PyObject*)__pyx_v_filename)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":608
 *            ctxt.lastError.domain == xmlerror.XML_FROM_IO:
 *         if isinstance(filename, bytes):
 *             filename = _decodeFilenameWithLength(             # <<<<<<<<<<<<<<
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 */
      __pyx_t_6 = __pyx_f_4lxml_5etree__decodeFilenameWithLength(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":610
 *             filename = _decodeFilenameWithLength(
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *             try:
 *                 message = (ctxt.lastError.message).decode('utf-8')
 */
    __pyx_t_1 = ((__pyx_v_ctxt->lastError.message != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":611
 *                 <bytes>filename, len(<bytes>filename))
 *         if ctxt.lastError.message is not NULL:
 *             try:             # <<<<<<<<<<<<<<
 *                 message = (ctxt.lastError.message).decode('utf-8')
 *             except UnicodeDecodeError:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":612
 *         if ctxt.lastError.message is not NULL:
 *             try:
 *                 message = (ctxt.lastError.message).decode('utf-8')             # <<<<<<<<<<<<<<
 *             except UnicodeDecodeError:
 *                 # the filename may be in there => play safe
 */
          __pyx_t_10 = __pyx_v_ctxt->lastError.message;
          __pyx_t_6 = __Pyx_decode_c_string(__pyx_t_10, 0, strlen(__pyx_t_10), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_6);
          __pyx_v_message = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_try_end;
        __pyx_L6_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":613
 *             try:
 *                 message = (ctxt.lastError.message).decode('utf-8')
 *             except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                 # the filename may be in there => play safe
 *                 message = (ctxt.lastError.message).decode('iso8859-1')
 */
        __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("lxml.etree._raiseParseError", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_12, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_13);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":615
 *             except UnicodeDecodeError:
 *                 # the filename may be in there => play safe
 *                 message = (ctxt.lastError.message).decode('iso8859-1')             # <<<<<<<<<<<<<<
 *             message = u"Error reading file '%s': %s" % (
 *                 filename, message.strip())
 */
          __pyx_t_10 = __pyx_v_ctxt->lastError.message;
          __pyx_t_14 = __Pyx_decode_c_string(__pyx_t_10, 0, strlen(__pyx_t_10), NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_XDECREF_SET(__pyx_v_message, __pyx_t_14);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L7_exception_handled;
        }
        goto __pyx_L8_except_error;
        __pyx_L8_except_error:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L7_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L13_try_end:;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":617
 *                 message = (ctxt.lastError.message).decode('iso8859-1')
 *             message = u"Error reading file '%s': %s" % (
 *                 filename, message.strip())             # <<<<<<<<<<<<<<
 *         else:
 *             message = u"Error reading '%s'" % filename
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_12);
      __pyx_t_12 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":616
 *                 # the filename may be in there => play safe
 *                 message = (ctxt.lastError.message).decode('iso8859-1')
 *             message = u"Error reading file '%s': %s" % (             # <<<<<<<<<<<<<<
 *                 filename, message.strip())
 *         else:
 */
      __pyx_t_12 = PyUnicode_Format(__pyx_kp_u_Error_reading_file_s_s, __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_12);
      __pyx_t_12 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":619
 *                 filename, message.strip())
 *         else:
 *             message = u"Error reading '%s'" % filename             # <<<<<<<<<<<<<<
 *         raise IOError, message
 *     elif error_log:
 */
      __pyx_t_12 = PyUnicode_Format(__pyx_kp_u_Error_reading_s, __pyx_v_filename); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_v_message = __pyx_t_12;
      __pyx_t_12 = 0;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":620
 *         else:
 *             message = u"Error reading '%s'" % filename
 *         raise IOError, message             # <<<<<<<<<<<<<<
 *     elif error_log:
 *         raise error_log._buildParseException(
 */
    __Pyx_Raise(__pyx_builtin_IOError, __pyx_v_message, 0, 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":621
 *             message = u"Error reading '%s'" % filename
 *         raise IOError, message
 *     elif error_log:             # <<<<<<<<<<<<<<
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, u"Document is not well formed")
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_error_log)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":623
 *     elif error_log:
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, u"Document is not well formed")             # <<<<<<<<<<<<<<
 *     elif ctxt.lastError.message is not NULL:
 *         message = (ctxt.lastError.message).strip()
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":622
 *         raise IOError, message
 *     elif error_log:
 *         raise error_log._buildParseException(             # <<<<<<<<<<<<<<
 *             XMLSyntaxError, u"Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:
 */
    __pyx_t_13 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_error_log), __pyx_t_12, __pyx_kp_u_Document_is_not_well_formed); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_Raise(__pyx_t_13, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":624
 *         raise error_log._buildParseException(
 *             XMLSyntaxError, u"Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:             # <<<<<<<<<<<<<<
 *         message = (ctxt.lastError.message).strip()
 *         code = ctxt.lastError.code
 */
  __pyx_t_1 = ((__pyx_v_ctxt->lastError.message != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":625
 *             XMLSyntaxError, u"Document is not well formed")
 *     elif ctxt.lastError.message is not NULL:
 *         message = (ctxt.lastError.message).strip()             # <<<<<<<<<<<<<<
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
 */
    __pyx_t_13 = __Pyx_PyBytes_FromString(__pyx_v_ctxt->lastError.message); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_strip); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_message = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":626
 *     elif ctxt.lastError.message is not NULL:
 *         message = (ctxt.lastError.message).strip()
 *         code = ctxt.lastError.code             # <<<<<<<<<<<<<<
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 */
    __pyx_t_11 = __pyx_v_ctxt->lastError.code;
    __pyx_v_code = __pyx_t_11;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":627
 *         message = (ctxt.lastError.message).strip()
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line             # <<<<<<<<<<<<<<
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 */
    __pyx_t_11 = __pyx_v_ctxt->lastError.line;
    __pyx_v_line = __pyx_t_11;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":628
 *         code = ctxt.lastError.code
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2             # <<<<<<<<<<<<<<
 *         if ctxt.lastError.line > 0:
 *             message = u"line %d: %s" % (line, message)
 */
    __pyx_t_11 = __pyx_v_ctxt->lastError.int2;
    __pyx_v_column = __pyx_t_11;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":629
 *         line = ctxt.lastError.line
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:             # <<<<<<<<<<<<<<
 *             message = u"line %d: %s" % (line, message)
 *         raise XMLSyntaxError(message, code, line, column)
 */
    __pyx_t_1 = ((__pyx_v_ctxt->lastError.line > 0) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":630
 *         column = ctxt.lastError.int2
 *         if ctxt.lastError.line > 0:
 *             message = u"line %d: %s" % (line, message)             # <<<<<<<<<<<<<<
 *         raise XMLSyntaxError(message, code, line, column)
 *     else:
 */
      __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __pyx_t_13 = 0;
      __pyx_t_13 = PyUnicode_Format(__pyx_kp_u_line_d_s, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_13);
      __pyx_t_13 = 0;
      goto __pyx_L16;
    }
    __pyx_L16:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":631
 *         if ctxt.lastError.line > 0:
 *             message = u"line %d: %s" % (line, message)
 *         raise XMLSyntaxError(message, code, line, column)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 */
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_column); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    __pyx_t_12 = 0;
    __pyx_t_6 = 0;
    __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_Raise(__pyx_t_14, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":633
 *         raise XMLSyntaxError(message, code, line, column)
 *     else:
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_13, 0, Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_Raise(__pyx_t_15, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":603
 *             _forwardParserError(<xmlparser.xmlParserCtxt*>c_context, error)
 * 
 * cdef int _raiseParseError(xmlparser.xmlParserCtxt* ctxt, filename,             # <<<<<<<<<<<<<<
 *                           _ErrorLog error_log) except 0:
 *     if filename is not None and \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("lxml.etree._raiseParseError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":635
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,             # <<<<<<<<<<<<<<
 *                                 xmlparser.xmlParserCtxt* c_ctxt,
 *                                 xmlDoc* result, filename,
 */

static xmlDoc *__pyx_f_4lxml_5etree__handleParseResult(struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename, int __pyx_v_recover, int __pyx_v_free_doc) {
  int __pyx_v_well_formed;
  PyObject *__pyx_v_error = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":640
 *                                 bint recover, bint free_doc) except NULL:
 *     cdef bint well_formed
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 */
  __pyx_t_1 = ((__pyx_v_result != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":641
 *     cdef bint well_formed
 *     if result is not NULL:
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 * 
 *     if c_ctxt.myDoc is not NULL:
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":643
 *         __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 * 
 *     if c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->myDoc != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":644
 * 
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 */
    __pyx_t_1 = ((__pyx_v_c_ctxt->myDoc != __pyx_v_result) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":645
 *     if c_ctxt.myDoc is not NULL:
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 *         c_ctxt.myDoc = NULL
 */
      __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_c_ctxt->myDoc);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":646
 *         if c_ctxt.myDoc is not result:
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *         c_ctxt.myDoc = NULL
 * 
 */
      xmlFreeDoc(__pyx_v_c_ctxt->myDoc);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":647
 *             __GLOBAL_PARSER_CONTEXT.initDocDict(c_ctxt.myDoc)
 *             tree.xmlFreeDoc(c_ctxt.myDoc)
 *         c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 *     if result is not NULL:
 */
    __pyx_v_c_ctxt->myDoc = NULL;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":649
 *         c_ctxt.myDoc = NULL
 * 
 *     if result is not NULL:             # <<<<<<<<<<<<<<
 *         if context._validator is not None and \
 *                 not context._validator.isvalid():
 */
  __pyx_t_1 = ((__pyx_v_result != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":650
 * 
 *     if result is not NULL:
 *         if context._validator is not None and \             # <<<<<<<<<<<<<<
 *                 not context._validator.isvalid():
 *             well_formed = 0 # actually not 'valid', but anyway ...
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
    if ((__pyx_t_1 != 0)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":651
 *     if result is not NULL:
 *         if context._validator is not None and \
 *                 not context._validator.isvalid():             # <<<<<<<<<<<<<<
 *             well_formed = 0 # actually not 'valid', but anyway ...
 *         elif recover or (c_ctxt.wellFormed and
 */
      __pyx_t_2 = ((!(__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(__pyx_v_context->_validator) != 0)) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":652
 *         if context._validator is not None and \
 *                 not context._validator.isvalid():
 *             well_formed = 0 # actually not 'valid', but anyway ...             # <<<<<<<<<<<<<<
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 */
      __pyx_v_well_formed = 0;
      goto __pyx_L7;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":653
 *                 not context._validator.isvalid():
 *             well_formed = 0 # actually not 'valid', but anyway ...
 *         elif recover or (c_ctxt.wellFormed and             # <<<<<<<<<<<<<<
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 */
    if (!(__pyx_v_recover != 0)) {
      if ((__pyx_v_c_ctxt->wellFormed != 0)) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":654
 *             well_formed = 0 # actually not 'valid', but anyway ...
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):             # <<<<<<<<<<<<<<
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 */
        __pyx_t_3 = ((__pyx_v_c_ctxt->lastError.level < XML_ERR_ERROR) != 0);
        __pyx_t_1 = __pyx_t_3;
      } else {
        __pyx_t_1 = (__pyx_v_c_ctxt->wellFormed != 0);
      }
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = (__pyx_v_recover != 0);
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":655
 *         elif recover or (c_ctxt.wellFormed and
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1             # <<<<<<<<<<<<<<
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 *                  and context is not None:
 */
      __pyx_v_well_formed = 1;
      goto __pyx_L7;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":656
 *                          c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR):
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \             # <<<<<<<<<<<<<<
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
 */
    __pyx_t_3 = ((!(__pyx_v_c_ctxt->replaceEntities != 0)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":657
 *             well_formed = 1
 *         elif not c_ctxt.replaceEntities and not c_ctxt.validate \
 *                  and context is not None:             # <<<<<<<<<<<<<<
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 */
      __pyx_t_1 = ((!(__pyx_v_c_ctxt->validate != 0)) != 0);
      if (__pyx_t_1) {
        __pyx_t_2 = (((PyObject *)__pyx_v_context) != Py_None);
        __pyx_t_4 = (__pyx_t_2 != 0);
      } else {
        __pyx_t_4 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_3;
    }
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":659
 *                  and context is not None:
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s_filter_from_errors); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_5)) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_5)) {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_6 = __pyx_t_8(__pyx_t_5);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[6]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_v_error, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":660
 *             # in this mode, we ignore errors about undefined entities
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_type); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_WAR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":661
 *             for error in context._error_log.filter_from_errors():
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:             # <<<<<<<<<<<<<<
 *                     well_formed = 0
 *                     break
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ERR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_4 = __pyx_t_3;
        } else {
          __pyx_t_4 = __pyx_t_1;
        }
        if (__pyx_t_4) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":662
 *                 if error.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_v_well_formed = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":663
 *                        error.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                     well_formed = 0
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 well_formed = 1
 */
          goto __pyx_L9_break;
        }
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":665
 *                     break
 *             else:
 *                 well_formed = 1             # <<<<<<<<<<<<<<
 *         else:
 *             well_formed = 0
 */
        __pyx_v_well_formed = 1;
      }
      __pyx_L9_break:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":667
 *                 well_formed = 1
 *         else:
 *             well_formed = 0             # <<<<<<<<<<<<<<
 * 
 *         if not well_formed:
 */
      __pyx_v_well_formed = 0;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":669
 *             well_formed = 0
 * 
 *         if not well_formed:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 */
    __pyx_t_4 = ((!(__pyx_v_well_formed != 0)) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":670
 * 
 *         if not well_formed:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 */
      __pyx_t_4 = (__pyx_v_free_doc != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":671
 *         if not well_formed:
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 * 
 */
        xmlFreeDoc(__pyx_v_result);
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":672
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 * 
 *     if context is not None and context._has_raised():
 */
      __pyx_v_result = NULL;
      goto __pyx_L12;
    }
    __pyx_L12:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":674
 *             result = NULL
 * 
 *     if context is not None and context._has_raised():             # <<<<<<<<<<<<<<
 *         if result is not NULL:
 *             if free_doc:
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_context) != Py_None);
  if ((__pyx_t_4 != 0)) {
    __pyx_t_1 = (((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)) != 0);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = (__pyx_t_4 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":675
 * 
 *     if context is not None and context._has_raised():
 *         if result is not NULL:             # <<<<<<<<<<<<<<
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 */
    __pyx_t_3 = ((__pyx_v_result != NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":676
 *     if context is not None and context._has_raised():
 *         if result is not NULL:
 *             if free_doc:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 */
      __pyx_t_3 = (__pyx_v_free_doc != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":677
 *         if result is not NULL:
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *             result = NULL
 *         context._raise_if_stored()
 */
        xmlFreeDoc(__pyx_v_result);
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":678
 *             if free_doc:
 *                 tree.xmlFreeDoc(result)
 *             result = NULL             # <<<<<<<<<<<<<<
 *         context._raise_if_stored()
 * 
 */
      __pyx_v_result = NULL;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":679
 *                 tree.xmlFreeDoc(result)
 *             result = NULL
 *         context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if result is NULL:
 */
    __pyx_t_11 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":681
 *         context._raise_if_stored()
 * 
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 */
  __pyx_t_3 = ((__pyx_v_result == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":682
 * 
 *     if result is NULL:
 *         if context is not None:             # <<<<<<<<<<<<<<
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":683
 *     if result is NULL:
 *         if context is not None:
 *             _raiseParseError(c_ctxt, filename, context._error_log)             # <<<<<<<<<<<<<<
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)
 */
      __pyx_t_5 = ((PyObject *)__pyx_v_context->_error_log);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_11 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_5)); if (unlikely(__pyx_t_11 == 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":685
 *             _raiseParseError(c_ctxt, filename, context._error_log)
 *         else:
 *             _raiseParseError(c_ctxt, filename, None)             # <<<<<<<<<<<<<<
 *     else:
 *         if result.URL is NULL and filename is not None:
 */
      __pyx_t_11 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None)); if (unlikely(__pyx_t_11 == 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L18:;
    goto __pyx_L17;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":687
 *             _raiseParseError(c_ctxt, filename, None)
 *     else:
 *         if result.URL is NULL and filename is not None:             # <<<<<<<<<<<<<<
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:
 */
    __pyx_t_4 = ((__pyx_v_result->URL == NULL) != 0);
    if (__pyx_t_4) {
      __pyx_t_3 = (__pyx_v_filename != Py_None);
      __pyx_t_1 = (__pyx_t_3 != 0);
    } else {
      __pyx_t_1 = __pyx_t_4;
    }
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":688
 *     else:
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_xcstr(filename))             # <<<<<<<<<<<<<<
 *         if result.encoding is NULL:
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 */
      __pyx_v_result->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_filename));
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":689
 *         if result.URL is NULL and filename is not None:
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
 */
    __pyx_t_1 = ((__pyx_v_result->encoding == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":690
 *             result.URL = tree.xmlStrdup(_xcstr(filename))
 *         if result.encoding is NULL:
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")             # <<<<<<<<<<<<<<
 * 
 *     if context._validator is not None and \
 */
      __pyx_v_result->encoding = xmlStrdup(((unsigned char *)((unsigned char *)__pyx_k_UTF_8)));
      goto __pyx_L20;
    }
    __pyx_L20:;
  }
  __pyx_L17:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":692
 *             result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 * 
 *     if context._validator is not None and \             # <<<<<<<<<<<<<<
 *            context._validator._add_default_attributes:
 *         # we currently need to do this here as libxml2 does not
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_context->_validator) != Py_None);
  if ((__pyx_t_1 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":693
 * 
 *     if context._validator is not None and \
 *            context._validator._add_default_attributes:             # <<<<<<<<<<<<<<
 *         # we currently need to do this here as libxml2 does not
 *         # support inserting default attributes during parse-time
 */
    __pyx_t_4 = (__pyx_v_context->_validator->_add_default_attributes != 0);
  } else {
    __pyx_t_4 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":697
 *         # support inserting default attributes during parse-time
 *         # validation
 *         context._validator.inject_default_attributes(result)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(__pyx_v_context->_validator, __pyx_v_result);
    goto __pyx_L21;
  }
  __pyx_L21:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":699
 *         context._validator.inject_default_attributes(result)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":635
 *         raise XMLSyntaxError(None, xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 * cdef xmlDoc* _handleParseResult(_ParserContext context,             # <<<<<<<<<<<<<<
 *                                 xmlparser.xmlParserCtxt* c_ctxt,
 *                                 xmlDoc* result, filename,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":701
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 */

static int __pyx_f_4lxml_5etree__fixHtmlDictNames(xmlDict *__pyx_v_c_dict, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":703
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     c_node = c_doc.children
 */
  __pyx_t_1 = ((__pyx_v_c_doc == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":704
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":705
 *     if c_doc is NULL:
 *         return 0
 *     c_node = c_doc.children             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_2 = __pyx_v_c_doc->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":706
 *         return 0
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":707
 *     c_node = c_doc.children
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":708
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
    __pyx_t_1 = ((__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_dict, __pyx_v_c_node) < 0) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":709
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0
 */
      __pyx_r = -1;
      goto __pyx_L0;
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":710
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":711
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":701
 *     return result
 * 
 * cdef int _fixHtmlDictNames(tree.xmlDict* c_dict, xmlDoc* c_doc) nogil:             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 *     if c_doc is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":713
 *     return 0
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_start_node) nogil:
 *     """
 */

static int __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(xmlDict *__pyx_v_c_dict, xmlDoc *__pyx_v_c_doc, xmlNode *__pyx_v_c_start_node) {
  xmlNode *__pyx_v_c_node;
  int __pyx_r;
  int __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":720
 *     """
 *     cdef xmlNode* c_node
 *     if not c_doc:             # <<<<<<<<<<<<<<
 *         return 0
 *     if not c_start_node:
 */
  __pyx_t_1 = ((!(__pyx_v_c_doc != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":721
 *     cdef xmlNode* c_node
 *     if not c_doc:
 *         return 0             # <<<<<<<<<<<<<<
 *     if not c_start_node:
 *         return _fixHtmlDictNames(c_dict, c_doc)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":722
 *     if not c_doc:
 *         return 0
 *     if not c_start_node:             # <<<<<<<<<<<<<<
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node
 */
  __pyx_t_1 = ((!(__pyx_v_c_start_node != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":723
 *         return 0
 *     if not c_start_node:
 *         return _fixHtmlDictNames(c_dict, c_doc)             # <<<<<<<<<<<<<<
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 */
    __pyx_r = __pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_c_dict, __pyx_v_c_doc);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":724
 *     if not c_start_node:
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node             # <<<<<<<<<<<<<<
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_v_c_node = __pyx_v_c_start_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":725
 *         return _fixHtmlDictNames(c_dict, c_doc)
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(((xmlNode *)__pyx_v_c_doc), __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":726
 *     c_node = c_start_node
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":727
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(<xmlNode*>c_doc, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
    __pyx_t_1 = ((__pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_dict, __pyx_v_c_node) < 0) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":728
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0
 */
      __pyx_r = -1;
      goto __pyx_L0;
    }
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":729
 *         if _fixHtmlDictNodeNames(c_dict, c_node) < 0:
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":730
 *             return -1
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":713
 *     return 0
 * 
 * cdef int _fixHtmlDictSubtreeNames(tree.xmlDict* c_dict, xmlDoc* c_doc,             # <<<<<<<<<<<<<<
 *                                   xmlNode* c_start_node) nogil:
 *     """
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":732
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) nogil:
 *     cdef xmlNode* c_attr
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(xmlDict *__pyx_v_c_dict, xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_v_c_attr;
  const xmlChar *__pyx_v_c_name;
  int __pyx_r;
  int __pyx_t_1;
  xmlNode *__pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":735
 *                                       xmlNode* c_node) nogil:
 *     cdef xmlNode* c_attr
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)             # <<<<<<<<<<<<<<
 *     if c_name is NULL:
 *         return -1
 */
  __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_node->name, -1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":736
 *     cdef xmlNode* c_attr
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     if c_name is not c_node.name:
 */
  __pyx_t_1 = ((__pyx_v_c_name == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":737
 *     c_name = tree.xmlDictLookup(c_dict, c_node.name, -1)
 *     if c_name is NULL:
 *         return -1             # <<<<<<<<<<<<<<
 *     if c_name is not c_node.name:
 *         tree.xmlFree(<char*>c_node.name)
 */
    __pyx_r = -1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":738
 *     if c_name is NULL:
 *         return -1
 *     if c_name is not c_node.name:             # <<<<<<<<<<<<<<
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name
 */
  __pyx_t_1 = ((__pyx_v_c_name != __pyx_v_c_node->name) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":739
 *         return -1
 *     if c_name is not c_node.name:
 *         tree.xmlFree(<char*>c_node.name)             # <<<<<<<<<<<<<<
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties
 */
    xmlFree(((char *)__pyx_v_c_node->name));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":740
 *     if c_name is not c_node.name:
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name             # <<<<<<<<<<<<<<
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:
 */
    __pyx_v_c_node->name = __pyx_v_c_name;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":741
 *         tree.xmlFree(<char*>c_node.name)
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties             # <<<<<<<<<<<<<<
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 */
  __pyx_v_c_attr = ((xmlNode *)__pyx_v_c_node->properties);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":742
 *         c_node.name = c_name
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_attr != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":743
 *     c_attr = <xmlNode*>c_node.properties
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)             # <<<<<<<<<<<<<<
 *         if c_name is NULL:
 *             return -1
 */
    __pyx_v_c_name = xmlDictLookup(__pyx_v_c_dict, __pyx_v_c_attr->name, -1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":744
 *     while c_attr is not NULL:
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:             # <<<<<<<<<<<<<<
 *             return -1
 *         if c_name is not c_attr.name:
 */
    __pyx_t_1 = ((__pyx_v_c_name == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":745
 *         c_name = tree.xmlDictLookup(c_dict, c_attr.name, -1)
 *         if c_name is NULL:
 *             return -1             # <<<<<<<<<<<<<<
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(<char*>c_attr.name)
 */
      __pyx_r = -1;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":746
 *         if c_name is NULL:
 *             return -1
 *         if c_name is not c_attr.name:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name
 */
    __pyx_t_1 = ((__pyx_v_c_name != __pyx_v_c_attr->name) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":747
 *             return -1
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(<char*>c_attr.name)             # <<<<<<<<<<<<<<
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
 */
      xmlFree(((char *)__pyx_v_c_attr->name));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":748
 *         if c_name is not c_attr.name:
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name             # <<<<<<<<<<<<<<
 *         c_attr = c_attr.next
 *     return 0
 */
      __pyx_v_c_attr->name = __pyx_v_c_name;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":749
 *             tree.xmlFree(<char*>c_attr.name)
 *             c_attr.name = c_name
 *         c_attr = c_attr.next             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_2 = __pyx_v_c_attr->next;
    __pyx_v_c_attr = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":750
 *             c_attr.name = c_name
 *         c_attr = c_attr.next
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cython.internal
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":732
 *     return 0
 * 
 * cdef inline int _fixHtmlDictNodeNames(tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                                       xmlNode* c_node) nogil:
 *     cdef xmlNode* c_attr
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":769
 *     cdef tuple _events_to_collect  # (event_types, tag)
 * 
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,             # <<<<<<<<<<<<<<
 *                  remove_comments, remove_pis, strip_cdata, target, encoding):
 *         cdef tree.xmlCharEncodingHandler* enchandler
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11_BaseParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_11_BaseParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_parse_options;
  int __pyx_v_for_html;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parse_options,&__pyx_n_s_for_html,&__pyx_n_s_schema,&__pyx_n_s_remove_comments,&__pyx_n_s_remove_pis,&__pyx_n_s_strip_cdata,&__pyx_n_s_target,&__pyx_n_s_encoding,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parse_options)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_for_html)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_schema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remove_comments)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remove_pis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 4); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_strip_cdata)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 5); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 6); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 7); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_parse_options = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_parse_options == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_for_html = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_for_html == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[2]);
    __pyx_v_remove_comments = values[3];
    __pyx_v_remove_pis = values[4];
    __pyx_v_strip_cdata = values[5];
    __pyx_v_target = values[6];
    __pyx_v_encoding = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser___init__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_parse_options, __pyx_v_for_html, __pyx_v_schema, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_target, __pyx_v_encoding);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_11_BaseParser___init__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, int __pyx_v_parse_options, int __pyx_v_for_html, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_encoding) {
  xmlCharEncodingHandler *__pyx_v_enchandler;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":773
 *         cdef tree.xmlCharEncodingHandler* enchandler
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):             # <<<<<<<<<<<<<<
 *             raise TypeError, u"This class cannot be instantiated"
 * 
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), ((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)); 
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), ((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = ((!(__pyx_t_3 != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":774
 *         cdef int c_encoding
 *         if not isinstance(self, (XMLParser, HTMLParser)):
 *             raise TypeError, u"This class cannot be instantiated"             # <<<<<<<<<<<<<<
 * 
 *         self._parse_options = parse_options
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_This_class_cannot_be_instantiate, 0, 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":776
 *             raise TypeError, u"This class cannot be instantiated"
 * 
 *         self._parse_options = parse_options             # <<<<<<<<<<<<<<
 *         self.target = target
 *         self._for_html = for_html
 */
  __pyx_v_self->_parse_options = __pyx_v_parse_options;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":777
 * 
 *         self._parse_options = parse_options
 *         self.target = target             # <<<<<<<<<<<<<<
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
 */
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_GOTREF(__pyx_v_self->target);
  __Pyx_DECREF(__pyx_v_self->target);
  __pyx_v_self->target = __pyx_v_target;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":778
 *         self._parse_options = parse_options
 *         self.target = target
 *         self._for_html = for_html             # <<<<<<<<<<<<<<
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
 */
  __pyx_v_self->_for_html = __pyx_v_for_html;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":779
 *         self.target = target
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments             # <<<<<<<<<<<<<<
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_comments); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_remove_comments = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":780
 *         self._for_html = for_html
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis             # <<<<<<<<<<<<<<
 *         self._strip_cdata = strip_cdata
 *         self._schema = schema
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_pis); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_remove_pis = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":781
 *         self._remove_comments = remove_comments
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata             # <<<<<<<<<<<<<<
 *         self._schema = schema
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_strip_cdata = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":782
 *         self._remove_pis = remove_pis
 *         self._strip_cdata = strip_cdata
 *         self._schema = schema             # <<<<<<<<<<<<<<
 * 
 *         self._resolvers = _ResolverRegistry()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_GOTREF(__pyx_v_self->_schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_schema));
  __pyx_v_self->_schema = __pyx_v_schema;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":784
 *         self._schema = schema
 * 
 *         self._resolvers = _ResolverRegistry()             # <<<<<<<<<<<<<<
 * 
 *         if encoding is None:
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ResolverRegistry)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_resolvers);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_resolvers));
  __pyx_v_self->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":786
 *         self._resolvers = _ResolverRegistry()
 * 
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             self._default_encoding = None
 *         else:
 */
  __pyx_t_1 = (__pyx_v_encoding == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":787
 * 
 *         if encoding is None:
 *             self._default_encoding = None             # <<<<<<<<<<<<<<
 *         else:
 *             encoding = _utf8(encoding)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_default_encoding);
    __Pyx_DECREF(__pyx_v_self->_default_encoding);
    __pyx_v_self->_default_encoding = Py_None;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":789
 *             self._default_encoding = None
 *         else:
 *             encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":790
 *         else:
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))             # <<<<<<<<<<<<<<
 *             if enchandler is NULL:
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 */
    __pyx_v_enchandler = xmlFindCharEncodingHandler(PyBytes_AS_STRING(__pyx_v_encoding));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":791
 *             encoding = _utf8(encoding)
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:             # <<<<<<<<<<<<<<
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 *             tree.xmlCharEncCloseFunc(enchandler)
 */
    __pyx_t_3 = ((__pyx_v_enchandler == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":792
 *             enchandler = tree.xmlFindCharEncodingHandler(_cstr(encoding))
 *             if enchandler is NULL:
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding             # <<<<<<<<<<<<<<
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding
 */
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_unknown_encoding_s, __pyx_v_encoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":793
 *             if enchandler is NULL:
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 *             tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *             self._default_encoding = encoding
 * 
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":794
 *                 raise LookupError, u"unknown encoding: '%s'" % encoding
 *             tree.xmlCharEncCloseFunc(enchandler)
 *             self._default_encoding = encoding             # <<<<<<<<<<<<<<
 * 
 *     cdef _setBaseURL(self, base_url):
 */
    __Pyx_INCREF(__pyx_v_encoding);
    __Pyx_GIVEREF(__pyx_v_encoding);
    __Pyx_GOTREF(__pyx_v_self->_default_encoding);
    __Pyx_DECREF(__pyx_v_self->_default_encoding);
    __pyx_v_self->_default_encoding = __pyx_v_encoding;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":769
 *     cdef tuple _events_to_collect  # (event_types, tag)
 * 
 *     def __init__(self, int parse_options, bint for_html, XMLSchema schema,             # <<<<<<<<<<<<<<
 *                  remove_comments, remove_pis, strip_cdata, target, encoding):
 *         cdef tree.xmlCharEncodingHandler* enchandler
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":796
 *             self._default_encoding = encoding
 * 
 *     cdef _setBaseURL(self, base_url):             # <<<<<<<<<<<<<<
 *         self._filename = _encodeFilename(base_url)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__setBaseURL(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_base_url) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setBaseURL", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":797
 * 
 *     cdef _setBaseURL(self, base_url):
 *         self._filename = _encodeFilename(base_url)             # <<<<<<<<<<<<<<
 * 
 *     cdef _collectEvents(self, event_types, tag):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_base_url); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_filename);
  __Pyx_DECREF(__pyx_v_self->_filename);
  __pyx_v_self->_filename = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":796
 *             self._default_encoding = encoding
 * 
 *     cdef _setBaseURL(self, base_url):             # <<<<<<<<<<<<<<
 *         self._filename = _encodeFilename(base_url)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._setBaseURL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":799
 *         self._filename = _encodeFilename(base_url)
 * 
 *     cdef _collectEvents(self, event_types, tag):             # <<<<<<<<<<<<<<
 *         if event_types is None:
 *             event_types = ()
 */

static PyObject *__pyx_f_4lxml_5etree_11_BaseParser__collectEvents(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_event_types, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectEvents", 0);
  __Pyx_INCREF(__pyx_v_event_types);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":800
 * 
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:             # <<<<<<<<<<<<<<
 *             event_types = ()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_event_types == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":801
 *     cdef _collectEvents(self, event_types, tag):
 *         if event_types is None:
 *             event_types = ()             # <<<<<<<<<<<<<<
 *         else:
 *             event_types = tuple(set(event_types))
 */
    __Pyx_INCREF(__pyx_empty_tuple);
    __Pyx_DECREF_SET(__pyx_v_event_types, __pyx_empty_tuple);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":803
 *             event_types = ()
 *         else:
 *             event_types = tuple(set(event_types))             # <<<<<<<<<<<<<<
 *             _buildParseEventFilter(event_types)  # purely for validation
 *         self._events_to_collect = (event_types, tag)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_event_types);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_event_types);
    __Pyx_GIVEREF(__pyx_v_event_types);
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 803; __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(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 803; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_event_types, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":804
 *         else:
 *             event_types = tuple(set(event_types))
 *             _buildParseEventFilter(event_types)  # purely for validation             # <<<<<<<<<<<<<<
 *         self._events_to_collect = (event_types, tag)
 * 
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_event_types); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":805
 *             event_types = tuple(set(event_types))
 *             _buildParseEventFilter(event_types)  # purely for validation
 *         self._events_to_collect = (event_types, tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _getParserContext(self):
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_event_types);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_event_types);
  __Pyx_GIVEREF(__pyx_v_event_types);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_events_to_collect);
  __Pyx_DECREF(__pyx_v_self->_events_to_collect);
  __pyx_v_self->_events_to_collect = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":799
 *         self._filename = _encodeFilename(base_url)
 * 
 *     cdef _collectEvents(self, event_types, tag):             # <<<<<<<<<<<<<<
 *         if event_types is None:
 *             event_types = ()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser._collectEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event_types);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":807
 *         self._events_to_collect = (event_types, tag)
 * 
 *     cdef _ParserContext _getParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 */

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_pctxt;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlParserCtxt *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":809
 *     cdef _ParserContext _getParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:             # <<<<<<<<<<<<<<
 *             self._parser_context = self._createContext(self.target, None)
 *             if self._schema is not None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_parser_context) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":810
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target, None)             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._parser_context._validator = \
 */
    __pyx_t_3 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_3, Py_None)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_parser_context);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser_context));
    __pyx_v_self->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":811
 *         if self._parser_context is None:
 *             self._parser_context = self._createContext(self.target, None)
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":813
 *             if self._schema is not None:
 *                 self._parser_context._validator = \
 *                     self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()
 */
      __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":812
 *             self._parser_context = self._createContext(self.target, None)
 *             if self._schema is not None:
 *                 self._parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_parser_context->_validator);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser_context->_validator));
      __pyx_v_self->_parser_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":815
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()             # <<<<<<<<<<<<<<
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newParserCtxt(__pyx_v_self); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_pctxt = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":816
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newParserCtxt()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_parser_context);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_4), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_3), __pyx_v_pctxt); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":817
 *             pctxt = self._newParserCtxt()
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 */
    __pyx_t_1 = (__pyx_v_self->_remove_comments != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":818
 *             _initParserContext(self._parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL             # <<<<<<<<<<<<<<
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 */
      __pyx_v_pctxt->sax->comment = NULL;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":819
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:
 */
    __pyx_t_1 = (__pyx_v_self->_remove_pis != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":820
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 */
      __pyx_v_pctxt->sax->processingInstruction = NULL;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":821
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:             # <<<<<<<<<<<<<<
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 */
    __pyx_t_1 = (__pyx_v_self->_strip_cdata != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":823
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         return self._parser_context
 * 
 */
      __pyx_v_pctxt->sax->cdataBlock = NULL;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":824
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 *         return self._parser_context             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _getPushParserContext(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_parser_context));
  __pyx_r = __pyx_v_self->_parser_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":807
 *         self._events_to_collect = (event_types, tag)
 * 
 *     cdef _ParserContext _getParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._parser_context is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseParser._getParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":826
 *         return self._parser_context
 * 
 *     cdef _ParserContext _getPushParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 */

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_pctxt;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  xmlParserCtxt *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_getPushParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":828
 *     cdef _ParserContext _getPushParserContext(self):
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:             # <<<<<<<<<<<<<<
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_push_parser_context) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":830
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)             # <<<<<<<<<<<<<<
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \
 */
    __pyx_t_3 = __pyx_v_self->target;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_v_self->_events_to_collect;
    __Pyx_INCREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":829
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 *             self._push_parser_context = self._createContext(             # <<<<<<<<<<<<<<
 *                 self.target, self._events_to_collect)
 *             if self._schema is not None:
 */
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_createContext(__pyx_v_self, __pyx_t_3, __pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_push_parser_context);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_push_parser_context));
    __pyx_v_self->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":831
 *             self._push_parser_context = self._createContext(
 *                 self.target, self._events_to_collect)
 *             if self._schema is not None:             # <<<<<<<<<<<<<<
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":833
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \
 *                     self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()
 */
      __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, (__pyx_v_self->_parse_options & XML_PARSE_DTDATTR))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":832
 *                 self.target, self._events_to_collect)
 *             if self._schema is not None:
 *                 self._push_parser_context._validator = \             # <<<<<<<<<<<<<<
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_v_self->_push_parser_context->_validator);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_push_parser_context->_validator));
      __pyx_v_self->_push_parser_context->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":835
 *                     self._schema._newSaxValidator(
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()             # <<<<<<<<<<<<<<
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_newPushParserCtxt(__pyx_v_self); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_pctxt = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":837
 *             pctxt = self._newPushParserCtxt()
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)             # <<<<<<<<<<<<<<
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_push_parser_context);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = ((PyObject *)__pyx_v_self->_resolvers);
    __Pyx_INCREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":836
 *                         self._parse_options & xmlparser.XML_PARSE_DTDATTR)
 *             pctxt = self._newPushParserCtxt()
 *             _initParserContext(             # <<<<<<<<<<<<<<
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_5), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_4), __pyx_v_pctxt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":838
 *             _initParserContext(
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 */
    __pyx_t_1 = (__pyx_v_self->_remove_comments != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":839
 *                 self._push_parser_context, self._resolvers, pctxt)
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL             # <<<<<<<<<<<<<<
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 */
      __pyx_v_pctxt->sax->comment = NULL;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":840
 *             if self._remove_comments:
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:             # <<<<<<<<<<<<<<
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:
 */
    __pyx_t_1 = (__pyx_v_self->_remove_pis != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":841
 *                 pctxt.sax.comment = NULL
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 */
      __pyx_v_pctxt->sax->processingInstruction = NULL;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":842
 *             if self._remove_pis:
 *                 pctxt.sax.processingInstruction = NULL
 *             if self._strip_cdata:             # <<<<<<<<<<<<<<
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 */
    __pyx_t_1 = (__pyx_v_self->_strip_cdata != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":844
 *             if self._strip_cdata:
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         return self._push_parser_context
 * 
 */
      __pyx_v_pctxt->sax->cdataBlock = NULL;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":845
 *                 # hard switch-off for CDATA nodes => makes them plain text
 *                 pctxt.sax.cdataBlock = NULL
 *         return self._push_parser_context             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _createContext(self, target, events_to_collect):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_push_parser_context));
  __pyx_r = __pyx_v_self->_push_parser_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":826
 *         return self._parser_context
 * 
 *     cdef _ParserContext _getPushParserContext(self):             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         if self._push_parser_context is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseParser._getPushParserContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":847
 *         return self._push_parser_context
 * 
 *     cdef _ParserContext _createContext(self, target, events_to_collect):             # <<<<<<<<<<<<<<
 *         cdef _SaxParserContext sax_context
 *         if target is not None:
 */

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_11_BaseParser__createContext(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_events_to_collect) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_sax_context = 0;
  PyObject *__pyx_v_events = NULL;
  PyObject *__pyx_v_tag = NULL;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":849
 *     cdef _ParserContext _createContext(self, target, events_to_collect):
 *         cdef _SaxParserContext sax_context
 *         if target is not None:             # <<<<<<<<<<<<<<
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 */
  __pyx_t_1 = (__pyx_v_target != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":850
 *         cdef _SaxParserContext sax_context
 *         if target is not None:
 *             sax_context = _TargetParserContext(self)             # <<<<<<<<<<<<<<
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 850; __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_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__TargetParserContext)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_sax_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":851
 *         if target is not None:
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)             # <<<<<<<<<<<<<<
 *         elif events_to_collect:
 *             sax_context = _SaxParserContext(self)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_v_sax_context), __pyx_v_target); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":852
 *             sax_context = _TargetParserContext(self)
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:             # <<<<<<<<<<<<<<
 *             sax_context = _SaxParserContext(self)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_events_to_collect); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":853
 *             (<_TargetParserContext>sax_context)._setTarget(target)
 *         elif events_to_collect:
 *             sax_context = _SaxParserContext(self)             # <<<<<<<<<<<<<<
 *         else:
 *             # nothing special to configure
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__SaxParserContext)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_sax_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":856
 *         else:
 *             # nothing special to configure
 *             return _ParserContext()             # <<<<<<<<<<<<<<
 *         if events_to_collect:
 *             events, tag = events_to_collect
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":857
 *             # nothing special to configure
 *             return _ParserContext()
 *         if events_to_collect:             # <<<<<<<<<<<<<<
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_events_to_collect); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":858
 *             return _ParserContext()
 *         if events_to_collect:
 *             events, tag = events_to_collect             # <<<<<<<<<<<<<<
 *             sax_context._setEventFilter(events, tag)
 *         return sax_context
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_events_to_collect))) || (PyList_CheckExact(__pyx_v_events_to_collect))) {
      PyObject* sequence = __pyx_v_events_to_collect;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[6]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_events_to_collect); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __pyx_v_events = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_tag = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":859
 *         if events_to_collect:
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)             # <<<<<<<<<<<<<<
 *         return sax_context
 * 
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_sax_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_setEventFilter(__pyx_v_sax_context, __pyx_v_events, __pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":860
 *             events, tag = events_to_collect
 *             sax_context._setEventFilter(events, tag)
 *         return sax_context             # <<<<<<<<<<<<<<
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_sax_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_sax_context);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":847
 *         return self._push_parser_context
 * 
 *     cdef _ParserContext _createContext(self, target, events_to_collect):             # <<<<<<<<<<<<<<
 *         cdef _SaxParserContext sax_context
 *         if target is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseParser._createContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sax_context);
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_tag);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":862
 *         return sax_context
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 */

static int __pyx_f_4lxml_5etree_11_BaseParser__registerHtmlErrorHandler(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlSAXHandler *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_registerHtmlErrorHandler", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":863
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 */
  __pyx_t_1 = __pyx_v_c_ctxt->sax;
  __pyx_v_sax = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":864
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 */
  __pyx_t_2 = (__pyx_v_sax != NULL);
  if (__pyx_t_2) {
    if ((__pyx_v_sax->initialized != 0)) {
      __pyx_t_3 = (__pyx_v_sax->initialized != XML_SAX2_MAGIC);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = (__pyx_v_sax->initialized != 0);
    }
    __pyx_t_3 = __pyx_t_4;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":866
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:             # <<<<<<<<<<<<<<
 *                 sax = <xmlparser.xmlSAXHandler*> stdlib.malloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
 */
    __pyx_t_3 = ((((xmlSAXHandlerV1 *)__pyx_v_sax) == (&htmlDefaultSAXHandler)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":867
 *             # need to extend SAX1 context to SAX2 to get proper error reports
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> stdlib.malloc(sizeof(xmlparser.xmlSAXHandler))             # <<<<<<<<<<<<<<
 *                 if sax is NULL:
 *                     raise MemoryError()
 */
      __pyx_v_sax = ((xmlSAXHandler *)malloc((sizeof(xmlSAXHandler))));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":868
 *             if <xmlparser.xmlSAXHandlerV1*>sax is &htmlparser.htmlDefaultSAXHandler:
 *                 sax = <xmlparser.xmlSAXHandler*> stdlib.malloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 */
      __pyx_t_3 = ((__pyx_v_sax == NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":869
 *                 sax = <xmlparser.xmlSAXHandler*> stdlib.malloc(sizeof(xmlparser.xmlSAXHandler))
 *                 if sax is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 */
        PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":870
 *                 if sax is NULL:
 *                     raise MemoryError()
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,             # <<<<<<<<<<<<<<
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax
 */
      memcpy(__pyx_v_sax, (&htmlDefaultSAXHandler), (sizeof(htmlDefaultSAXHandler)));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":872
 *                 cstring_h.memcpy(sax, &htmlparser.htmlDefaultSAXHandler,
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax             # <<<<<<<<<<<<<<
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             sax.serror = _receiveParserError
 */
      __pyx_v_c_ctxt->sax = __pyx_v_sax;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":873
 *                                  sizeof(htmlparser.htmlDefaultSAXHandler))
 *                 c_ctxt.sax = sax
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC             # <<<<<<<<<<<<<<
 *             sax.serror = _receiveParserError
 *             sax.startElementNs = NULL
 */
    __pyx_v_sax->initialized = XML_SAX2_MAGIC;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":874
 *                 c_ctxt.sax = sax
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             sax.serror = _receiveParserError             # <<<<<<<<<<<<<<
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL
 */
    __pyx_v_sax->serror = __pyx_f_4lxml_5etree__receiveParserError;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":875
 *             sax.initialized = xmlparser.XML_SAX2_MAGIC
 *             sax.serror = _receiveParserError
 *             sax.startElementNs = NULL             # <<<<<<<<<<<<<<
 *             sax.endElementNs = NULL
 *             sax._private = NULL
 */
    __pyx_v_sax->startElementNs = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":876
 *             sax.serror = _receiveParserError
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL             # <<<<<<<<<<<<<<
 *             sax._private = NULL
 *         return 0
 */
    __pyx_v_sax->endElementNs = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":877
 *             sax.startElementNs = NULL
 *             sax.endElementNs = NULL
 *             sax._private = NULL             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_v_sax->_private = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":878
 *             sax.endElementNs = NULL
 *             sax._private = NULL
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":862
 *         return sax_context
 * 
 *     cdef int _registerHtmlErrorHandler(self, xmlparser.xmlParserCtxt* c_ctxt) except -1:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlSAXHandler* sax = c_ctxt.sax
 *         if sax is not NULL and sax.initialized and sax.initialized != xmlparser.XML_SAX2_MAGIC:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser._registerHtmlErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":880
 *         return 0
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:
 */

static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  xmlParserCtxt *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newParserCtxt", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":882
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:
 */
  __pyx_t_1 = (__pyx_v_self->_for_html != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":883
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)             # <<<<<<<<<<<<<<
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)
 */
    __pyx_v_c_ctxt = htmlCreateMemoryParserCtxt(__pyx_k_dummy, 5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":884
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_c_ctxt != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":885
 *             c_ctxt = htmlparser.htmlCreateMemoryParserCtxt('dummy', 5)
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_registerHtmlErrorHandler(__pyx_v_self, __pyx_v_c_ctxt); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":887
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()             # <<<<<<<<<<<<<<
 *         if c_ctxt is NULL:
 *             raise MemoryError
 */
    __pyx_v_c_ctxt = xmlNewParserCtxt();
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":888
 *         else:
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 *         return c_ctxt
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":889
 *             c_ctxt = xmlparser.xmlNewParserCtxt()
 *         if c_ctxt is NULL:
 *             raise MemoryError             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":890
 *         if c_ctxt is NULL:
 *             raise MemoryError
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:
 */
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":880
 *         return 0
 * 
 *     cdef xmlparser.xmlParserCtxt* _newParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         if self._for_html:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser._newParserCtxt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":892
 *         return c_ctxt
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 */

static xmlParserCtxt *__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  char *__pyx_v_c_filename;
  xmlParserCtxt *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newPushParserCtxt", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":894
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 */
  __pyx_t_2 = (__pyx_v_self->_filename != ((PyObject*)Py_None));
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = __pyx_v_self->_filename;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = PyBytes_AS_STRING(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_v_c_filename = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":895
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 */
  __pyx_t_2 = (__pyx_v_self->_for_html != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":896
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 *         if self._for_html:
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(             # <<<<<<<<<<<<<<
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:
 */
    __pyx_v_c_ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename, XML_CHAR_ENCODING_NONE);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":898
 *             c_ctxt = htmlparser.htmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 */
    __pyx_t_2 = ((__pyx_v_c_ctxt != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":899
 *                 NULL, NULL, NULL, 0, c_filename, tree.XML_CHAR_ENCODING_NONE)
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)             # <<<<<<<<<<<<<<
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         else:
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_registerHtmlErrorHandler(__pyx_v_self, __pyx_v_c_ctxt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":900
 *             if c_ctxt is not NULL:
 *                 self._registerHtmlErrorHandler(c_ctxt)
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 */
      htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":902
 *                 htmlparser.htmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         else:
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(             # <<<<<<<<<<<<<<
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:
 */
    __pyx_v_c_ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, __pyx_v_c_filename);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":904
 *             c_ctxt = xmlparser.xmlCreatePushParserCtxt(
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:
 */
    __pyx_t_2 = ((__pyx_v_c_ctxt != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":905
 *                 NULL, NULL, NULL, 0, c_filename)
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *         if c_ctxt is NULL:
 *             raise MemoryError()
 */
      xmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_self->_parse_options);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":906
 *             if c_ctxt is not NULL:
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return c_ctxt
 */
  __pyx_t_2 = ((__pyx_v_c_ctxt == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":907
 *                 xmlparser.xmlCtxtUseOptions(c_ctxt, self._parse_options)
 *         if c_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return c_ctxt
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":908
 *         if c_ctxt is NULL:
 *             raise MemoryError()
 *         return c_ctxt             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_r = __pyx_v_c_ctxt;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":892
 *         return c_ctxt
 * 
 *     cdef xmlparser.xmlParserCtxt* _newPushParserCtxt(self) except NULL:             # <<<<<<<<<<<<<<
 *         cdef xmlparser.xmlParserCtxt* c_ctxt
 *         cdef char* c_filename = _cstr(self._filename) if self._filename is not None else NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseParser._newPushParserCtxt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":913
 *         u"""The error log of the last parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _ParserContext context
 *             context = self._getParserContext()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9error_log___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":915
 *         def __get__(self):
 *             cdef _ParserContext context
 *             context = self._getParserContext()             # <<<<<<<<<<<<<<
 *             return context._error_log.copy()
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":916
 *             cdef _ParserContext context
 *             context = self._getParserContext()
 *             return context._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     property resolvers:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_context->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_context->_error_log), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":913
 *         u"""The error log of the last parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef _ParserContext context
 *             context = self._getParserContext()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":920
 *     property resolvers:
 *         u"The custom resolver registry of this parser."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._resolvers
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9resolvers_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9resolvers_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_9resolvers___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":921
 *         u"The custom resolver registry of this parser."
 *         def __get__(self):
 *             return self._resolvers             # <<<<<<<<<<<<<<
 * 
 *     property version:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_resolvers));
  __pyx_r = ((PyObject *)__pyx_v_self->_resolvers);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":920
 *     property resolvers:
 *         u"The custom resolver registry of this parser."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._resolvers
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":925
 *     property version:
 *         u"The version of the underlying XML parser."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7version_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_7version___get__(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":926
 *         u"The version of the underlying XML parser."
 *         def __get__(self):
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION             # <<<<<<<<<<<<<<
 * 
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LIBXML_VERSION); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_libxml2_d_d_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 926; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":925
 *     property version:
 *         u"The version of the underlying XML parser."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":928
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead."
 *         self.set_element_class_lookup(lookup)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_3setElementClassLookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_2setElementClassLookup[] = ":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead.";
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_3setElementClassLookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setElementClassLookup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lookup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementClassLookup") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setElementClassLookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.setElementClassLookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_2setElementClassLookup(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_2setElementClassLookup(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setElementClassLookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":930
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):
 *         u":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead."
 *         self.set_element_class_lookup(lookup)             # <<<<<<<<<<<<<<
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_element_class_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 930; __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[6]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 930; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":928
 *             return u"libxml2 %d.%d.%d" % LIBXML_VERSION
 * 
 *     def setElementClassLookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u":deprecated: use ``parser.set_element_class_lookup(lookup)`` instead."
 *         self.set_element_class_lookup(lookup)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":932
 *         self.set_element_class_lookup(lookup)
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u"""set_element_class_lookup(self, lookup = None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_5set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_4set_element_class_lookup[] = "set_element_class_lookup(self, lookup = None)\n\n        Set a lookup scheme for element classes generated from this parser.\n\n        Reset it by passing None or nothing.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_5set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lookup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_element_class_lookup") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseParser.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_4set_element_class_lookup(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_4set_element_class_lookup(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":939
 *         Reset it by passing None or nothing.
 *         """
 *         self._class_lookup = lookup             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseParser _copy(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __Pyx_GOTREF(__pyx_v_self->_class_lookup);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_class_lookup));
  __pyx_v_self->_class_lookup = __pyx_v_lookup;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":932
 *         self.set_element_class_lookup(lookup)
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u"""set_element_class_lookup(self, lookup = None)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":941
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         u"Create a new parser with the same configuration."
 *         cdef _BaseParser parser
 */

static struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_f_4lxml_5etree_11_BaseParser__copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":944
 *         u"Create a new parser with the same configuration."
 *         cdef _BaseParser parser
 *         parser = self.__class__()             # <<<<<<<<<<<<<<
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":945
 *         cdef _BaseParser parser
 *         parser = self.__class__()
 *         parser._parse_options = self._parse_options             # <<<<<<<<<<<<<<
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments
 */
  __pyx_t_3 = __pyx_v_self->_parse_options;
  __pyx_v_parser->_parse_options = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":946
 *         parser = self.__class__()
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html             # <<<<<<<<<<<<<<
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis
 */
  __pyx_t_4 = __pyx_v_self->_for_html;
  __pyx_v_parser->_for_html = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":947
 *         parser._parse_options = self._parse_options
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments             # <<<<<<<<<<<<<<
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata
 */
  __pyx_t_4 = __pyx_v_self->_remove_comments;
  __pyx_v_parser->_remove_comments = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":948
 *         parser._for_html = self._for_html
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis             # <<<<<<<<<<<<<<
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename
 */
  __pyx_t_4 = __pyx_v_self->_remove_pis;
  __pyx_v_parser->_remove_pis = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":949
 *         parser._remove_comments = self._remove_comments
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata             # <<<<<<<<<<<<<<
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers
 */
  __pyx_t_4 = __pyx_v_self->_strip_cdata;
  __pyx_v_parser->_strip_cdata = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":950
 *         parser._remove_pis = self._remove_pis
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename             # <<<<<<<<<<<<<<
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target
 */
  __pyx_t_2 = __pyx_v_self->_filename;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->_filename);
  __Pyx_DECREF(__pyx_v_parser->_filename);
  __pyx_v_parser->_filename = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":951
 *         parser._strip_cdata = self._strip_cdata
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers             # <<<<<<<<<<<<<<
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_resolvers);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->_resolvers);
  __Pyx_DECREF(((PyObject *)__pyx_v_parser->_resolvers));
  __pyx_v_parser->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":952
 *         parser._filename = self._filename
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target             # <<<<<<<<<<<<<<
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding
 */
  __pyx_t_2 = __pyx_v_self->target;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->target);
  __Pyx_DECREF(__pyx_v_parser->target);
  __pyx_v_parser->target = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":953
 *         parser._resolvers = self._resolvers
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup             # <<<<<<<<<<<<<<
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_class_lookup);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->_class_lookup);
  __Pyx_DECREF(((PyObject *)__pyx_v_parser->_class_lookup));
  __pyx_v_parser->_class_lookup = ((struct LxmlElementClassLookup *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":954
 *         parser.target = self.target
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect
 */
  __pyx_t_2 = __pyx_v_self->_default_encoding;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->_default_encoding);
  __Pyx_DECREF(__pyx_v_parser->_default_encoding);
  __pyx_v_parser->_default_encoding = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":955
 *         parser._class_lookup  = self._class_lookup
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema             # <<<<<<<<<<<<<<
 *         parser._events_to_collect = self._events_to_collect
 *         return parser
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_schema);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->_schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_parser->_schema));
  __pyx_v_parser->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":956
 *         parser._default_encoding = self._default_encoding
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect             # <<<<<<<<<<<<<<
 *         return parser
 * 
 */
  __pyx_t_2 = __pyx_v_self->_events_to_collect;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_parser->_events_to_collect);
  __Pyx_DECREF(__pyx_v_parser->_events_to_collect);
  __pyx_v_parser->_events_to_collect = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":957
 *         parser._schema = self._schema
 *         parser._events_to_collect = self._events_to_collect
 *         return parser             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __pyx_r = __pyx_v_parser;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":941
 *         self._class_lookup = lookup
 * 
 *     cdef _BaseParser _copy(self):             # <<<<<<<<<<<<<<
 *         u"Create a new parser with the same configuration."
 *         cdef _BaseParser parser
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._BaseParser._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":959
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"""copy(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_6copy[] = "copy(self)\n\n        Create a new parser with the same configuration.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_7copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_6copy(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6copy(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":964
 *         Create a new parser with the same configuration.
 *         """
 *         return self._copy()             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_copy(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":959
 *         return parser
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         u"""copy(self)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":966
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11_BaseParser_8makeelement[] = "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with this parser.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_9makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeelement (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrib);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, pos_args, "makeelement") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_8makeelement(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

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

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_8makeelement(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v__tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeelement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":971
 *         Creates a new element associated with this parser.
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,             # <<<<<<<<<<<<<<
 *                             attrib, nsmap, _extra)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":972
 *         """
 *         return _makeElement(_tag, NULL, None, self, None, None,
 *                             attrib, nsmap, _extra)             # <<<<<<<<<<<<<<
 * 
 *     # internal parser methods
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v__tag, NULL, ((struct LxmlDocument *)Py_None), __pyx_v_self, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":966
 *         return self._copy()
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":976
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         u"""Parse unicode document, share dictionary if possible.
 *         """
 */

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_utext, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  int __pyx_v_buffer_len;
  int __pyx_v_c_kind;
  const char *__pyx_v_c_text;
  const char *__pyx_v_c_encoding;
  int __pyx_v_is_pep393_string;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  xmlParserCtxt *__pyx_t_6;
  xmlDoc *__pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseUnicodeDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":985
 *         cdef int buffer_len, c_kind
 *         cdef const_char* c_text
 *         cdef const_char* c_encoding = _UNICODE_ENCODING             # <<<<<<<<<<<<<<
 *         cdef bint is_pep393_string = (
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(utext))
 */
  __pyx_v_c_encoding = __pyx_v_4lxml_5etree__UNICODE_ENCODING;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":987
 *         cdef const_char* c_encoding = _UNICODE_ENCODING
 *         cdef bint is_pep393_string = (
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(utext))             # <<<<<<<<<<<<<<
 *         if is_pep393_string:
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 */
  if (CYTHON_PEP393_ENABLED) {
    __pyx_t_1 = PyUnicode_IS_READY(__pyx_v_utext);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = CYTHON_PEP393_ENABLED;
  }
  __pyx_v_is_pep393_string = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":988
 *         cdef bint is_pep393_string = (
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(utext))
 *         if is_pep393_string:             # <<<<<<<<<<<<<<
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 */
  __pyx_t_2 = (__pyx_v_is_pep393_string != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":989
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(utext))
 *         if is_pep393_string:
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
 */
    __pyx_v_c_text = ((const char *)PyUnicode_DATA(__pyx_v_utext));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":990
 *         if is_pep393_string:
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)             # <<<<<<<<<<<<<<
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
 */
    __pyx_v_py_buffer_len = PyUnicode_GET_LENGTH(__pyx_v_utext);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":991
 *             c_text = <const_char*>python.PyUnicode_DATA(utext)
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)             # <<<<<<<<<<<<<<
 *             if c_kind == 1:
 *                 c_encoding = 'ISO-8859-1'
 */
    __pyx_v_c_kind = PyUnicode_KIND(__pyx_v_utext);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1000
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
 */
    switch (__pyx_v_c_kind) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":992
 *             py_buffer_len = python.PyUnicode_GET_LENGTH(utext)
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:             # <<<<<<<<<<<<<<
 *                 c_encoding = 'ISO-8859-1'
 *             elif c_kind == 2:
 */
      case 1:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":993
 *             c_kind = python.PyUnicode_KIND(utext)
 *             if c_kind == 1:
 *                 c_encoding = 'ISO-8859-1'             # <<<<<<<<<<<<<<
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 */
      __pyx_v_c_encoding = __pyx_k_ISO_8859_1;
      break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":994
 *             if c_kind == 1:
 *                 c_encoding = 'ISO-8859-1'
 *             elif c_kind == 2:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:
 */
      case 2:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":995
 *                 c_encoding = 'ISO-8859-1'
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2             # <<<<<<<<<<<<<<
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 */
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len * 2);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":996
 *             elif c_kind == 2:
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
 */
      __pyx_t_2 = (PY_BIG_ENDIAN != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":997
 *                 py_buffer_len *= 2
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 */
        __pyx_v_c_encoding = __pyx_k_UTF_16BE;
        goto __pyx_L4;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":999
 *                     c_encoding = 'UTF-16BE'  # actually UCS-2
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2             # <<<<<<<<<<<<<<
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 */
        __pyx_v_c_encoding = __pyx_k_UTF_16LE;
      }
      __pyx_L4:;
      break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1000
 *                 else:
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:             # <<<<<<<<<<<<<<
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
 */
      case 4:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1001
 *                     c_encoding = 'UTF-16LE'  # actually UCS-2
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4             # <<<<<<<<<<<<<<
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UCS-4BE'
 */
      __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len * 4);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1002
 *             elif c_kind == 4:
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:             # <<<<<<<<<<<<<<
 *                     c_encoding = 'UCS-4BE'
 *                 else:
 */
      __pyx_t_2 = (PY_BIG_ENDIAN != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1003
 *                 py_buffer_len *= 4
 *                 if python.PY_BIG_ENDIAN:
 *                     c_encoding = 'UCS-4BE'             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_encoding = 'UCS-4LE'
 */
        __pyx_v_c_encoding = __pyx_k_UCS_4BE;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1005
 *                     c_encoding = 'UCS-4BE'
 *                 else:
 *                     c_encoding = 'UCS-4LE'             # <<<<<<<<<<<<<<
 *             else:
 *                 assert False, "Illegal Unicode kind %d" % c_kind
 */
        __pyx_v_c_encoding = __pyx_k_UCS_4LE;
      }
      __pyx_L5:;
      break;
      default:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1007
 *                     c_encoding = 'UCS-4LE'
 *             else:
 *                 assert False, "Illegal Unicode kind %d" % c_kind             # <<<<<<<<<<<<<<
 *         else:
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!0)) {
          __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_c_kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Illegal_Unicode_kind_d, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
      }
      #endif
      break;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1009
 *                 assert False, "Illegal Unicode kind %d" % c_kind
 *         else:
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)             # <<<<<<<<<<<<<<
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert py_buffer_len <= limits.INT_MAX
 */
    __pyx_v_py_buffer_len = PyUnicode_GET_DATA_SIZE(__pyx_v_utext);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1010
 *         else:
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *             c_text = python.PyUnicode_AS_DATA(utext)             # <<<<<<<<<<<<<<
 *         assert py_buffer_len <= limits.INT_MAX
 *         buffer_len = py_buffer_len
 */
    __pyx_v_c_text = PyUnicode_AS_DATA(__pyx_v_utext);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1011
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(utext)
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert py_buffer_len <= limits.INT_MAX             # <<<<<<<<<<<<<<
 *         buffer_len = py_buffer_len
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_py_buffer_len <= INT_MAX) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1012
 *             c_text = python.PyUnicode_AS_DATA(utext)
 *         assert py_buffer_len <= limits.INT_MAX
 *         buffer_len = py_buffer_len             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
  __pyx_v_buffer_len = __pyx_v_py_buffer_len;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1014
 *         buffer_len = py_buffer_len
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1015
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1016
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1017
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 */
    __pyx_t_6 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1018
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             orig_options = pctxt.options
 *             with nogil:
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1019
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
 */
    __pyx_t_5 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1020
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1021
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 */
          __pyx_t_2 = (__pyx_v_self->_for_html != 0);
          if (__pyx_t_2) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1022
 *             with nogil:
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 */
            __pyx_v_result = htmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1025
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 */
            __pyx_t_2 = ((__pyx_v_result != NULL) != 0);
            if (__pyx_t_2) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1026
 *                         self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              __pyx_t_2 = ((__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0) != 0);
              if (__pyx_t_2) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1027
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
                xmlFreeDoc(__pyx_v_result);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1028
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
 */
                __pyx_v_result = NULL;
                goto __pyx_L14;
              }
              __pyx_L14:;
              goto __pyx_L13;
            }
            __pyx_L13:;
            goto __pyx_L12;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1030
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 */
            __pyx_v_result = xmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_buffer_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
          }
          __pyx_L12:;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1020
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1033
 *                         pctxt, c_text, buffer_len, c_filename, c_encoding,
 *                         self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, None)
 */
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1035
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, Py_None); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    __pyx_r = __pyx_t_7;
    goto __pyx_L6_return;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1037
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, int c_len,
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L7_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_5 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __pyx_t_16 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L16_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L6_return: {
      __pyx_t_7 = __pyx_r;
      __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_t_7;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":976
 *     # internal parser methods
 * 
 *     cdef xmlDoc* _parseUnicodeDoc(self, utext, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         u"""Parse unicode document, share dictionary if possible.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseUnicodeDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1039
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, int c_len,             # <<<<<<<<<<<<<<
 *                            char* c_filename) except NULL:
 *         u"""Parse document, share dictionary if possible.
 */

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDoc(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_text, int __pyx_v_c_len, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  char *__pyx_v_c_encoding;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlParserCtxt *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1047
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_encoding
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1048
 *         cdef char* c_encoding
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1049
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1050
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
    __pyx_t_3 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_3;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1051
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1053
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_4 = (__pyx_v_self->_default_encoding == Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1054
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
 */
      __pyx_v_c_encoding = NULL;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1056
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
 */
      __pyx_t_1 = __pyx_v_self->_default_encoding;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1058
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
 */
    __pyx_t_2 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1059
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1060
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadMemory(
 *                         pctxt, c_text, c_len, c_filename,
 */
          __pyx_t_5 = (__pyx_v_self->_for_html != 0);
          if (__pyx_t_5) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1061
 *             with nogil:
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 */
            __pyx_v_result = htmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1064
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 */
            __pyx_t_5 = ((__pyx_v_result != NULL) != 0);
            if (__pyx_t_5) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1065
 *                         c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              __pyx_t_5 = ((__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0) != 0);
              if (__pyx_t_5) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1066
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
                xmlFreeDoc(__pyx_v_result);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1067
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(
 */
                __pyx_v_result = NULL;
                goto __pyx_L12;
              }
              __pyx_L12:;
              goto __pyx_L11;
            }
            __pyx_L11:;
            goto __pyx_L10;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1069
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadMemory(             # <<<<<<<<<<<<<<
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 */
            __pyx_v_result = xmlCtxtReadMemory(__pyx_v_pctxt, __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
          }
          __pyx_L10:;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1059
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadMemory(
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1072
 *                         pctxt, c_text, c_len, c_filename,
 *                         c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, None)
 */
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1074
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, Py_None); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __pyx_r = __pyx_t_6;
    goto __pyx_L3_return;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1076
 *             return context._handleParseResultDoc(self, result, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_2 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __pyx_t_15 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L14_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_6 = __pyx_r;
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_t_6;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1039
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDoc(self, char* c_text, int c_len,             # <<<<<<<<<<<<<<
 *                            char* c_filename) except NULL:
 *         u"""Parse document, share dictionary if possible.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1078
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         cdef xmlDoc* result
 */

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, char *__pyx_v_c_filename) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  char *__pyx_v_c_encoding;
  int __pyx_v_orig_options;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlParserCtxt *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlDoc *__pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFile", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1083
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_encoding
 *         result = NULL             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
  __pyx_v_result = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1085
 *         result = NULL
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1086
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1087
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1088
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
    __pyx_t_3 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_3;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1089
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *             if self._default_encoding is None:
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1091
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_4 = (__pyx_v_self->_default_encoding == Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1092
 * 
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)
 */
      __pyx_v_c_encoding = NULL;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1094
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = _cstr(self._default_encoding)             # <<<<<<<<<<<<<<
 * 
 *             orig_options = pctxt.options
 */
      __pyx_t_1 = __pyx_v_self->_default_encoding;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_c_encoding = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1096
 *                 c_encoding = _cstr(self._default_encoding)
 * 
 *             orig_options = pctxt.options             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if self._for_html:
 */
    __pyx_t_2 = __pyx_v_pctxt->options;
    __pyx_v_orig_options = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1097
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1098
 *             orig_options = pctxt.options
 *             with nogil:
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 */
          __pyx_t_5 = (__pyx_v_self->_for_html != 0);
          if (__pyx_t_5) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1099
 *             with nogil:
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(             # <<<<<<<<<<<<<<
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
 */
            __pyx_v_result = htmlCtxtReadFile(__pyx_v_pctxt, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1101
 *                     result = htmlparser.htmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:             # <<<<<<<<<<<<<<
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 */
            __pyx_t_5 = ((__pyx_v_result != NULL) != 0);
            if (__pyx_t_5) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1102
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:             # <<<<<<<<<<<<<<
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL
 */
              __pyx_t_5 = ((__pyx_f_4lxml_5etree__fixHtmlDictNames(__pyx_v_pctxt->dict, __pyx_v_result) < 0) != 0);
              if (__pyx_t_5) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1103
 *                     if result is not NULL:
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *                             result = NULL
 *                 else:
 */
                xmlFreeDoc(__pyx_v_result);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1104
 *                         if _fixHtmlDictNames(pctxt.dict, result) < 0:
 *                             tree.xmlFreeDoc(result)
 *                             result = NULL             # <<<<<<<<<<<<<<
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(
 */
                __pyx_v_result = NULL;
                goto __pyx_L12;
              }
              __pyx_L12:;
              goto __pyx_L11;
            }
            __pyx_L11:;
            goto __pyx_L10;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1106
 *                             result = NULL
 *                 else:
 *                     result = xmlparser.xmlCtxtReadFile(             # <<<<<<<<<<<<<<
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem
 */
            __pyx_v_result = xmlCtxtReadFile(__pyx_v_pctxt, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->_parse_options);
          }
          __pyx_L10:;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1097
 * 
 *             orig_options = pctxt.options
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     result = htmlparser.htmlCtxtReadFile(
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1108
 *                     result = xmlparser.xmlCtxtReadFile(
 *                         pctxt, c_filename, c_encoding, self._parse_options)
 *             pctxt.options = orig_options # work around libxml2 problem             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(self, result, c_filename)
 */
    __pyx_v_pctxt->options = __pyx_v_orig_options;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1110
 *             pctxt.options = orig_options # work around libxml2 problem
 * 
 *             return context._handleParseResultDoc(self, result, c_filename)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    goto __pyx_L3_return;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1112
 *             return context._handleParseResultDoc(self, result, c_filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_2 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __pyx_t_15 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L14_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_6 = __pyx_r;
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_t_6;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1078
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFile(self, char* c_filename) except NULL:             # <<<<<<<<<<<<<<
 *         cdef _ParserContext context
 *         cdef xmlDoc* result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDocFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1114
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,             # <<<<<<<<<<<<<<
 *                                        encoding) except NULL:
 *         cdef _ParserContext context
 */

static xmlDoc *__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_filename, PyObject *__pyx_v_encoding) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_file_context = 0;
  xmlDoc *__pyx_v_result;
  xmlParserCtxt *__pyx_v_pctxt;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlParserCtxt *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  xmlDoc *__pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1121
 *         cdef xmlparser.xmlParserCtxt* pctxt
 *         cdef char* c_filename
 *         if not filename:             # <<<<<<<<<<<<<<
 *             filename = None
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1122
 *         cdef char* c_filename
 *         if not filename:
 *             filename = None             # <<<<<<<<<<<<<<
 * 
 *         context = self._getParserContext()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_filename, Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1124
 *             filename = None
 * 
 *         context = self._getParserContext()             # <<<<<<<<<<<<<<
 *         context.prepare()
 *         try:
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)__pyx_v_self->__pyx_vtab)->_getParserContext(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1125
 * 
 *         context = self._getParserContext()
 *         context.prepare()             # <<<<<<<<<<<<<<
 *         try:
 *             pctxt = context._c_ctxt
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1126
 *         context = self._getParserContext()
 *         context.prepare()
 *         try:             # <<<<<<<<<<<<<<
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1127
 *         context.prepare()
 *         try:
 *             pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             file_context = _FileReaderContext(
 */
    __pyx_t_5 = __pyx_v_context->_c_ctxt;
    __pyx_v_pctxt = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1128
 *         try:
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename,
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1131
 *             file_context = _FileReaderContext(
 *                 filelike, context, filename,
 *                 encoding or self._default_encoding)             # <<<<<<<<<<<<<<
 *             result = file_context._readDoc(pctxt, self._parse_options)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    if (!__pyx_t_2) {
      __Pyx_INCREF(__pyx_v_self->_default_encoding);
      __pyx_t_3 = __pyx_v_self->_default_encoding;
    } else {
      __Pyx_INCREF(__pyx_v_encoding);
      __pyx_t_3 = __pyx_v_encoding;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1129
 *             pctxt = context._c_ctxt
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 *             file_context = _FileReaderContext(             # <<<<<<<<<<<<<<
 *                 filelike, context, filename,
 *                 encoding or self._default_encoding)
 */
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_filelike);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filelike);
    __Pyx_GIVEREF(__pyx_v_filelike);
    __Pyx_INCREF(((PyObject *)__pyx_v_context));
    PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_context));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
    __Pyx_INCREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileReaderContext)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_file_context = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1132
 *                 filelike, context, filename,
 *                 encoding or self._default_encoding)
 *             result = file_context._readDoc(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 * 
 *             return context._handleParseResultDoc(
 */
    __pyx_v_result = __pyx_f_4lxml_5etree_18_FileReaderContext__readDoc(__pyx_v_file_context, __pyx_v_pctxt, __pyx_v_self->_parse_options);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1134
 *             result = file_context._readDoc(pctxt, self._parse_options)
 * 
 *             return context._handleParseResultDoc(             # <<<<<<<<<<<<<<
 *                 self, result, filename)
 *         finally:
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResultDoc(__pyx_v_context, __pyx_v_self, __pyx_v_result, __pyx_v_filename); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __pyx_r = __pyx_t_7;
    goto __pyx_L4_return;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1137
 *                 self, result, filename)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_4 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __pyx_t_16 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L8_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_7 = __pyx_r;
      __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_t_7;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1114
 *             context.cleanup()
 * 
 *     cdef xmlDoc* _parseDocFromFilelike(self, filelike, filename,             # <<<<<<<<<<<<<<
 *                                        encoding) except NULL:
 *         cdef _ParserContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseParser._parseDocFromFilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_file_context);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":765
 *     cdef XMLSchema _schema
 *     cdef bytes _filename
 *     cdef readonly object target             # <<<<<<<<<<<<<<
 *     cdef object _default_encoding
 *     cdef tuple _events_to_collect  # (event_types, tag)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_BaseParser_6target_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_BaseParser_6target___get__(struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->target);
  __pyx_r = __pyx_v_self->target;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1152
 *         different from what the ``error_log`` property returns.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._getPushParserContext()._error_log.copy()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_14feed_error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_14feed_error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_14feed_error_log___get__(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1153
 *         """
 *         def __get__(self):
 *             return self._getPushParserContext()._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     cpdef feed(self, data):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1)->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1)->_error_log), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1153; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1152
 *         different from what the ``error_log`` property returns.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._getPushParserContext()._error_log.copy()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed_error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1155
 *             return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         u"""feed(self, data)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = 0;
  xmlParserCtxt *__pyx_v_pctxt;
  Py_ssize_t __pyx_v_py_buffer_len;
  const char *__pyx_v_c_data;
  const char *__pyx_v_c_encoding;
  int __pyx_v_buffer_len;
  int __pyx_v_error;
  int __pyx_v_recover;
  char *__pyx_v_c_filename;
  long __pyx_v_fixup_error;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  const char *__pyx_t_6;
  xmlParserCtxt *__pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  xmlNode *__pyx_t_12;
  xmlDict *__pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *(*__pyx_t_15)(PyObject *);
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  int __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("feed", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_feed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_11_FeedParser_1feed)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_data);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1155; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1180
 *         cdef int buffer_len
 *         cdef int error
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:
 */
  __pyx_v_recover = (__pyx_v_self->__pyx_base._parse_options & XML_PARSE_RECOVER);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1181
 *         cdef int error
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             if self._default_encoding is None:
 *                 c_encoding = NULL
 */
  __pyx_t_4 = PyBytes_Check(__pyx_v_data); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1182
 *         cdef bint recover = self._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:             # <<<<<<<<<<<<<<
 *                 c_encoding = NULL
 *             else:
 */
    __pyx_t_5 = (__pyx_v_self->__pyx_base._default_encoding == Py_None);
    __pyx_t_4 = (__pyx_t_5 != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1183
 *         if isinstance(data, bytes):
 *             if self._default_encoding is None:
 *                 c_encoding = NULL             # <<<<<<<<<<<<<<
 *             else:
 *                 c_encoding = self._default_encoding
 */
      __pyx_v_c_encoding = NULL;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1185
 *                 c_encoding = NULL
 *             else:
 *                 c_encoding = self._default_encoding             # <<<<<<<<<<<<<<
 *             c_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 */
      __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_self->__pyx_base._default_encoding); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_c_encoding = __pyx_t_6;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1186
 *             else:
 *                 c_encoding = self._default_encoding
 *             c_data = _cstr(data)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *         elif isinstance(data, unicode):
 */
    __pyx_v_c_data = PyBytes_AS_STRING(__pyx_v_data);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1187
 *                 c_encoding = self._default_encoding
 *             c_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)             # <<<<<<<<<<<<<<
 *         elif isinstance(data, unicode):
 *             if _UNICODE_ENCODING is NULL:
 */
    __pyx_v_py_buffer_len = PyBytes_GET_SIZE(__pyx_v_data);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1188
 *             c_data = _cstr(data)
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *         elif isinstance(data, unicode):             # <<<<<<<<<<<<<<
 *             if _UNICODE_ENCODING is NULL:
 *                 raise ParserError, \
 */
  __pyx_t_4 = PyUnicode_Check(__pyx_v_data); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1189
 *             py_buffer_len = python.PyBytes_GET_SIZE(data)
 *         elif isinstance(data, unicode):
 *             if _UNICODE_ENCODING is NULL:             # <<<<<<<<<<<<<<
 *                 raise ParserError, \
 *                     u"Unicode parsing is not supported on this platform"
 */
    __pyx_t_5 = ((__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1190
 *         elif isinstance(data, unicode):
 *             if _UNICODE_ENCODING is NULL:
 *                 raise ParserError, \             # <<<<<<<<<<<<<<
 *                     u"Unicode parsing is not supported on this platform"
 *             c_encoding = _UNICODE_ENCODING
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ParserError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, __pyx_kp_u_Unicode_parsing_is_not_supported, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1192
 *                 raise ParserError, \
 *                     u"Unicode parsing is not supported on this platform"
 *             c_encoding = _UNICODE_ENCODING             # <<<<<<<<<<<<<<
 *             c_data = python.PyUnicode_AS_DATA(data)
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)
 */
    __pyx_v_c_encoding = __pyx_v_4lxml_5etree__UNICODE_ENCODING;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1193
 *                     u"Unicode parsing is not supported on this platform"
 *             c_encoding = _UNICODE_ENCODING
 *             c_data = python.PyUnicode_AS_DATA(data)             # <<<<<<<<<<<<<<
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)
 *         else:
 */
    __pyx_v_c_data = PyUnicode_AS_DATA(__pyx_v_data);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1194
 *             c_encoding = _UNICODE_ENCODING
 *             c_data = python.PyUnicode_AS_DATA(data)
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, u"Parsing requires string data"
 */
    __pyx_v_py_buffer_len = PyUnicode_GET_DATA_SIZE(__pyx_v_data);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1196
 *             py_buffer_len = python.PyUnicode_GET_DATA_SIZE(data)
 *         else:
 *             raise TypeError, u"Parsing requires string data"             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_Parsing_requires_string_data, 0, 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1198
 *             raise TypeError, u"Parsing requires string data"
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 *         error = 0
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1199
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 *         error = 0
 *         if not self._feed_parser_running:
 */
  __pyx_t_7 = __pyx_v_context->_c_ctxt;
  __pyx_v_pctxt = __pyx_t_7;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1200
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt
 *         error = 0             # <<<<<<<<<<<<<<
 *         if not self._feed_parser_running:
 *             context.prepare()
 */
  __pyx_v_error = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1201
 *         pctxt = context._c_ctxt
 *         error = 0
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             context.prepare()
 *             self._feed_parser_running = 1
 */
  __pyx_t_5 = ((!(__pyx_v_self->_feed_parser_running != 0)) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1202
 *         error = 0
 *         if not self._feed_parser_running:
 *             context.prepare()             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 */
    __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->prepare(__pyx_v_context); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1203
 *         if not self._feed_parser_running:
 *             context.prepare()
 *             self._feed_parser_running = 1             # <<<<<<<<<<<<<<
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)
 */
    __pyx_v_self->_feed_parser_running = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1205
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)             # <<<<<<<<<<<<<<
 * 
 *             if c_encoding is NULL and py_buffer_len >= 2:
 */
    __pyx_t_5 = (__pyx_v_self->__pyx_base._filename != ((PyObject*)Py_None));
    if ((__pyx_t_5 != 0)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1204
 *             context.prepare()
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)             # <<<<<<<<<<<<<<
 *                           if self._filename is not None else NULL)
 * 
 */
      __pyx_t_1 = __pyx_v_self->__pyx_base._filename;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1205
 *             self._feed_parser_running = 1
 *             c_filename = (_cstr(self._filename)
 *                           if self._filename is not None else NULL)             # <<<<<<<<<<<<<<
 * 
 *             if c_encoding is NULL and py_buffer_len >= 2:
 */
      __pyx_t_9 = NULL;
    }
    __pyx_v_c_filename = __pyx_t_9;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1207
 *                           if self._filename is not None else NULL)
 * 
 *             if c_encoding is NULL and py_buffer_len >= 2:             # <<<<<<<<<<<<<<
 *                 # libxml2 can't handle BOMs here, so let's try ourselves
 *                 if c_data[0] in b'\xfe\xef\xff':
 */
    __pyx_t_5 = ((__pyx_v_c_encoding == NULL) != 0);
    if (__pyx_t_5) {
      __pyx_t_4 = ((__pyx_v_py_buffer_len >= 2) != 0);
      __pyx_t_10 = __pyx_t_4;
    } else {
      __pyx_t_10 = __pyx_t_5;
    }
    if (__pyx_t_10) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1209
 *             if c_encoding is NULL and py_buffer_len >= 2:
 *                 # libxml2 can't handle BOMs here, so let's try ourselves
 *                 if c_data[0] in b'\xfe\xef\xff':             # <<<<<<<<<<<<<<
 *                     # likely a BOM, let's take a closer look
 *                     c_encoding = _findEncodingName(
 */
      switch ((__pyx_v_c_data[0])) {
        case '\xEF':
        case '\xFE':
        case '\xFF':

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1213
 *                     c_encoding = _findEncodingName(
 *                         <const_xmlChar*>c_data,
 *                         4 if py_buffer_len > 4 else <int>py_buffer_len)             # <<<<<<<<<<<<<<
 *                     if c_encoding is not NULL:
 *                         # found it => skip over BOM (if there is one)
 */
        if (((__pyx_v_py_buffer_len > 4) != 0)) {
          __pyx_t_8 = 4;
        } else {
          __pyx_t_8 = ((int)__pyx_v_py_buffer_len);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1211
 *                 if c_data[0] in b'\xfe\xef\xff':
 *                     # likely a BOM, let's take a closer look
 *                     c_encoding = _findEncodingName(             # <<<<<<<<<<<<<<
 *                         <const_xmlChar*>c_data,
 *                         4 if py_buffer_len > 4 else <int>py_buffer_len)
 */
        __pyx_v_c_encoding = __pyx_f_4lxml_5etree__findEncodingName(((const xmlChar *)__pyx_v_c_data), __pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1214
 *                         <const_xmlChar*>c_data,
 *                         4 if py_buffer_len > 4 else <int>py_buffer_len)
 *                     if c_encoding is not NULL:             # <<<<<<<<<<<<<<
 *                         # found it => skip over BOM (if there is one)
 *                         if (c_data[0] == b'\xef' and
 */
        __pyx_t_10 = ((__pyx_v_c_encoding != NULL) != 0);
        if (__pyx_t_10) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1216
 *                     if c_encoding is not NULL:
 *                         # found it => skip over BOM (if there is one)
 *                         if (c_data[0] == b'\xef' and             # <<<<<<<<<<<<<<
 *                                 c_data[1] == b'\xbb' and
 *                                 c_data[2] == b'\xbf'):
 */
          __pyx_t_10 = (((__pyx_v_c_data[0]) == '\xEF') != 0);
          if (__pyx_t_10) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1217
 *                         # found it => skip over BOM (if there is one)
 *                         if (c_data[0] == b'\xef' and
 *                                 c_data[1] == b'\xbb' and             # <<<<<<<<<<<<<<
 *                                 c_data[2] == b'\xbf'):
 *                             c_data += 3  # UTF-8 BOM
 */
            __pyx_t_5 = (((__pyx_v_c_data[1]) == '\xBB') != 0);
            if (__pyx_t_5) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1218
 *                         if (c_data[0] == b'\xef' and
 *                                 c_data[1] == b'\xbb' and
 *                                 c_data[2] == b'\xbf'):             # <<<<<<<<<<<<<<
 *                             c_data += 3  # UTF-8 BOM
 *                             py_buffer_len -= 3
 */
              __pyx_t_4 = (((__pyx_v_c_data[2]) == '\xBF') != 0);
              __pyx_t_11 = __pyx_t_4;
            } else {
              __pyx_t_11 = __pyx_t_5;
            }
            __pyx_t_5 = __pyx_t_11;
          } else {
            __pyx_t_5 = __pyx_t_10;
          }
          if (__pyx_t_5) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1219
 *                                 c_data[1] == b'\xbb' and
 *                                 c_data[2] == b'\xbf'):
 *                             c_data += 3  # UTF-8 BOM             # <<<<<<<<<<<<<<
 *                             py_buffer_len -= 3
 *                         elif (c_data[0] == b'\xfe' and c_data[1] == b'\xff' or
 */
            __pyx_v_c_data = (__pyx_v_c_data + 3);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1220
 *                                 c_data[2] == b'\xbf'):
 *                             c_data += 3  # UTF-8 BOM
 *                             py_buffer_len -= 3             # <<<<<<<<<<<<<<
 *                         elif (c_data[0] == b'\xfe' and c_data[1] == b'\xff' or
 *                                 c_data[0] == b'\xff' and c_data[1] == b'\xfe'):
 */
            __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - 3);
            goto __pyx_L9;
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1221
 *                             c_data += 3  # UTF-8 BOM
 *                             py_buffer_len -= 3
 *                         elif (c_data[0] == b'\xfe' and c_data[1] == b'\xff' or             # <<<<<<<<<<<<<<
 *                                 c_data[0] == b'\xff' and c_data[1] == b'\xfe'):
 *                             # UTF-16 BE/LE
 */
          __pyx_t_5 = (((__pyx_v_c_data[0]) == '\xFE') != 0);
          if (__pyx_t_5) {
            __pyx_t_10 = (((__pyx_v_c_data[1]) == '\xFF') != 0);
            __pyx_t_11 = __pyx_t_10;
          } else {
            __pyx_t_11 = __pyx_t_5;
          }
          if (!__pyx_t_11) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1222
 *                             py_buffer_len -= 3
 *                         elif (c_data[0] == b'\xfe' and c_data[1] == b'\xff' or
 *                                 c_data[0] == b'\xff' and c_data[1] == b'\xfe'):             # <<<<<<<<<<<<<<
 *                             # UTF-16 BE/LE
 *                             c_data += 2
 */
            __pyx_t_5 = (((__pyx_v_c_data[0]) == '\xFF') != 0);
            if (__pyx_t_5) {
              __pyx_t_10 = (((__pyx_v_c_data[1]) == '\xFE') != 0);
              __pyx_t_4 = __pyx_t_10;
            } else {
              __pyx_t_4 = __pyx_t_5;
            }
            __pyx_t_5 = __pyx_t_4;
          } else {
            __pyx_t_5 = __pyx_t_11;
          }
          if (__pyx_t_5) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1224
 *                                 c_data[0] == b'\xff' and c_data[1] == b'\xfe'):
 *                             # UTF-16 BE/LE
 *                             c_data += 2             # <<<<<<<<<<<<<<
 *                             py_buffer_len -= 2
 * 
 */
            __pyx_v_c_data = (__pyx_v_c_data + 2);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1225
 *                             # UTF-16 BE/LE
 *                             c_data += 2
 *                             py_buffer_len -= 2             # <<<<<<<<<<<<<<
 * 
 *             if self._for_html:
 */
            __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - 2);
            goto __pyx_L9;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }
        __pyx_L8:;
        break;
        default: break;
      }
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1227
 *                             py_buffer_len -= 2
 * 
 *             if self._for_html:             # <<<<<<<<<<<<<<
 *                 error = _htmlCtxtResetPush(
 *                     pctxt, NULL, 0, c_filename, c_encoding,
 */
    __pyx_t_5 = (__pyx_v_self->__pyx_base._for_html != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1228
 * 
 *             if self._for_html:
 *                 error = _htmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *                     pctxt, NULL, 0, c_filename, c_encoding,
 *                     self._parse_options)
 */
      __pyx_t_8 = __pyx_f_4lxml_5etree__htmlCtxtResetPush(__pyx_v_pctxt, NULL, 0, __pyx_v_c_filename, __pyx_v_c_encoding, __pyx_v_self->__pyx_base._parse_options); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_error = __pyx_t_8;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1232
 *                     self._parse_options)
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)             # <<<<<<<<<<<<<<
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, NULL, 0, c_filename, c_encoding)
 */
      xmlCtxtUseOptions(__pyx_v_pctxt, __pyx_v_self->__pyx_base._parse_options);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1233
 *             else:
 *                 xmlparser.xmlCtxtUseOptions(pctxt, self._parse_options)
 *                 error = xmlparser.xmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *                     pctxt, NULL, 0, c_filename, c_encoding)
 *             if error:
 */
      __pyx_v_error = xmlCtxtResetPush(__pyx_v_pctxt, NULL, 0, __pyx_v_c_filename, __pyx_v_c_encoding);
    }
    __pyx_L10:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1235
 *                 error = xmlparser.xmlCtxtResetPush(
 *                     pctxt, NULL, 0, c_filename, c_encoding)
 *             if error:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 */
    __pyx_t_5 = (__pyx_v_error != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1236
 *                     pctxt, NULL, 0, c_filename, c_encoding)
 *             if error:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)
 * 
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1237
 *             if error:
 *                 raise MemoryError()
 *             __GLOBAL_PARSER_CONTEXT.initParserDict(pctxt)             # <<<<<<<<<<<<<<
 * 
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
 */
    __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_pctxt);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1241
 *         #print pctxt.charset, 'NONE' if c_encoding is NULL else c_encoding
 * 
 *         fixup_error = 0             # <<<<<<<<<<<<<<
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:
 */
  __pyx_v_fixup_error = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1242
 * 
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if py_buffer_len > limits.INT_MAX:
 */
  while (1) {
    __pyx_t_5 = ((__pyx_v_py_buffer_len > 0) != 0);
    if (__pyx_t_5) {
      __pyx_t_11 = ((__pyx_v_error == 0) != 0);
      if (!__pyx_t_11) {
        __pyx_t_4 = (__pyx_v_recover != 0);
      } else {
        __pyx_t_4 = __pyx_t_11;
      }
      __pyx_t_11 = __pyx_t_4;
    } else {
      __pyx_t_11 = __pyx_t_5;
    }
    if (!__pyx_t_11) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1243
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if py_buffer_len > limits.INT_MAX:
 *                     buffer_len = limits.INT_MAX
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1244
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:
 *                 if py_buffer_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *                     buffer_len = limits.INT_MAX
 *                 else:
 */
          __pyx_t_11 = ((__pyx_v_py_buffer_len > INT_MAX) != 0);
          if (__pyx_t_11) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1245
 *             with nogil:
 *                 if py_buffer_len > limits.INT_MAX:
 *                     buffer_len = limits.INT_MAX             # <<<<<<<<<<<<<<
 *                 else:
 *                     buffer_len = <int>py_buffer_len
 */
            __pyx_v_buffer_len = INT_MAX;
            goto __pyx_L19;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1247
 *                     buffer_len = limits.INT_MAX
 *                 else:
 *                     buffer_len = <int>py_buffer_len             # <<<<<<<<<<<<<<
 *                 if self._for_html:
 *                     c_node = pctxt.node  # last node where the parser stopped
 */
            __pyx_v_buffer_len = ((int)__pyx_v_py_buffer_len);
          }
          __pyx_L19:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1248
 *                 else:
 *                     buffer_len = <int>py_buffer_len
 *                 if self._for_html:             # <<<<<<<<<<<<<<
 *                     c_node = pctxt.node  # last node where the parser stopped
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
 */
          __pyx_t_11 = (__pyx_v_self->__pyx_base._for_html != 0);
          if (__pyx_t_11) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1249
 *                     buffer_len = <int>py_buffer_len
 *                 if self._for_html:
 *                     c_node = pctxt.node  # last node where the parser stopped             # <<<<<<<<<<<<<<
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                     # and now for the fun part: move node names to the dict
 */
            __pyx_t_12 = __pyx_v_pctxt->node;
            __pyx_v_c_node = __pyx_t_12;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1250
 *                 if self._for_html:
 *                     c_node = pctxt.node  # last node where the parser stopped
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *                     # and now for the fun part: move node names to the dict
 *                     if pctxt.myDoc:
 */
            __pyx_v_error = htmlParseChunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_buffer_len, 0);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1252
 *                     error = htmlparser.htmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                     # and now for the fun part: move node names to the dict
 *                     if pctxt.myDoc:             # <<<<<<<<<<<<<<
 *                         fixup_error = _fixHtmlDictSubtreeNames(
 *                             pctxt.dict, pctxt.myDoc, c_node)
 */
            __pyx_t_11 = (__pyx_v_pctxt->myDoc != 0);
            if (__pyx_t_11) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1253
 *                     # and now for the fun part: move node names to the dict
 *                     if pctxt.myDoc:
 *                         fixup_error = _fixHtmlDictSubtreeNames(             # <<<<<<<<<<<<<<
 *                             pctxt.dict, pctxt.myDoc, c_node)
 *                         if pctxt.myDoc.dict and pctxt.myDoc.dict is not pctxt.dict:
 */
              __pyx_v_fixup_error = __pyx_f_4lxml_5etree__fixHtmlDictSubtreeNames(__pyx_v_pctxt->dict, __pyx_v_pctxt->myDoc, __pyx_v_c_node);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1255
 *                         fixup_error = _fixHtmlDictSubtreeNames(
 *                             pctxt.dict, pctxt.myDoc, c_node)
 *                         if pctxt.myDoc.dict and pctxt.myDoc.dict is not pctxt.dict:             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlDictFree(pctxt.myDoc.dict)
 *                             pctxt.myDoc.dict = pctxt.dict
 */
              if ((__pyx_v_pctxt->myDoc->dict != 0)) {
                __pyx_t_11 = ((__pyx_v_pctxt->myDoc->dict != __pyx_v_pctxt->dict) != 0);
                __pyx_t_5 = __pyx_t_11;
              } else {
                __pyx_t_5 = (__pyx_v_pctxt->myDoc->dict != 0);
              }
              if (__pyx_t_5) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1256
 *                             pctxt.dict, pctxt.myDoc, c_node)
 *                         if pctxt.myDoc.dict and pctxt.myDoc.dict is not pctxt.dict:
 *                             xmlparser.xmlDictFree(pctxt.myDoc.dict)             # <<<<<<<<<<<<<<
 *                             pctxt.myDoc.dict = pctxt.dict
 *                             xmlparser.xmlDictReference(pctxt.dict)
 */
                xmlDictFree(__pyx_v_pctxt->myDoc->dict);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1257
 *                         if pctxt.myDoc.dict and pctxt.myDoc.dict is not pctxt.dict:
 *                             xmlparser.xmlDictFree(pctxt.myDoc.dict)
 *                             pctxt.myDoc.dict = pctxt.dict             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlDictReference(pctxt.dict)
 *                 else:
 */
                __pyx_t_13 = __pyx_v_pctxt->dict;
                __pyx_v_pctxt->myDoc->dict = __pyx_t_13;

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1258
 *                             xmlparser.xmlDictFree(pctxt.myDoc.dict)
 *                             pctxt.myDoc.dict = pctxt.dict
 *                             xmlparser.xmlDictReference(pctxt.dict)             # <<<<<<<<<<<<<<
 *                 else:
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
 */
                xmlDictReference(__pyx_v_pctxt->dict);
                goto __pyx_L22;
              }
              __pyx_L22:;
              goto __pyx_L21;
            }
            __pyx_L21:;
            goto __pyx_L20;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1260
 *                             xmlparser.xmlDictReference(pctxt.dict)
 *                 else:
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *                 py_buffer_len -= buffer_len
 *                 c_data += buffer_len
 */
            __pyx_v_error = xmlParseChunk(__pyx_v_pctxt, __pyx_v_c_data, __pyx_v_buffer_len, 0);
          }
          __pyx_L20:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1261
 *                 else:
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                 py_buffer_len -= buffer_len             # <<<<<<<<<<<<<<
 *                 c_data += buffer_len
 * 
 */
          __pyx_v_py_buffer_len = (__pyx_v_py_buffer_len - __pyx_v_buffer_len);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1262
 *                     error = xmlparser.xmlParseChunk(pctxt, c_data, buffer_len, 0)
 *                 py_buffer_len -= buffer_len
 *                 c_data += buffer_len             # <<<<<<<<<<<<<<
 * 
 *             if fixup_error and not context.has_raised():
 */
          __pyx_v_c_data = (__pyx_v_c_data + __pyx_v_buffer_len);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1243
 *         fixup_error = 0
 *         while py_buffer_len > 0 and (error == 0 or recover):
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if py_buffer_len > limits.INT_MAX:
 *                     buffer_len = limits.INT_MAX
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L18;
          }
          __pyx_L18:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1264
 *                 c_data += buffer_len
 * 
 *             if fixup_error and not context.has_raised():             # <<<<<<<<<<<<<<
 *                 context.store_exception(MemoryError())
 * 
 */
    if ((__pyx_v_fixup_error != 0)) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context), __pyx_n_s_has_raised); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = (!__pyx_t_5);
      __pyx_t_5 = __pyx_t_11;
    } else {
      __pyx_t_5 = (__pyx_v_fixup_error != 0);
    }
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1265
 * 
 *             if fixup_error and not context.has_raised():
 *                 context.store_exception(MemoryError())             # <<<<<<<<<<<<<<
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context), __pyx_n_s_store_exception); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1265; __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[6]; __pyx_lineno = 1265; __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 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L23;
    }
    __pyx_L23:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1267
 *                 context.store_exception(MemoryError())
 * 
 *             if error and not pctxt.replaceEntities and not pctxt.validate:             # <<<<<<<<<<<<<<
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 */
    if ((__pyx_v_error != 0)) {
      __pyx_t_5 = (!(__pyx_v_pctxt->replaceEntities != 0));
      if (__pyx_t_5) {
        __pyx_t_11 = (!(__pyx_v_pctxt->validate != 0));
        __pyx_t_4 = __pyx_t_11;
      } else {
        __pyx_t_4 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = (__pyx_v_error != 0);
    }
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1269
 *             if error and not pctxt.replaceEntities and not pctxt.validate:
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():             # <<<<<<<<<<<<<<
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_context->_error_log), __pyx_n_s_filter_from_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_14 = 0;
        __pyx_t_15 = NULL;
      } else {
        __pyx_t_14 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_15 = Py_TYPE(__pyx_t_1)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_1)) {
          if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_1)) {
          if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_2 = __pyx_t_15(__pyx_t_1);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1270
 *                 # in this mode, we ignore errors about undefined entities
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \             # <<<<<<<<<<<<<<
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_WAR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_16, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_5) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1271
 *                 for entry in context._error_log.filter_from_errors():
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:             # <<<<<<<<<<<<<<
 *                         break
 *                 else:
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_ERR_UNDECLARED_ENTITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_16 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_11 = __pyx_t_4;
        } else {
          __pyx_t_11 = __pyx_t_5;
        }
        if (__pyx_t_11) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1272
 *                     if entry.type != ErrorTypes.WAR_UNDECLARED_ENTITY and \
 *                            entry.type != ErrorTypes.ERR_UNDECLARED_ENTITY:
 *                         break             # <<<<<<<<<<<<<<
 *                 else:
 *                     error = 0
 */
          goto __pyx_L26_break;
        }
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1274
 *                         break
 *                 else:
 *                     error = 0             # <<<<<<<<<<<<<<
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
 */
        __pyx_v_error = 0;
      }
      __pyx_L26_break:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L24;
    }
    __pyx_L24:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1276
 *                     error = 0
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):             # <<<<<<<<<<<<<<
 *             self._feed_parser_running = 0
 *             try:
 */
  if (!(__pyx_v_fixup_error != 0)) {
    __pyx_t_11 = (!(__pyx_v_recover != 0));
    if (__pyx_t_11) {
      if (!(__pyx_v_error != 0)) {
        __pyx_t_5 = (!(__pyx_v_pctxt->wellFormed != 0));
        __pyx_t_4 = __pyx_t_5;
      } else {
        __pyx_t_4 = (__pyx_v_error != 0);
      }
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_11;
    }
    __pyx_t_11 = __pyx_t_5;
  } else {
    __pyx_t_11 = (__pyx_v_fixup_error != 0);
  }
  if (__pyx_t_11) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1277
 * 
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
 *             self._feed_parser_running = 0             # <<<<<<<<<<<<<<
 *             try:
 *                 context._handleParseResult(self, pctxt.myDoc, None)
 */
    __pyx_v_self->_feed_parser_running = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1278
 *         if fixup_error or not recover and (error or not pctxt.wellFormed):
 *             self._feed_parser_running = 0
 *             try:             # <<<<<<<<<<<<<<
 *                 context._handleParseResult(self, pctxt.myDoc, None)
 *             finally:
 */
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1279
 *             self._feed_parser_running = 0
 *             try:
 *                 context._handleParseResult(self, pctxt.myDoc, None)             # <<<<<<<<<<<<<<
 *             finally:
 *                 context.cleanup()
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResult(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_pctxt->myDoc, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1281
 *                 context._handleParseResult(self, pctxt.myDoc, None)
 *             finally:
 *                 context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cpdef close(self):
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L32;
      }
      /*exception exit:*/{
        __pyx_L31_error:;
        __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_19);
        __Pyx_XGOTREF(__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_23);
        __Pyx_XGOTREF(__pyx_t_24);
        __pyx_t_8 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
        {
          __pyx_t_25 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_XGIVEREF(__pyx_t_24);
          __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
        }
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
        __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
        goto __pyx_L1_error;
        __pyx_L34_error:;
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_XGIVEREF(__pyx_t_24);
          __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
        }
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L32:;
    }
    goto __pyx_L29;
  }
  __pyx_L29:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1155
 *             return self._getPushParserContext()._error_log.copy()
 * 
 *     cpdef feed(self, data):             # <<<<<<<<<<<<<<
 *         u"""feed(self, data)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_4lxml_5etree_11_FeedParser_feed[] = "feed(self, data)\n\n        Feeds data to the parser.  The argument should be an 8-bit string\n        buffer containing encoded data, although Unicode is supported as long\n        as both string types are not mixed.\n\n        This is the main entry point to the consumer interface of a\n        parser.  The parser will parse as much of the XML stream as it\n        can on each call.  To finish parsing or to reset the parser,\n        call the ``close()`` method.  Both methods may raise\n        ParseError if errors occur in the input data.  If an error is\n        raised, there is no longer a need to call ``close()``.\n\n        The feed parser interface is independent of the normal parser\n        usage.  You can use the same parser as a feed parser and in\n        the ``parse()`` function concurrently.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_1feed(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("feed (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_feed(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self), ((PyObject *)__pyx_v_data));

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

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_feed(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("feed", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->feed(__pyx_v_self, __pyx_v_data, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FeedParser.feed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1283
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         u"""close(self)
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_11_FeedParser_close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_v_context = NULL;
  xmlParserCtxt *__pyx_v_pctxt;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlParserCtxt *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_11_FeedParser_3close)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1283; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1294
 *         parser interface, all other usage is undefined.
 *         """
 *         if not self._feed_parser_running:             # <<<<<<<<<<<<<<
 *             raise XMLSyntaxError(u"no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 */
  __pyx_t_3 = ((!(__pyx_v_self->_feed_parser_running != 0)) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1295
 *         """
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError(u"no element found",             # <<<<<<<<<<<<<<
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSyntaxError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1296
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError(u"no element found",
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *         context = self._getPushParserContext()
 */
    __pyx_t_2 = PyInt_FromLong(XML_ERR_INTERNAL_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1295
 *         """
 *         if not self._feed_parser_running:
 *             raise XMLSyntaxError(u"no element found",             # <<<<<<<<<<<<<<
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 */
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_kp_u_no_element_found);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_no_element_found);
    __Pyx_GIVEREF(__pyx_kp_u_no_element_found);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1298
 *                                  xmlerror.XML_ERR_INTERNAL_ERROR, 0, 0)
 * 
 *         context = self._getPushParserContext()             # <<<<<<<<<<<<<<
 *         pctxt = context._c_ctxt
 * 
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1299
 * 
 *         context = self._getPushParserContext()
 *         pctxt = context._c_ctxt             # <<<<<<<<<<<<<<
 * 
 *         self._feed_parser_running = 0
 */
  __pyx_t_5 = __pyx_v_context->_c_ctxt;
  __pyx_v_pctxt = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1301
 *         pctxt = context._c_ctxt
 * 
 *         self._feed_parser_running = 0             # <<<<<<<<<<<<<<
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 */
  __pyx_v_self->_feed_parser_running = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1302
 * 
 *         self._feed_parser_running = 0
 *         if self._for_html:             # <<<<<<<<<<<<<<
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 */
  __pyx_t_3 = (__pyx_v_self->__pyx_base._for_html != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1303
 *         self._feed_parser_running = 0
 *         if self._for_html:
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 */
    htmlParseChunk(__pyx_v_pctxt, NULL, 0, 1);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1305
 *             htmlparser.htmlParseChunk(pctxt, NULL, 0, 1)
 *         else:
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)             # <<<<<<<<<<<<<<
 * 
 *         if (pctxt.recovery and not pctxt.disableSAX and
 */
    xmlParseChunk(__pyx_v_pctxt, NULL, 0, 1);
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1307
 *             xmlparser.xmlParseChunk(pctxt, NULL, 0, 1)
 * 
 *         if (pctxt.recovery and not pctxt.disableSAX and             # <<<<<<<<<<<<<<
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
 */
  if ((__pyx_v_pctxt->recovery != 0)) {
    __pyx_t_3 = ((!(__pyx_v_pctxt->disableSAX != 0)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1308
 * 
 *         if (pctxt.recovery and not pctxt.disableSAX and
 *                 isinstance(context, _SaxParserContext)):             # <<<<<<<<<<<<<<
 *             # apply any left-over 'end' events
 *             (<_SaxParserContext>context).flushEvents()
 */
      __pyx_t_6 = __Pyx_TypeCheck(((PyObject *)__pyx_v_context), ((PyObject*)__pyx_ptype_4lxml_5etree__SaxParserContext)); 
      __pyx_t_7 = (__pyx_t_6 != 0);
    } else {
      __pyx_t_7 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_7;
  } else {
    __pyx_t_3 = (__pyx_v_pctxt->recovery != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1310
 *                 isinstance(context, _SaxParserContext)):
 *             # apply any left-over 'end' events
 *             (<_SaxParserContext>context).flushEvents()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_context)->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->flushEvents(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_context)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1312
 *             (<_SaxParserContext>context).flushEvents()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1313
 * 
 *         try:
 *             result = context._handleParseResult(self, pctxt.myDoc, None)             # <<<<<<<<<<<<<<
 *         finally:
 *             context.cleanup()
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->_handleParseResult(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_pctxt->myDoc, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1315
 *             result = context._handleParseResult(self, pctxt.myDoc, None)
 *         finally:
 *             context.cleanup()             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(result, _Document):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    /*exception exit:*/{
      __pyx_L7_error:;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_17 = ((struct __pyx_vtabstruct_4lxml_5etree__ParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->cleanup(__pyx_v_context); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L8:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1317
 *             context.cleanup()
 * 
 *         if isinstance(result, _Document):             # <<<<<<<<<<<<<<
 *             return (<_Document>result).getroot()
 *         else:
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_result, ((PyObject*)__pyx_ptype_4lxml_5etree__Document)); 
  __pyx_t_7 = (__pyx_t_3 != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1318
 * 
 *         if isinstance(result, _Document):
 *             return (<_Document>result).getroot()             # <<<<<<<<<<<<<<
 *         else:
 *             return result
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_4lxml_5etree_9_Document_getroot(((struct LxmlDocument *)__pyx_v_result)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1320
 *             return (<_Document>result).getroot()
 *         else:
 *             return result             # <<<<<<<<<<<<<<
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1283
 *                 context.cleanup()
 * 
 *     cpdef close(self):             # <<<<<<<<<<<<<<
 *         u"""close(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._FeedParser.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_11_FeedParser_2close[] = "close(self)\n\n        Terminates feeding data to this parser.  This tells the parser to\n        process any remaining data in the feed buffer, and then returns the\n        root Element of the tree that was parsed.\n\n        This method must be called after passing the last chunk of data into\n        the ``feed()`` method.  It should only be called when using the feed\n        parser interface, all other usage is undefined.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11_FeedParser_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11_FeedParser_2close(((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11_FeedParser_2close(struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->close(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._FeedParser.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1322
 *             return result
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                              const_char* c_data, int buffer_len,
 *                              const_char* c_filename, const_char* c_encoding,
 */

static int __pyx_f_4lxml_5etree__htmlCtxtResetPush(xmlParserCtxt *__pyx_v_c_ctxt, const char *__pyx_v_c_data, int __pyx_v_buffer_len, const char *__pyx_v_c_filename, const char *__pyx_v_c_encoding, int __pyx_v_parse_options) {
  int __pyx_v_error;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_htmlCtxtResetPush", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1328
 *     cdef xmlparser.xmlParserInput* c_input_stream
 *     # libxml2 crashes if spaceTab is not initialised
 *     if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL:             # <<<<<<<<<<<<<<
 *         c_ctxt.spaceTab = <int*>tree.xmlMalloc(10 * sizeof(int))
 *         c_ctxt.spaceMax = 10
 */
  __pyx_t_1 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20629) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_ctxt->spaceTab == NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1329
 *     # libxml2 crashes if spaceTab is not initialised
 *     if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL:
 *         c_ctxt.spaceTab = <int*>tree.xmlMalloc(10 * sizeof(int))             # <<<<<<<<<<<<<<
 *         c_ctxt.spaceMax = 10
 * 
 */
    __pyx_v_c_ctxt->spaceTab = ((int *)xmlMalloc((10 * (sizeof(int)))));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1330
 *     if _LIBXML_VERSION_INT < 20629 and c_ctxt.spaceTab is NULL:
 *         c_ctxt.spaceTab = <int*>tree.xmlMalloc(10 * sizeof(int))
 *         c_ctxt.spaceMax = 10             # <<<<<<<<<<<<<<
 * 
 *     # libxml2 lacks an HTML push parser setup function
 */
    __pyx_v_c_ctxt->spaceMax = 10;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1333
 * 
 *     # libxml2 lacks an HTML push parser setup function
 *     error = xmlparser.xmlCtxtResetPush(             # <<<<<<<<<<<<<<
 *         c_ctxt, NULL, 0, c_filename, c_encoding)
 *     if error:
 */
  __pyx_v_error = xmlCtxtResetPush(__pyx_v_c_ctxt, NULL, 0, __pyx_v_c_filename, __pyx_v_c_encoding);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1335
 *     error = xmlparser.xmlCtxtResetPush(
 *         c_ctxt, NULL, 0, c_filename, c_encoding)
 *     if error:             # <<<<<<<<<<<<<<
 *         return error
 * 
 */
  __pyx_t_3 = (__pyx_v_error != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1336
 *         c_ctxt, NULL, 0, c_filename, c_encoding)
 *     if error:
 *         return error             # <<<<<<<<<<<<<<
 * 
 *     # fix libxml2 setup for HTML
 */
    __pyx_r = __pyx_v_error;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1339
 * 
 *     # fix libxml2 setup for HTML
 *     c_ctxt.progressive = 1             # <<<<<<<<<<<<<<
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 */
  __pyx_v_c_ctxt->progressive = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1340
 *     # fix libxml2 setup for HTML
 *     c_ctxt.progressive = 1
 *     c_ctxt.html = 1             # <<<<<<<<<<<<<<
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
 */
  __pyx_v_c_ctxt->html = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1341
 *     c_ctxt.progressive = 1
 *     c_ctxt.html = 1
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)             # <<<<<<<<<<<<<<
 * 
 *     if c_data is not NULL and buffer_len > 0:
 */
  htmlCtxtUseOptions(__pyx_v_c_ctxt, __pyx_v_parse_options);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1343
 *     htmlparser.htmlCtxtUseOptions(c_ctxt, parse_options)
 * 
 *     if c_data is not NULL and buffer_len > 0:             # <<<<<<<<<<<<<<
 *         return htmlparser.htmlParseChunk(c_ctxt, c_data, buffer_len, 0)
 *     return 0
 */
  __pyx_t_3 = ((__pyx_v_c_data != NULL) != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = ((__pyx_v_buffer_len > 0) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1344
 * 
 *     if c_data is not NULL and buffer_len > 0:
 *         return htmlparser.htmlParseChunk(c_ctxt, c_data, buffer_len, 0)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_r = htmlParseChunk(__pyx_v_c_ctxt, __pyx_v_c_data, __pyx_v_buffer_len, 0);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1345
 *     if c_data is not NULL and buffer_len > 0:
 *         return htmlparser.htmlParseChunk(c_ctxt, c_data, buffer_len, 0)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1322
 *             return result
 * 
 * cdef int _htmlCtxtResetPush(xmlparser.xmlParserCtxt* c_ctxt,             # <<<<<<<<<<<<<<
 *                              const_char* c_data, int buffer_len,
 *                              const_char* c_filename, const_char* c_encoding,
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1403
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9XMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9XMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_ns_clean = 0;
  PyObject *__pyx_v_recover = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_huge_tree = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding,&__pyx_n_s_attribute_defaults,&__pyx_n_s_dtd_validation,&__pyx_n_s_load_dtd,&__pyx_n_s_no_network,&__pyx_n_s_ns_clean,&__pyx_n_s_recover,&__pyx_n_s_schema,&__pyx_n_s_huge_tree,&__pyx_n_s_remove_blank_text,&__pyx_n_s_resolve_entities,&__pyx_n_s_remove_comments,&__pyx_n_s_remove_pis,&__pyx_n_s_strip_cdata,&__pyx_n_s_target,&__pyx_n_s_compact,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1404
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 */
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)Py_False);
    values[4] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1405
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 */
    values[5] = ((PyObject *)Py_False);
    values[6] = ((PyObject *)Py_False);
    values[7] = (PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1406
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  target=None, compact=True):
 */
    values[8] = ((PyObject *)Py_False);
    values[9] = ((PyObject *)Py_False);
    values[10] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1407
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  target=None, compact=True):
 *         cdef int parse_options
 */
    values[11] = ((PyObject *)Py_False);
    values[12] = ((PyObject *)Py_False);
    values[13] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1408
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 16)) {
        Py_ssize_t index;
        for (index = 0; index < 16 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_encoding = values[0];
    __pyx_v_attribute_defaults = values[1];
    __pyx_v_dtd_validation = values[2];
    __pyx_v_load_dtd = values[3];
    __pyx_v_no_network = values[4];
    __pyx_v_ns_clean = values[5];
    __pyx_v_recover = values[6];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[7]);
    __pyx_v_huge_tree = values[8];
    __pyx_v_remove_blank_text = values[9];
    __pyx_v_resolve_entities = values[10];
    __pyx_v_remove_comments = values[11];
    __pyx_v_remove_pis = values[12];
    __pyx_v_strip_cdata = values[13];
    __pyx_v_target = values[14];
    __pyx_v_compact = values[15];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLParser___init__(((struct __pyx_obj_4lxml_5etree_XMLParser *)__pyx_v_self), __pyx_v_encoding, __pyx_v_attribute_defaults, __pyx_v_dtd_validation, __pyx_v_load_dtd, __pyx_v_no_network, __pyx_v_ns_clean, __pyx_v_recover, __pyx_v_schema, __pyx_v_huge_tree, __pyx_v_remove_blank_text, __pyx_v_resolve_entities, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_target, __pyx_v_compact);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1403
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9XMLParser___init__(struct __pyx_obj_4lxml_5etree_XMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_compact) {
  int __pyx_v_parse_options;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1410
 *                  target=None, compact=True):
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1411
 *         cdef int parse_options
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_load_dtd); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1412
 *         parse_options = _XML_DEFAULT_PARSE_OPTIONS
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1413
 *         if load_dtd:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dtd_validation); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1414
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if dtd_validation:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \             # <<<<<<<<<<<<<<
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:
 */
    __pyx_v_parse_options = ((__pyx_v_parse_options | XML_PARSE_DTDVALID) | XML_PARSE_DTDLOAD);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1416
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDVALID | \
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1417
 *                             xmlparser.XML_PARSE_DTDLOAD
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR             # <<<<<<<<<<<<<<
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDATTR);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1418
 *         if attribute_defaults:
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:             # <<<<<<<<<<<<<<
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_schema) == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1419
 *             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD             # <<<<<<<<<<<<<<
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 */
      __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_DTDLOAD);
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1420
 *             if schema is None:
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ns_clean); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1421
 *                 parse_options = parse_options | xmlparser.XML_PARSE_DTDLOAD
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN             # <<<<<<<<<<<<<<
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NSCLEAN);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1422
 *         if ns_clean:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1423
 *             parse_options = parse_options | xmlparser.XML_PARSE_NSCLEAN
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_RECOVER);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1424
 *         if recover:
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1425
 *             parse_options = parse_options | xmlparser.XML_PARSE_RECOVER
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_NOBLANKS);
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1426
 *         if remove_blank_text:
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_huge_tree); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1427
 *             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | XML_PARSE_HUGE);
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1428
 *         if huge_tree:
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1429
 *             parse_options = parse_options | xmlparser.XML_PARSE_HUGE
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NONET);
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1430
 *         if not no_network:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1431
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_COMPACT);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1432
 *         if not compact:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_resolve_entities); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1433
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT             # <<<<<<<<<<<<<<
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOENT);
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1434
 *         if not resolve_entities:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_strip_cdata); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1435
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 *         if not strip_cdata:
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, 0, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ XML_PARSE_NOCDATA);
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1437
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 *         _BaseParser.__init__(self, parse_options, 0, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, encoding)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseParser)), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_parse_options); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1439
 *         _BaseParser.__init__(self, parse_options, 0, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, encoding)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = PyTuple_New(9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_INCREF(__pyx_v_remove_comments);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_remove_comments);
  __Pyx_GIVEREF(__pyx_v_remove_comments);
  __Pyx_INCREF(__pyx_v_remove_pis);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_remove_pis);
  __Pyx_GIVEREF(__pyx_v_remove_pis);
  __Pyx_INCREF(__pyx_v_strip_cdata);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_strip_cdata);
  __Pyx_GIVEREF(__pyx_v_strip_cdata);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_5, 8, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1437
 *             parse_options = parse_options ^ xmlparser.XML_PARSE_NOCDATA
 * 
 *         _BaseParser.__init__(self, parse_options, 0, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, encoding)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1403
 *     apply to the default parser.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, XMLSchema schema=None,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1460
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13XMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13XMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_base_url = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_events,&__pyx_n_s_tag,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_events);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_events = values[0];
    __pyx_v_tag = values[1];
    __pyx_v_base_url = values[2];
  }
  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[6]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("lxml.etree.XMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13XMLPullParser___init__(((struct __pyx_obj_4lxml_5etree_XMLPullParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag, __pyx_v_base_url, __pyx_v_kwargs);

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

static int __pyx_pf_4lxml_5etree_13XMLPullParser___init__(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_events);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1461
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         XMLParser.__init__(self, **kwargs)             # <<<<<<<<<<<<<<
 *         if events is None:
 *             events = ('end',)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1461; __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[6]; __pyx_lineno = 1461; __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 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1462
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:             # <<<<<<<<<<<<<<
 *             events = ('end',)
 *         self._setBaseURL(base_url)
 */
  __pyx_t_5 = (__pyx_v_events == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1463
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
    __Pyx_INCREF(__pyx_tuple__47);
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_tuple__47);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1464
 *         if events is None:
 *             events = ('end',)
 *         self._setBaseURL(base_url)             # <<<<<<<<<<<<<<
 *         self._collectEvents(events, tag)
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._setBaseURL(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_base_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1465
 *             events = ('end',)
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)             # <<<<<<<<<<<<<<
 * 
 *     def read_events(self):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._collectEvents(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1460
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1467
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_events (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_13XMLPullParser_2read_events(((struct __pyx_obj_4lxml_5etree_XMLPullParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_13XMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_XMLPullParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_events", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1468
 * 
 *     def read_events(self):
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__SaxParserContext)))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1467
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XMLPullParser.read_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1486
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_ns_clean = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_schema = 0;
  PyObject *__pyx_v_huge_tree = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_compact = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding,&__pyx_n_s_attribute_defaults,&__pyx_n_s_dtd_validation,&__pyx_n_s_load_dtd,&__pyx_n_s_no_network,&__pyx_n_s_ns_clean,&__pyx_n_s_recover,&__pyx_n_s_schema,&__pyx_n_s_huge_tree,&__pyx_n_s_remove_blank_text,&__pyx_n_s_resolve_entities,&__pyx_n_s_remove_comments,&__pyx_n_s_remove_pis,&__pyx_n_s_strip_cdata,&__pyx_n_s_target,&__pyx_n_s_compact,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1487
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,             # <<<<<<<<<<<<<<
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 */
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)Py_False);
    values[4] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1488
 *     def __init__(self, *, encoding=None, attribute_defaults=False,
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,             # <<<<<<<<<<<<<<
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 */
    values[5] = ((PyObject *)Py_False);
    values[6] = ((PyObject *)Py_False);
    values[7] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1489
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,             # <<<<<<<<<<<<<<
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
 */
    values[8] = ((PyObject *)Py_False);
    values[9] = ((PyObject *)Py_False);
    values[10] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1490
 *                  ns_clean=False, recover=False, schema=None,
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
 */
    values[11] = ((PyObject *)Py_True);
    values[12] = ((PyObject *)Py_True);
    values[13] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1491
 *                  huge_tree=False, remove_blank_text=False, resolve_entities=True,
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):             # <<<<<<<<<<<<<<
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
 */
    values[14] = ((PyObject *)Py_None);
    values[15] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 16)) {
        Py_ssize_t index;
        for (index = 0; index < 16 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_encoding = values[0];
    __pyx_v_attribute_defaults = values[1];
    __pyx_v_dtd_validation = values[2];
    __pyx_v_load_dtd = values[3];
    __pyx_v_no_network = values[4];
    __pyx_v_ns_clean = values[5];
    __pyx_v_recover = values[6];
    __pyx_v_schema = values[7];
    __pyx_v_huge_tree = values[8];
    __pyx_v_remove_blank_text = values[9];
    __pyx_v_resolve_entities = values[10];
    __pyx_v_remove_comments = values[11];
    __pyx_v_remove_pis = values[12];
    __pyx_v_strip_cdata = values[13];
    __pyx_v_target = values[14];
    __pyx_v_compact = values[15];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(((struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *)__pyx_v_self), __pyx_v_encoding, __pyx_v_attribute_defaults, __pyx_v_dtd_validation, __pyx_v_load_dtd, __pyx_v_no_network, __pyx_v_ns_clean, __pyx_v_recover, __pyx_v_schema, __pyx_v_huge_tree, __pyx_v_remove_blank_text, __pyx_v_resolve_entities, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_target, __pyx_v_compact);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1486
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 */

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

static int __pyx_pf_4lxml_5etree_17ETCompatXMLParser___init__(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_ns_clean, PyObject *__pyx_v_recover, PyObject *__pyx_v_schema, PyObject *__pyx_v_huge_tree, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_target, PyObject *__pyx_v_compact) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1492
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,             # <<<<<<<<<<<<<<
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __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[6]; __pyx_lineno = 1492; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1493
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,             # <<<<<<<<<<<<<<
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_attribute_defaults, __pyx_v_attribute_defaults) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1494
 *         XMLParser.__init__(self,
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,             # <<<<<<<<<<<<<<
 *                            load_dtd=load_dtd,
 *                            no_network=no_network,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtd_validation, __pyx_v_dtd_validation) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1495
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,             # <<<<<<<<<<<<<<
 *                            no_network=no_network,
 *                            ns_clean=ns_clean,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_load_dtd, __pyx_v_load_dtd) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1496
 *                            dtd_validation=dtd_validation,
 *                            load_dtd=load_dtd,
 *                            no_network=no_network,             # <<<<<<<<<<<<<<
 *                            ns_clean=ns_clean,
 *                            recover=recover,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_no_network, __pyx_v_no_network) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1497
 *                            load_dtd=load_dtd,
 *                            no_network=no_network,
 *                            ns_clean=ns_clean,             # <<<<<<<<<<<<<<
 *                            recover=recover,
 *                            remove_blank_text=remove_blank_text,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ns_clean, __pyx_v_ns_clean) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1498
 *                            no_network=no_network,
 *                            ns_clean=ns_clean,
 *                            recover=recover,             # <<<<<<<<<<<<<<
 *                            remove_blank_text=remove_blank_text,
 *                            huge_tree=huge_tree,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_recover, __pyx_v_recover) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1499
 *                            ns_clean=ns_clean,
 *                            recover=recover,
 *                            remove_blank_text=remove_blank_text,             # <<<<<<<<<<<<<<
 *                            huge_tree=huge_tree,
 *                            compact=compact,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_blank_text, __pyx_v_remove_blank_text) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1500
 *                            recover=recover,
 *                            remove_blank_text=remove_blank_text,
 *                            huge_tree=huge_tree,             # <<<<<<<<<<<<<<
 *                            compact=compact,
 *                            resolve_entities=resolve_entities,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_huge_tree, __pyx_v_huge_tree) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1501
 *                            remove_blank_text=remove_blank_text,
 *                            huge_tree=huge_tree,
 *                            compact=compact,             # <<<<<<<<<<<<<<
 *                            resolve_entities=resolve_entities,
 *                            remove_comments=remove_comments,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compact, __pyx_v_compact) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1502
 *                            huge_tree=huge_tree,
 *                            compact=compact,
 *                            resolve_entities=resolve_entities,             # <<<<<<<<<<<<<<
 *                            remove_comments=remove_comments,
 *                            remove_pis=remove_pis,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_resolve_entities, __pyx_v_resolve_entities) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1503
 *                            compact=compact,
 *                            resolve_entities=resolve_entities,
 *                            remove_comments=remove_comments,             # <<<<<<<<<<<<<<
 *                            remove_pis=remove_pis,
 *                            strip_cdata=strip_cdata,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_comments, __pyx_v_remove_comments) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1504
 *                            resolve_entities=resolve_entities,
 *                            remove_comments=remove_comments,
 *                            remove_pis=remove_pis,             # <<<<<<<<<<<<<<
 *                            strip_cdata=strip_cdata,
 *                            target=target,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_pis, __pyx_v_remove_pis) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1505
 *                            remove_comments=remove_comments,
 *                            remove_pis=remove_pis,
 *                            strip_cdata=strip_cdata,             # <<<<<<<<<<<<<<
 *                            target=target,
 *                            encoding=encoding,
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_strip_cdata, __pyx_v_strip_cdata) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1506
 *                            remove_pis=remove_pis,
 *                            strip_cdata=strip_cdata,
 *                            target=target,             # <<<<<<<<<<<<<<
 *                            encoding=encoding,
 *                            schema=schema)
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, __pyx_v_target) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1507
 *                            strip_cdata=strip_cdata,
 *                            target=target,
 *                            encoding=encoding,             # <<<<<<<<<<<<<<
 *                            schema=schema)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1508
 *                            target=target,
 *                            encoding=encoding,
 *                            schema=schema)             # <<<<<<<<<<<<<<
 * 
 * # ET 1.2 compatible name
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema, __pyx_v_schema) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1492
 *                  remove_comments=True, remove_pis=True, strip_cdata=True,
 *                  target=None, compact=True):
 *         XMLParser.__init__(self,             # <<<<<<<<<<<<<<
 *                            attribute_defaults=attribute_defaults,
 *                            dtd_validation=dtd_validation,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1486
 *     and thus ignores comments and processing instructions.
 *     """
 *     def __init__(self, *, encoding=None, attribute_defaults=False,             # <<<<<<<<<<<<<<
 *                  dtd_validation=False, load_dtd=False, no_network=True,
 *                  ns_clean=False, recover=False, schema=None,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ETCompatXMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1519
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""set_default_parser(parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_43set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_42set_default_parser[] = "set_default_parser(parser=None)\n\n    Set a default parser for the current thread.  This parser is used\n    globally whenever no parser is supplied to the various parse functions of\n    the lxml API.  If this function is called without a parser (or if it is\n    None), the default parser is reset to the original configuration.\n\n    Note that the pre-installed default parser is not thread-safe.  Avoid the\n    default parser in multi-threaded environments.  You can create a separate\n    parser for each thread explicitly or use a parser pool.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_43set_default_parser = {__Pyx_NAMESTR("set_default_parser"), (PyCFunction)__pyx_pw_4lxml_5etree_43set_default_parser, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_42set_default_parser)};
static PyObject *__pyx_pw_4lxml_5etree_43set_default_parser(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_default_parser (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parser,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_default_parser") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_default_parser", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.set_default_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_42set_default_parser(__pyx_self, __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_42set_default_parser(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_default_parser", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1531
 *     parser for each thread explicitly or use a parser pool.
 *     """
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1532
 *     """
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1533
 *     if parser is None:
 *         parser = __DEFAULT_XML_PARSER
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)             # <<<<<<<<<<<<<<
 * 
 * def get_default_parser():
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1519
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""set_default_parser(parser=None)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1535
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_45get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_44get_default_parser[] = "get_default_parser()";
static PyMethodDef __pyx_mdef_4lxml_5etree_45get_default_parser = {__Pyx_NAMESTR("get_default_parser"), (PyCFunction)__pyx_pw_4lxml_5etree_45get_default_parser, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_44get_default_parser)};
static PyObject *__pyx_pw_4lxml_5etree_45get_default_parser(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_default_parser (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_44get_default_parser(__pyx_self);

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1537
 * def get_default_parser():
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1535
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.get_default_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1582
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10HTMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10HTMLParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_target = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_compact = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding,&__pyx_n_s_remove_blank_text,&__pyx_n_s_remove_comments,&__pyx_n_s_remove_pis,&__pyx_n_s_strip_cdata,&__pyx_n_s_no_network,&__pyx_n_s_target,&__pyx_n_s_schema,&__pyx_n_s_recover,&__pyx_n_s_compact,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1583
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,             # <<<<<<<<<<<<<<
 *                  no_network=True, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True):
 */
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)Py_False);
    values[4] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1584
 *     def __init__(self, *, encoding=None, remove_blank_text=False,
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,             # <<<<<<<<<<<<<<
 *                  recover=True, compact=True):
 *         cdef int parse_options
 */
    values[5] = ((PyObject *)Py_True);
    values[6] = ((PyObject *)Py_None);
    values[7] = (PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1585
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 *                  recover=True, compact=True):             # <<<<<<<<<<<<<<
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 */
    values[8] = ((PyObject *)Py_True);
    values[9] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 10)) {
        Py_ssize_t index;
        for (index = 0; index < 10 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_encoding = values[0];
    __pyx_v_remove_blank_text = values[1];
    __pyx_v_remove_comments = values[2];
    __pyx_v_remove_pis = values[3];
    __pyx_v_strip_cdata = values[4];
    __pyx_v_no_network = values[5];
    __pyx_v_target = values[6];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[7]);
    __pyx_v_recover = values[8];
    __pyx_v_compact = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_10HTMLParser___init__(((struct __pyx_obj_4lxml_5etree_HTMLParser *)__pyx_v_self), __pyx_v_encoding, __pyx_v_remove_blank_text, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_no_network, __pyx_v_target, __pyx_v_schema, __pyx_v_recover, __pyx_v_compact);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1582
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10HTMLParser___init__(struct __pyx_obj_4lxml_5etree_HTMLParser *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_no_network, PyObject *__pyx_v_target, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema, PyObject *__pyx_v_recover, PyObject *__pyx_v_compact) {
  int __pyx_v_parse_options;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1587
 *                  recover=True, compact=True):
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS             # <<<<<<<<<<<<<<
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 */
  __pyx_v_parse_options = __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1588
 *         cdef int parse_options
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1589
 *         parse_options = _HTML_DEFAULT_PARSE_OPTIONS
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS             # <<<<<<<<<<<<<<
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 */
    __pyx_v_parse_options = (__pyx_v_parse_options | HTML_PARSE_NOBLANKS);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1590
 *         if remove_blank_text:
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recover); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1591
 *             parse_options = parse_options | htmlparser.HTML_PARSE_NOBLANKS
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_RECOVER);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1592
 *         if not recover:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_no_network); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1593
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_RECOVER
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET             # <<<<<<<<<<<<<<
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_NONET);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1594
 *         if not no_network:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:             # <<<<<<<<<<<<<<
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compact); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1595
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
 *         if not compact:
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT             # <<<<<<<<<<<<<<
 * 
 *         _BaseParser.__init__(self, parse_options, 1, schema,
 */
    __pyx_v_parse_options = (__pyx_v_parse_options ^ HTML_PARSE_COMPACT);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1597
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 * 
 *         _BaseParser.__init__(self, parse_options, 1, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, encoding)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseParser)), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_parse_options); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1599
 *         _BaseParser.__init__(self, parse_options, 1, schema,
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, encoding)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = PyTuple_New(9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_schema));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_schema));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_schema));
  __Pyx_INCREF(__pyx_v_remove_comments);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_remove_comments);
  __Pyx_GIVEREF(__pyx_v_remove_comments);
  __Pyx_INCREF(__pyx_v_remove_pis);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_remove_pis);
  __Pyx_GIVEREF(__pyx_v_remove_pis);
  __Pyx_INCREF(__pyx_v_strip_cdata);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_strip_cdata);
  __Pyx_GIVEREF(__pyx_v_strip_cdata);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_encoding);
  PyTuple_SET_ITEM(__pyx_t_5, 8, __pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1597
 *             parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
 * 
 *         _BaseParser.__init__(self, parse_options, 1, schema,             # <<<<<<<<<<<<<<
 *                              remove_comments, remove_pis, strip_cdata,
 *                              target, encoding)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1582
 *     reasons.
 *     """
 *     def __init__(self, *, encoding=None, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  remove_comments=False, remove_pis=False, strip_cdata=True,
 *                  no_network=True, target=None, XMLSchema schema=None,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.HTMLParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1624
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_base_url = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_events,&__pyx_n_s_tag,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_events);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && (kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_events = values[0];
    __pyx_v_tag = values[1];
    __pyx_v_base_url = values[2];
  }
  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[6]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("lxml.etree.HTMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_14HTMLPullParser___init__(((struct __pyx_obj_4lxml_5etree_HTMLPullParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag, __pyx_v_base_url, __pyx_v_kwargs);

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

static int __pyx_pf_4lxml_5etree_14HTMLPullParser___init__(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_base_url, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_events);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1625
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         HTMLParser.__init__(self, **kwargs)             # <<<<<<<<<<<<<<
 *         if events is None:
 *             events = ('end',)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1625; __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[6]; __pyx_lineno = 1625; __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 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1626
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:             # <<<<<<<<<<<<<<
 *             events = ('end',)
 *         self._setBaseURL(base_url)
 */
  __pyx_t_5 = (__pyx_v_events == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1627
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
    __Pyx_INCREF(__pyx_tuple__48);
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_tuple__48);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1628
 *         if events is None:
 *             events = ('end',)
 *         self._setBaseURL(base_url)             # <<<<<<<<<<<<<<
 *         self._collectEvents(events, tag)
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._setBaseURL(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_base_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1629
 *             events = ('end',)
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)             # <<<<<<<<<<<<<<
 * 
 *     def read_events(self):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._collectEvents(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self), __pyx_v_events, __pyx_v_tag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1624
 *     source, you can pass the ``base_url``.
 *     """
 *     def __init__(self, events=None, *, tag=None, base_url=None, **kwargs):             # <<<<<<<<<<<<<<
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.HTMLPullParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1631
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_events (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14HTMLPullParser_2read_events(((struct __pyx_obj_4lxml_5etree_HTMLPullParser *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14HTMLPullParser_2read_events(struct __pyx_obj_4lxml_5etree_HTMLPullParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_events", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1632
 * 
 *     def read_events(self):
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__SaxParserContext)))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator));
  __pyx_r = ((PyObject *)((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1)->events_iterator);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1631
 *         self._collectEvents(events, tag)
 * 
 *     def read_events(self):             # <<<<<<<<<<<<<<
 *         return (<_SaxParserContext?>self._getPushParserContext()).events_iterator
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.HTMLPullParser.read_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1639
 * ############################################################
 * 
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     cdef char* c_text
 */

static xmlDoc *__pyx_f_4lxml_5etree__parseDoc(PyObject *__pyx_v_text, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  char *__pyx_v_c_filename;
  char *__pyx_v_c_text;
  Py_ssize_t __pyx_v_c_len;
  int __pyx_v_is_pep393_string;
  PyObject *__pyx_v_filename_utf = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDoc", 0);
  __Pyx_INCREF(__pyx_v_text);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1644
 *     cdef Py_ssize_t c_len
 *     cdef bint is_pep393_string
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1645
 *     cdef bint is_pep393_string
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     if not filename:
 *         c_filename = NULL
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1646
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:             # <<<<<<<<<<<<<<
 *         c_filename = NULL
 *     else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_filename); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1647
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     if not filename:
 *         c_filename = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 */
    __pyx_v_c_filename = NULL;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1649
 *         c_filename = NULL
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)             # <<<<<<<<<<<<<<
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_filename_utf = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1650
 *     else:
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)             # <<<<<<<<<<<<<<
 *     if isinstance(text, unicode):
 *         is_pep393_string = (
 */
    __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename_utf);
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1651
 *         filename_utf = _encodeFilenameUTF8(filename)
 *         c_filename = _cstr(filename_utf)
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         is_pep393_string = (
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(text))
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_text); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1653
 *     if isinstance(text, unicode):
 *         is_pep393_string = (
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(text))             # <<<<<<<<<<<<<<
 *         if is_pep393_string:
 *             c_len = python.PyUnicode_GET_LENGTH(text)
 */
    if (CYTHON_PEP393_ENABLED) {
      __pyx_t_2 = PyUnicode_IS_READY(__pyx_v_text);
      __pyx_t_1 = __pyx_t_2;
    } else {
      __pyx_t_1 = CYTHON_PEP393_ENABLED;
    }
    __pyx_v_is_pep393_string = __pyx_t_1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1654
 *         is_pep393_string = (
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(text))
 *         if is_pep393_string:             # <<<<<<<<<<<<<<
 *             c_len = python.PyUnicode_GET_LENGTH(text)
 *             c_len *= python.PyUnicode_KIND(text)
 */
    __pyx_t_1 = (__pyx_v_is_pep393_string != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1655
 *             python.PEP393_ENABLED and python.PyUnicode_IS_READY(text))
 *         if is_pep393_string:
 *             c_len = python.PyUnicode_GET_LENGTH(text)             # <<<<<<<<<<<<<<
 *             c_len *= python.PyUnicode_KIND(text)
 *         else:
 */
      __pyx_v_c_len = PyUnicode_GET_LENGTH(__pyx_v_text);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1656
 *         if is_pep393_string:
 *             c_len = python.PyUnicode_GET_LENGTH(text)
 *             c_len *= python.PyUnicode_KIND(text)             # <<<<<<<<<<<<<<
 *         else:
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)
 */
      __pyx_v_c_len = (__pyx_v_c_len * PyUnicode_KIND(__pyx_v_text));
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1658
 *             c_len *= python.PyUnicode_KIND(text)
 *         else:
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)             # <<<<<<<<<<<<<<
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 */
      __pyx_v_c_len = PyUnicode_GET_DATA_SIZE(__pyx_v_text);
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1659
 *         else:
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)
 */
    __pyx_t_1 = ((__pyx_v_c_len > INT_MAX) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1661
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)             # <<<<<<<<<<<<<<
 *         if _UNICODE_ENCODING is NULL and not is_pep393_string:
 *             text = (<unicode>text).encode('utf8')
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_StringIO, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1660
 *             c_len = python.PyUnicode_GET_DATA_SIZE(text)
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *                 StringIO(text), filename, None)
 *         if _UNICODE_ENCODING is NULL and not is_pep393_string:
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_t_4, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1662
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 StringIO(text), filename, None)
 *         if _UNICODE_ENCODING is NULL and not is_pep393_string:             # <<<<<<<<<<<<<<
 *             text = (<unicode>text).encode('utf8')
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 */
    __pyx_t_1 = ((__pyx_v_4lxml_5etree__UNICODE_ENCODING == NULL) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((!(__pyx_v_is_pep393_string != 0)) != 0);
      __pyx_t_6 = __pyx_t_2;
    } else {
      __pyx_t_6 = __pyx_t_1;
    }
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1663
 *                 StringIO(text), filename, None)
 *         if _UNICODE_ENCODING is NULL and not is_pep393_string:
 *             text = (<unicode>text).encode('utf8')             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, "UTF-8")
 */
      if (unlikely(__pyx_v_text == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode");
        {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_text)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1665
 *             text = (<unicode>text).encode('utf8')
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, "UTF-8")             # <<<<<<<<<<<<<<
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 *     else:
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_BytesIO, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1664
 *         if _UNICODE_ENCODING is NULL and not is_pep393_string:
 *             text = (<unicode>text).encode('utf8')
 *             return (<_BaseParser>parser)._parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *                 BytesIO(text), filename, "UTF-8")
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_t_3, __pyx_v_filename, __pyx_kp_s_UTF_8); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1666
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, "UTF-8")
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)             # <<<<<<<<<<<<<<
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseUnicodeDoc(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_text, __pyx_v_c_filename); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_t_5;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1668
 *         return (<_BaseParser>parser)._parseUnicodeDoc(text, c_filename)
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)             # <<<<<<<<<<<<<<
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 */
    __pyx_v_c_len = PyBytes_GET_SIZE(__pyx_v_text);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1669
 *     else:
 *         c_len = python.PyBytes_GET_SIZE(text)
 *         if c_len > limits.INT_MAX:             # <<<<<<<<<<<<<<
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, None)
 */
    __pyx_t_6 = ((__pyx_v_c_len > INT_MAX) != 0);
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1671
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, None)             # <<<<<<<<<<<<<<
 *         c_text = _cstr(text)
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_BytesIO, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1670
 *         c_len = python.PyBytes_GET_SIZE(text)
 *         if c_len > limits.INT_MAX:
 *             return (<_BaseParser>parser)._parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *                 BytesIO(text), filename, None)
 *         c_text = _cstr(text)
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_t_4, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1672
 *             return (<_BaseParser>parser)._parseDocFromFilelike(
 *                 BytesIO(text), filename, None)
 *         c_text = _cstr(text)             # <<<<<<<<<<<<<<
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 * 
 */
    __pyx_v_c_text = PyBytes_AS_STRING(__pyx_v_text);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1673
 *                 BytesIO(text), filename, None)
 *         c_text = _cstr(text)
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDoc(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_c_text, __pyx_v_c_len, __pyx_v_c_filename); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_t_5;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1639
 * ############################################################
 * 
 * cdef xmlDoc* _parseDoc(text, filename, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     cdef char* c_text
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._parseDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename_utf);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1675
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFile(PyObject *__pyx_v_filename8, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFile", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1676
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1677
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1678
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFile(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), PyBytes_AS_STRING(__pyx_v_filename8)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1675
 *         return (<_BaseParser>parser)._parseDoc(c_text, c_len, c_filename)
 * 
 * cdef xmlDoc* _parseDocFromFile(filename8, _BaseParser parser) except NULL:             # <<<<<<<<<<<<<<
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parseDocFromFile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1680
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,             # <<<<<<<<<<<<<<
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 */

static xmlDoc *__pyx_f_4lxml_5etree__parseDocFromFilelike(PyObject *__pyx_v_source, PyObject *__pyx_v_filename, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocFromFilelike", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_parser);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1682
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:             # <<<<<<<<<<<<<<
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parser) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1683
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()             # <<<<<<<<<<<<<<
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
 * 
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_parser, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1684
 *     if parser is None:
 *         parser = __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseParser *)((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser)->__pyx_vtab)->_parseDocFromFilelike(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_source, __pyx_v_filename, Py_None); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1680
 *     return (<_BaseParser>parser)._parseDocFromFile(_cstr(filename8))
 * 
 * cdef xmlDoc* _parseDocFromFilelike(source, filename,             # <<<<<<<<<<<<<<
 *                                    _BaseParser parser) except NULL:
 *     if parser is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parseDocFromFilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1686
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 */

static xmlDoc *__pyx_f_4lxml_5etree__newXMLDoc(void) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newXMLDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1688
 * cdef xmlDoc* _newXMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
 */
  __pyx_v_result = xmlNewDoc(NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1689
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     if result.encoding is NULL:
 */
  __pyx_t_1 = ((__pyx_v_result == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1690
 *     result = tree.xmlNewDoc(NULL)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1691
 *     if result is NULL:
 *         raise MemoryError()
 *     if result.encoding is NULL:             # <<<<<<<<<<<<<<
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  __pyx_t_1 = ((__pyx_v_result->encoding == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1692
 *         raise MemoryError()
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    __pyx_v_result->encoding = xmlStrdup(((unsigned char *)((unsigned char *)__pyx_k_UTF_8)));
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1693
 *     if result.encoding is NULL:
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1694
 *         result.encoding = tree.xmlStrdup(<unsigned char*>"UTF-8")
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1686
 *     return (<_BaseParser>parser)._parseDocFromFilelike(source, filename, None)
 * 
 * cdef xmlDoc* _newXMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.xmlNewDoc(NULL)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._newXMLDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1696
 *     return result
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 */

static xmlDoc *__pyx_f_4lxml_5etree__newHTMLDoc(void) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newHTMLDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1698
 * cdef xmlDoc* _newHTMLDoc() except NULL:
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
 */
  __pyx_v_result = htmlNewDoc(NULL, NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1699
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  __pyx_t_1 = ((__pyx_v_result == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1700
 *     result = tree.htmlNewDoc(NULL, NULL)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1701
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1702
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1696
 *     return result
 * 
 * cdef xmlDoc* _newHTMLDoc() except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     result = tree.htmlNewDoc(NULL, NULL)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._newHTMLDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1704
 *     return result
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     if recursive:
 */

static xmlDoc *__pyx_f_4lxml_5etree__copyDoc(xmlDoc *__pyx_v_c_doc, int __pyx_v_recursive) {
  xmlDoc *__pyx_v_result;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1706
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:
 *     cdef xmlDoc* result
 *     if recursive:             # <<<<<<<<<<<<<<
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 */
  __pyx_t_1 = (__pyx_v_recursive != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1707
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1708
 *     if recursive:
 *         with nogil:
 *             result = tree.xmlCopyDoc(c_doc, recursive)             # <<<<<<<<<<<<<<
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 */
          __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, __pyx_v_recursive);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1707
 *     cdef xmlDoc* result
 *     if recursive:
 *         with nogil:             # <<<<<<<<<<<<<<
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1710
 *             result = tree.xmlCopyDoc(c_doc, recursive)
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)             # <<<<<<<<<<<<<<
 *     if result is NULL:
 *         raise MemoryError()
 */
    __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1711
 *     else:
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 */
  __pyx_t_1 = ((__pyx_v_result == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1712
 *         result = tree.xmlCopyDoc(c_doc, 0)
 *     if result is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1713
 *     if result is NULL:
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1714
 *         raise MemoryError()
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1704
 *     return result
 * 
 * cdef xmlDoc* _copyDoc(xmlDoc* c_doc, int recursive) except NULL:             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* result
 *     if recursive:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1716
 *     return result
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     u"Recursively copy the document and make c_new_root the new root node."
 *     cdef xmlDoc* result
 */

static xmlDoc *__pyx_f_4lxml_5etree__copyDocRoot(xmlDoc *__pyx_v_c_doc, xmlNode *__pyx_v_c_new_root) {
  xmlDoc *__pyx_v_result;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyDocRoot", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1720
 *     cdef xmlDoc* result
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive             # <<<<<<<<<<<<<<
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:
 */
  __pyx_v_result = xmlCopyDoc(__pyx_v_c_doc, 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1721
 *     cdef xmlNode* c_node
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)             # <<<<<<<<<<<<<<
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, __pyx_v_result);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1722
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1723
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise MemoryError()
 */
        __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_new_root, __pyx_v_result, 1);
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1722
 *     result = tree.xmlCopyDoc(c_doc, 0) # non recursive
 *     __GLOBAL_PARSER_CONTEXT.initDocDict(result)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1724
 *     with nogil:
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(result, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1725
 *         c_node = tree.xmlDocCopyNode(c_new_root, result, 1) # recursive
 *     if c_node is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1726
 *     if c_node is NULL:
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(result, c_node)             # <<<<<<<<<<<<<<
 *     _copyTail(c_new_root.next, c_node)
 *     return result
 */
  xmlDocSetRootElement(__pyx_v_result, __pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1727
 *         raise MemoryError()
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_new_root->next, __pyx_v_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1728
 *     tree.xmlDocSetRootElement(result, c_node)
 *     _copyTail(c_new_root.next, c_node)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1716
 *     return result
 * 
 * cdef xmlDoc* _copyDocRoot(xmlDoc* c_doc, xmlNode* c_new_root) except NULL:             # <<<<<<<<<<<<<<
 *     u"Recursively copy the document and make c_new_root the new root node."
 *     cdef xmlDoc* result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyDocRoot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1730
 *     return result
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     u"Recursively copy the element into the document. c_doc is not modified."
 *     cdef xmlNode* c_root
 */

static xmlNode *__pyx_f_4lxml_5etree__copyNodeToDoc(xmlNode *__pyx_v_c_node, xmlDoc *__pyx_v_c_doc) {
  xmlNode *__pyx_v_c_root;
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyNodeToDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1733
 *     u"Recursively copy the element into the document. c_doc is not modified."
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive             # <<<<<<<<<<<<<<
 *     if c_root is NULL:
 *         raise MemoryError()
 */
  __pyx_v_c_root = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_c_doc, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1734
 *     cdef xmlNode* c_root
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)
 */
  __pyx_t_1 = ((__pyx_v_c_root == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1735
 *     c_root = tree.xmlDocCopyNode(c_node, c_doc, 1) # recursive
 *     if c_root is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     _copyTail(c_node.next, c_root)
 *     return c_root
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1736
 *     if c_root is NULL:
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)             # <<<<<<<<<<<<<<
 *     return c_root
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyTail(__pyx_v_c_node->next, __pyx_v_c_root); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1737
 *         raise MemoryError()
 *     _copyTail(c_node.next, c_root)
 *     return c_root             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_c_root;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1730
 *     return result
 * 
 * cdef xmlNode* _copyNodeToDoc(xmlNode* c_node, xmlDoc* c_doc) except NULL:             # <<<<<<<<<<<<<<
 *     u"Recursively copy the element into the document. c_doc is not modified."
 *     cdef xmlNode* c_root
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyNodeToDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1744
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     if _isString(source):
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocument(PyObject *__pyx_v_source, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_url = NULL;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  const char *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocument", 0);
  __Pyx_INCREF(__pyx_v_base_url);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1746
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):
 *     cdef _Document doc
 *     if _isString(source):             # <<<<<<<<<<<<<<
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 */
  __pyx_t_1 = (_isString(__pyx_v_source) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1748
 *     if _isString(source):
 *         # parse the file directly from the filesystem
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)             # <<<<<<<<<<<<<<
 *         # fix base URL if requested
 *         if base_url is not None:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_source); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_t_2, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1750
 *         doc = _parseDocumentFromURL(_encodeFilename(source), parser)
 *         # fix base URL if requested
 *         if base_url is not None:             # <<<<<<<<<<<<<<
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
 */
    __pyx_t_1 = (__pyx_v_base_url != Py_None);
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1751
 *         # fix base URL if requested
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)             # <<<<<<<<<<<<<<
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilenameUTF8(__pyx_v_base_url); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_base_url, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1752
 *         if base_url is not None:
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
 */
      __pyx_t_4 = ((__pyx_v_doc->_c_doc->URL != NULL) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1753
 *             base_url = _encodeFilenameUTF8(base_url)
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(<char*>doc._c_doc.URL)             # <<<<<<<<<<<<<<
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
 *         return doc
 */
        xmlFree(((char *)__pyx_v_doc->_c_doc->URL));
        goto __pyx_L5;
      }
      __pyx_L5:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1754
 *             if doc._c_doc.URL is not NULL:
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))             # <<<<<<<<<<<<<<
 *         return doc
 * 
 */
      __pyx_v_doc->_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_base_url));
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1755
 *                 tree.xmlFree(<char*>doc._c_doc.URL)
 *             doc._c_doc.URL = tree.xmlStrdup(_xcstr(base_url))
 *         return doc             # <<<<<<<<<<<<<<
 * 
 *     if base_url is not None:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    __pyx_r = __pyx_v_doc;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1757
 *         return doc
 * 
 *     if base_url is not None:             # <<<<<<<<<<<<<<
 *         url = base_url
 *     else:
 */
  __pyx_t_4 = (__pyx_v_base_url != Py_None);
  __pyx_t_1 = (__pyx_t_4 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1758
 * 
 *     if base_url is not None:
 *         url = base_url             # <<<<<<<<<<<<<<
 *     else:
 *         url = _getFilenameForFile(source)
 */
    __Pyx_INCREF(__pyx_v_base_url);
    __pyx_v_url = __pyx_v_base_url;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1760
 *         url = base_url
 *     else:
 *         url = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 * 
 *     if hasattr(source, u'getvalue') and hasattr(source, u'tell'):
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_url = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1762
 *         url = _getFilenameForFile(source)
 * 
 *     if hasattr(source, u'getvalue') and hasattr(source, u'tell'):             # <<<<<<<<<<<<<<
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_source, __pyx_n_u_getvalue); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if ((__pyx_t_1 != 0)) {
    __pyx_t_4 = PyObject_HasAttr(__pyx_v_source, __pyx_n_u_tell); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = (__pyx_t_4 != 0);
  } else {
    __pyx_t_5 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1764
 *     if hasattr(source, u'getvalue') and hasattr(source, u'tell'):
 *         # StringIO - reading from start?
 *         if source.tell() == 0:             # <<<<<<<<<<<<<<
 *             return _parseMemoryDocument(source.getvalue(), url, parser)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_tell); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1764; __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_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1765
 *         # StringIO - reading from start?
 *         if source.tell() == 0:
 *             return _parseMemoryDocument(source.getvalue(), url, parser)             # <<<<<<<<<<<<<<
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1765; __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 *)__pyx_f_4lxml_5etree__parseMemoryDocument(__pyx_t_2, __pyx_v_url, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((struct LxmlDocument *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1768
 * 
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, u'read'):             # <<<<<<<<<<<<<<
 *         return _parseFilelikeDocument(source, url, parser)
 * 
 */
  __pyx_t_5 = PyObject_HasAttr(__pyx_v_source, __pyx_n_u_read); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_5 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1769
 *     # Support for file-like objects (urlgrabber.urlopen, ...)
 *     if hasattr(source, u'read'):
 *         return _parseFilelikeDocument(source, url, parser)             # <<<<<<<<<<<<<<
 * 
 *     raise TypeError, u"cannot parse from '%s'" % python._fqtypename(source).decode('UTF-8')
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseFilelikeDocument(__pyx_v_source, __pyx_v_url, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1771
 *         return _parseFilelikeDocument(source, url, parser)
 * 
 *     raise TypeError, u"cannot parse from '%s'" % python._fqtypename(source).decode('UTF-8')             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 */
  __pyx_t_6 = _fqtypename(__pyx_v_source);
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_6, 0, strlen(__pyx_t_6), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_cannot_parse_from_s, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1744
 * ############################################################
 * 
 * cdef _Document _parseDocument(source, _BaseParser parser, base_url):             # <<<<<<<<<<<<<<
 *     cdef _Document doc
 *     if _isString(source):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parseDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_XDECREF(__pyx_v_base_url);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1773
 *     raise TypeError, u"cannot parse from '%s'" % python._fqtypename(source).decode('UTF-8')
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseDocumentFromURL(PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDocumentFromURL", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1774
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 *     c_doc = _parseDocFromFile(url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1775
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1773
 *     raise TypeError, u"cannot parse from '%s'" % python._fqtypename(source).decode('UTF-8')
 * 
 * cdef _Document _parseDocumentFromURL(url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFile(url, parser)
 *     return _documentFactory(c_doc, parser)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseDocumentFromURL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1777
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseMemoryDocument(PyObject *__pyx_v_text, PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  xmlDoc *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseMemoryDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1778
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):             # <<<<<<<<<<<<<<
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_text); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1779
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 u"Unicode strings with encoding declaration are not supported. "
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__hasEncodingDeclaration(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1780
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 u"Unicode strings with encoding declaration are not supported. "
 *                 u"Please use bytes input or XML fragments without declaration.")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1783
 *                 u"Unicode strings with encoding declaration are not supported. "
 *                 u"Please use bytes input or XML fragments without declaration.")
 *     elif not isinstance(text, bytes):             # <<<<<<<<<<<<<<
 *         raise ValueError, u"can only parse strings"
 *     c_doc = _parseDoc(text, url, parser)
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_text); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1784
 *                 u"Please use bytes input or XML fragments without declaration.")
 *     elif not isinstance(text, bytes):
 *         raise ValueError, u"can only parse strings"             # <<<<<<<<<<<<<<
 *     c_doc = _parseDoc(text, url, parser)
 *     return _documentFactory(c_doc, parser)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_can_only_parse_strings, 0, 0);
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1785
 *     elif not isinstance(text, bytes):
 *         raise ValueError, u"can only parse strings"
 *     c_doc = _parseDoc(text, url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__parseDoc(__pyx_v_text, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1786
 *         raise ValueError, u"can only parse strings"
 *     c_doc = _parseDoc(text, url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1777
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseMemoryDocument(text, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._parseMemoryDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1788
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree__parseFilelikeDocument(PyObject *__pyx_v_source, PyObject *__pyx_v_url, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseFilelikeDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1789
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 *     c_doc = _parseDocFromFilelike(source, url, parser)             # <<<<<<<<<<<<<<
 *     return _documentFactory(c_doc, parser)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_v_source, __pyx_v_url, __pyx_v_parser); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1790
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, __pyx_v_parser)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1788
 *     return _documentFactory(c_doc, parser)
 * 
 * cdef _Document _parseFilelikeDocument(source, url, _BaseParser parser):             # <<<<<<<<<<<<<<
 *     c_doc = _parseDocFromFilelike(source, url, parser)
 *     return _documentFactory(c_doc, parser)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._parseFilelikeDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":20
 * 
 * 
 * cdef int _buildParseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter
 *     event_filter = 0
 */

static int __pyx_f_4lxml_5etree__buildParseEventFilter(PyObject *__pyx_v_events) {
  int __pyx_v_event_filter;
  PyObject *__pyx_v_event = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildParseEventFilter", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":22
 * cdef int _buildParseEventFilter(events) except -1:
 *     cdef int event_filter
 *     event_filter = 0             # <<<<<<<<<<<<<<
 *     for event in events:
 *         if event == 'start':
 */
  __pyx_v_event_filter = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":23
 *     cdef int event_filter
 *     event_filter = 0
 *     for event in events:             # <<<<<<<<<<<<<<
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 */
  if (PyList_CheckExact(__pyx_v_events) || PyTuple_CheckExact(__pyx_v_events)) {
    __pyx_t_1 = __pyx_v_events; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_events); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":24
 *     event_filter = 0
 *     for event in events:
 *         if event == 'start':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_start, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":25
 *     for event in events:
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START             # <<<<<<<<<<<<<<
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START);
      goto __pyx_L5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":26
 *         if event == 'start':
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":27
 *             event_filter |= PARSE_EVENT_FILTER_START
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END             # <<<<<<<<<<<<<<
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END);
      goto __pyx_L5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":28
 *         elif event == 'end':
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_kp_s_start_ns, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":29
 *             event_filter |= PARSE_EVENT_FILTER_END
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS             # <<<<<<<<<<<<<<
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS);
      goto __pyx_L5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":30
 *         elif event == 'start-ns':
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_kp_s_end_ns, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":31
 *             event_filter |= PARSE_EVENT_FILTER_START_NS
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS             # <<<<<<<<<<<<<<
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS);
      goto __pyx_L5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":32
 *         elif event == 'end-ns':
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_comment, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":33
 *             event_filter |= PARSE_EVENT_FILTER_END_NS
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT             # <<<<<<<<<<<<<<
 *         elif event == 'pi':
 *             event_filter |= PARSE_EVENT_FILTER_PI
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT);
      goto __pyx_L5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":34
 *         elif event == 'comment':
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':             # <<<<<<<<<<<<<<
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_pi, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":35
 *             event_filter |= PARSE_EVENT_FILTER_COMMENT
 *         elif event == 'pi':
 *             event_filter |= PARSE_EVENT_FILTER_PI             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, u"invalid event name '%s'" % event
 */
      __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":37
 *             event_filter |= PARSE_EVENT_FILTER_PI
 *         else:
 *             raise ValueError, u"invalid event name '%s'" % event             # <<<<<<<<<<<<<<
 *     return event_filter
 * 
 */
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_invalid_event_name_s, __pyx_v_event); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":38
 *         else:
 *             raise ValueError, u"invalid event name '%s'" % event
 *     return event_filter             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_event_filter;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":20
 * 
 * 
 * cdef int _buildParseEventFilter(events) except -1:             # <<<<<<<<<<<<<<
 *     cdef int event_filter
 *     event_filter = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._buildParseEventFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":43
 * cdef class _SaxParserTarget:
 *     cdef int _sax_event_filter
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = 0
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_16_SaxParserTarget___cinit__(struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":44
 *     cdef int _sax_event_filter
 *     def __cinit__(self):
 *         self._sax_event_filter = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 */
  __pyx_v_self->_sax_event_filter = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":43
 * cdef class _SaxParserTarget:
 *     cdef int _sax_event_filter
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = 0
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":46
 *         self._sax_event_filter = 0
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 */

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":47
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":46
 *         self._sax_event_filter = 0
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":48
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
 */

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":49
 *         return None
 *     cdef _handleSaxEnd(self, tag):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":48
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         return None
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":50
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 */

static int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":51
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":50
 *     cdef _handleSaxEnd(self, tag):
 *         return None
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":52
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 */

static int __pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_root_tag, CYTHON_UNUSED PyObject *__pyx_v_public_id, CYTHON_UNUSED PyObject *__pyx_v_system_id) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxDoctype", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":53
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":52
 *     cdef int _handleSaxData(self, data) except -1:
 *         return 0
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":54
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxComment(self, comment):
 */

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_target, CYTHON_UNUSED PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxPi", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":55
 *         return 0
 *     cdef _handleSaxPi(self, target, data):
 *         return None             # <<<<<<<<<<<<<<
 *     cdef _handleSaxComment(self, comment):
 *         return None
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":54
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         return 0
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return None
 *     cdef _handleSaxComment(self, comment):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":56
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":57
 *         return None
 *     cdef _handleSaxComment(self, comment):
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":56
 *     cdef _handleSaxPi(self, target, data):
 *         return None
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":88
 *     cdef _MultiTagMatcher _matcher
 * 
 *     def __cinit__(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         self._ns_stack = []
 *         self._node_stack = []
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17_SaxParserContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17_SaxParserContext_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parser,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_4lxml_5etree__BaseParser, 1, "parser", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_17_SaxParserContext___cinit__(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_self), __pyx_v_parser);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_17_SaxParserContext___cinit__(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":89
 * 
 *     def __cinit__(self, _BaseParser parser):
 *         self._ns_stack = []             # <<<<<<<<<<<<<<
 *         self._node_stack = []
 *         self._parser = parser
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_ns_stack);
  __Pyx_DECREF(__pyx_v_self->_ns_stack);
  __pyx_v_self->_ns_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":90
 *     def __cinit__(self, _BaseParser parser):
 *         self._ns_stack = []
 *         self._node_stack = []             # <<<<<<<<<<<<<<
 *         self._parser = parser
 *         self.events_iterator = _ParseEventsIterator()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_node_stack);
  __Pyx_DECREF(__pyx_v_self->_node_stack);
  __pyx_v_self->_node_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":91
 *         self._ns_stack = []
 *         self._node_stack = []
 *         self._parser = parser             # <<<<<<<<<<<<<<
 *         self.events_iterator = _ParseEventsIterator()
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_self->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser));
  __pyx_v_self->_parser = __pyx_v_parser;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":92
 *         self._node_stack = []
 *         self._parser = parser
 *         self.events_iterator = _ParseEventsIterator()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParseEventsIterator)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->events_iterator);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->events_iterator));
  __pyx_v_self->events_iterator = ((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":88
 *     cdef _MultiTagMatcher _matcher
 * 
 *     def __cinit__(self, _BaseParser parser):             # <<<<<<<<<<<<<<
 *         self._ns_stack = []
 *         self._node_stack = []
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":94
 *         self.events_iterator = _ParseEventsIterator()
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target):             # <<<<<<<<<<<<<<
 *         self._target = target
 * 
 */

static void __pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__SaxParserTarget *__pyx_v_target) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_setSaxParserTarget", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":95
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target):
 *         self._target = target             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_target));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_target));
  __Pyx_GOTREF(__pyx_v_self->_target);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
  __pyx_v_self->_target = __pyx_v_target;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":94
 *         self.events_iterator = _ParseEventsIterator()
 * 
 *     cdef void _setSaxParserTarget(self, _SaxParserTarget target):             # <<<<<<<<<<<<<<
 *         self._target = target
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":97
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
 */

static void __pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_initParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":98
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         _ParserContext._initParserContext(self, c_ctxt)             # <<<<<<<<<<<<<<
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 */
  __pyx_vtabptr_4lxml_5etree__ParserContext->_initParserContext(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self), __pyx_v_c_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":99
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:             # <<<<<<<<<<<<<<
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_target) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":100
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)             # <<<<<<<<<<<<<<
 *         elif self._event_filter:
 *             self._connectEvents(c_ctxt)
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_connectTarget(__pyx_v_self, __pyx_v_c_ctxt);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":101
 *         if self._target is not None:
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:             # <<<<<<<<<<<<<<
 *             self._connectEvents(c_ctxt)
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_event_filter != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":102
 *             self._connectTarget(c_ctxt)
 *         elif self._event_filter:
 *             self._connectEvents(c_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
    ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_connectEvents(__pyx_v_self, __pyx_v_c_ctxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":97
 *         self._target = target
 * 
 *     cdef void _initParserContext(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         _ParserContext._initParserContext(self, c_ctxt)
 *         if self._target is not None:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":104
 *             self._connectEvents(c_ctxt)
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         """wrap original SAX2 callbacks to call into parser target"""
 *         sax = c_ctxt.sax
 */

static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectTarget(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  __Pyx_RefNannyDeclarations
  xmlSAXHandler *__pyx_t_1;
  int __pyx_t_2;
  internalSubsetSAXFunc __pyx_t_3;
  __Pyx_RefNannySetupContext("_connectTarget", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":106
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         """wrap original SAX2 callbacks to call into parser target"""
 *         sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
 */
  __pyx_t_1 = __pyx_v_c_ctxt->sax;
  __pyx_v_sax = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":107
 *         """wrap original SAX2 callbacks to call into parser target"""
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs = NULL             # <<<<<<<<<<<<<<
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_START:
 */
  __pyx_v_self->_origSaxStart = NULL;
  __pyx_v_sax->startElementNs = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":108
 *         sax = c_ctxt.sax
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_START:
 *             # intercept => overwrite orig callback
 */
  __pyx_v_self->_origSaxStartNoNs = NULL;
  __pyx_v_sax->startElement = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":109
 *         self._origSaxStart = sax.startElementNs = NULL
 *         self._origSaxStartNoNs = sax.startElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_START:             # <<<<<<<<<<<<<<
 *             # intercept => overwrite orig callback
 *             # FIXME: also intercept on when collecting END events
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_START) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":112
 *             # intercept => overwrite orig callback
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.startElementNs = _handleSaxTargetStart
 *             sax.startElement = _handleSaxTargetStartNoNs
 */
    __pyx_t_2 = ((__pyx_v_sax->initialized == XML_SAX2_MAGIC) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":113
 *             # FIXME: also intercept on when collecting END events
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart             # <<<<<<<<<<<<<<
 *             sax.startElement = _handleSaxTargetStartNoNs
 * 
 */
      __pyx_v_sax->startElementNs = __pyx_f_4lxml_5etree__handleSaxTargetStart;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":114
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.startElementNs = _handleSaxTargetStart
 *             sax.startElement = _handleSaxTargetStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL
 */
    __pyx_v_sax->startElement = __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":116
 *             sax.startElement = _handleSaxTargetStartNoNs
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL             # <<<<<<<<<<<<<<
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 */
  __pyx_v_self->_origSaxEnd = NULL;
  __pyx_v_sax->endElementNs = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":117
 * 
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 */
  __pyx_v_self->_origSaxEndNoNs = NULL;
  __pyx_v_sax->endElement = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":118
 *         self._origSaxEnd = sax.endElementNs = NULL
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_END:             # <<<<<<<<<<<<<<
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_END) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":119
 *         self._origSaxEndNoNs = sax.endElement = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:             # <<<<<<<<<<<<<<
 *                 sax.endElementNs = _handleSaxEnd
 *             sax.endElement = _handleSaxEndNoNs
 */
    __pyx_t_2 = ((__pyx_v_sax->initialized == XML_SAX2_MAGIC) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":120
 *         if self._target._sax_event_filter & SAX_EVENT_END:
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd             # <<<<<<<<<<<<<<
 *             sax.endElement = _handleSaxEndNoNs
 * 
 */
      __pyx_v_sax->endElementNs = __pyx_f_4lxml_5etree__handleSaxEnd;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":121
 *             if sax.initialized == xmlparser.XML_SAX2_MAGIC:
 *                 sax.endElementNs = _handleSaxEnd
 *             sax.endElement = _handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 */
    __pyx_v_sax->endElement = __pyx_f_4lxml_5etree__handleSaxEndNoNs;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":123
 *             sax.endElement = _handleSaxEndNoNs
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = sax.cdataBlock = _handleSaxData
 */
  __pyx_v_self->_origSaxData = NULL;
  __pyx_v_sax->characters = NULL;
  __pyx_v_sax->cdataBlock = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":124
 * 
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:             # <<<<<<<<<<<<<<
 *             sax.characters = sax.cdataBlock = _handleSaxData
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_DATA) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":125
 *         self._origSaxData = sax.characters = sax.cdataBlock = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_DATA:
 *             sax.characters = sax.cdataBlock = _handleSaxData             # <<<<<<<<<<<<<<
 * 
 *         # doctype propagation is always required for entity replacement
 */
    __pyx_v_sax->characters = __pyx_f_4lxml_5etree__handleSaxData;
    __pyx_v_sax->cdataBlock = __pyx_f_4lxml_5etree__handleSaxData;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":128
 * 
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:
 *             sax.internalSubset = _handleSaxTargetDoctype
 */
  __pyx_t_3 = __pyx_v_sax->internalSubset;
  __pyx_v_self->_origSaxDoctype = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":129
 *         # doctype propagation is always required for entity replacement
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:             # <<<<<<<<<<<<<<
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":130
 *         self._origSaxDoctype = sax.internalSubset
 *         if self._target._sax_event_filter & SAX_EVENT_DOCTYPE:
 *             sax.internalSubset = _handleSaxTargetDoctype             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
 */
    __pyx_v_sax->internalSubset = __pyx_f_4lxml_5etree__handleSaxTargetDoctype;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":132
 *             sax.internalSubset = _handleSaxTargetDoctype
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxPI
 */
  __pyx_v_self->_origSaxPI = NULL;
  __pyx_v_sax->processingInstruction = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":133
 * 
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = _handleSaxPI
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_PI) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":134
 *         self._origSaxPI = sax.processingInstruction = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_PI:
 *             sax.processingInstruction = _handleSaxPI             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment = NULL
 */
    __pyx_v_sax->processingInstruction = __pyx_f_4lxml_5etree__handleSaxPI;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":136
 *             sax.processingInstruction = _handleSaxPI
 * 
 *         self._origSaxComment = sax.comment = NULL             # <<<<<<<<<<<<<<
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:
 *             sax.comment = _handleSaxTargetComment
 */
  __pyx_v_self->_origSaxComment = NULL;
  __pyx_v_sax->comment = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":137
 * 
 *         self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = _handleSaxTargetComment
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->_target->_sax_event_filter & __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":138
 *         self._origSaxComment = sax.comment = NULL
 *         if self._target._sax_event_filter & SAX_EVENT_COMMENT:
 *             sax.comment = _handleSaxTargetComment             # <<<<<<<<<<<<<<
 * 
 *         # enforce entity replacement
 */
    __pyx_v_sax->comment = __pyx_f_4lxml_5etree__handleSaxTargetComment;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":141
 * 
 *         # enforce entity replacement
 *         sax.reference = NULL             # <<<<<<<<<<<<<<
 *         c_ctxt.replaceEntities = 1
 * 
 */
  __pyx_v_sax->reference = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":142
 *         # enforce entity replacement
 *         sax.reference = NULL
 *         c_ctxt.replaceEntities = 1             # <<<<<<<<<<<<<<
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
  __pyx_v_c_ctxt->replaceEntities = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":104
 *             self._connectEvents(c_ctxt)
 * 
 *     cdef void _connectTarget(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         """wrap original SAX2 callbacks to call into parser target"""
 *         sax = c_ctxt.sax
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":144
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         """wrap original SAX2 callbacks to collect parse events"""
 *         sax = c_ctxt.sax
 */

static void __pyx_f_4lxml_5etree_17_SaxParserContext__connectEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlSAXHandler *__pyx_v_sax;
  __Pyx_RefNannyDeclarations
  xmlSAXHandler *__pyx_t_1;
  startDocumentSAXFunc __pyx_t_2;
  startElementNsSAX2Func __pyx_t_3;
  startElementSAXFunc __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  endElementNsSAX2Func __pyx_t_7;
  endElementSAXFunc __pyx_t_8;
  commentSAXFunc __pyx_t_9;
  processingInstructionSAXFunc __pyx_t_10;
  __Pyx_RefNannySetupContext("_connectEvents", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":146
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         """wrap original SAX2 callbacks to collect parse events"""
 *         sax = c_ctxt.sax             # <<<<<<<<<<<<<<
 *         self._origSaxStartDocument = sax.startDocument
 *         sax.startDocument = _handleSaxStartDocument
 */
  __pyx_t_1 = __pyx_v_c_ctxt->sax;
  __pyx_v_sax = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":147
 *         """wrap original SAX2 callbacks to collect parse events"""
 *         sax = c_ctxt.sax
 *         self._origSaxStartDocument = sax.startDocument             # <<<<<<<<<<<<<<
 *         sax.startDocument = _handleSaxStartDocument
 *         self._origSaxStart = sax.startElementNs
 */
  __pyx_t_2 = __pyx_v_sax->startDocument;
  __pyx_v_self->_origSaxStartDocument = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":148
 *         sax = c_ctxt.sax
 *         self._origSaxStartDocument = sax.startDocument
 *         sax.startDocument = _handleSaxStartDocument             # <<<<<<<<<<<<<<
 *         self._origSaxStart = sax.startElementNs
 *         self._origSaxStartNoNs = sax.startElement
 */
  __pyx_v_sax->startDocument = __pyx_f_4lxml_5etree__handleSaxStartDocument;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":149
 *         self._origSaxStartDocument = sax.startDocument
 *         sax.startDocument = _handleSaxStartDocument
 *         self._origSaxStart = sax.startElementNs             # <<<<<<<<<<<<<<
 *         self._origSaxStartNoNs = sax.startElement
 *         # only override start event handler if needed
 */
  __pyx_t_3 = __pyx_v_sax->startElementNs;
  __pyx_v_self->_origSaxStart = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":150
 *         sax.startDocument = _handleSaxStartDocument
 *         self._origSaxStart = sax.startElementNs
 *         self._origSaxStartNoNs = sax.startElement             # <<<<<<<<<<<<<<
 *         # only override start event handler if needed
 *         if self._event_filter == 0 or \
 */
  __pyx_t_4 = __pyx_v_sax->startElement;
  __pyx_v_self->_origSaxStartNoNs = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":152
 *         self._origSaxStartNoNs = sax.startElement
 *         # only override start event handler if needed
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                      PARSE_EVENT_FILTER_END |
 */
  __pyx_t_5 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":153
 *         # only override start event handler if needed
 *         if self._event_filter == 0 or \
 *                self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_START_NS |
 */
    __pyx_t_6 = ((__pyx_v_self->_event_filter & (((__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS)) != 0);
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":157
 *                                      PARSE_EVENT_FILTER_START_NS |
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.startElementNs = <xmlparser.startElementNsSAX2Func>_handleSaxStart             # <<<<<<<<<<<<<<
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs
 * 
 */
    __pyx_v_sax->startElementNs = ((startElementNsSAX2Func)__pyx_f_4lxml_5etree__handleSaxStart);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":158
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.startElementNs = <xmlparser.startElementNsSAX2Func>_handleSaxStart
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxEnd = sax.endElementNs
 */
    __pyx_v_sax->startElement = ((startElementSAXFunc)__pyx_f_4lxml_5etree__handleSaxStartNoNs);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":160
 *             sax.startElement = <xmlparser.startElementSAXFunc>_handleSaxStartNoNs
 * 
 *         self._origSaxEnd = sax.endElementNs             # <<<<<<<<<<<<<<
 *         self._origSaxEndNoNs = sax.endElement
 *         # only override end event handler if needed
 */
  __pyx_t_7 = __pyx_v_sax->endElementNs;
  __pyx_v_self->_origSaxEnd = __pyx_t_7;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":161
 * 
 *         self._origSaxEnd = sax.endElementNs
 *         self._origSaxEndNoNs = sax.endElement             # <<<<<<<<<<<<<<
 *         # only override end event handler if needed
 *         if self._event_filter == 0 or \
 */
  __pyx_t_8 = __pyx_v_sax->endElement;
  __pyx_v_self->_origSaxEndNoNs = __pyx_t_8;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":163
 *         self._origSaxEndNoNs = sax.endElement
 *         # only override end event handler if needed
 *         if self._event_filter == 0 or \             # <<<<<<<<<<<<<<
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 */
  __pyx_t_6 = (__pyx_v_self->_event_filter == 0);
  if (!__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":164
 *         # only override end event handler if needed
 *         if self._event_filter == 0 or \
 *                self._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd
 */
    __pyx_t_5 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS)) != 0);
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":166
 *                self._event_filter & (PARSE_EVENT_FILTER_END |
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd             # <<<<<<<<<<<<<<
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 * 
 */
    __pyx_v_sax->endElementNs = ((endElementNsSAX2Func)__pyx_f_4lxml_5etree__handleSaxEnd);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":167
 *                                      PARSE_EVENT_FILTER_END_NS):
 *             sax.endElementNs = <xmlparser.endElementNsSAX2Func>_handleSaxEnd
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxComment = sax.comment
 */
    __pyx_v_sax->endElement = ((endElementSAXFunc)__pyx_f_4lxml_5etree__handleSaxEndNoNs);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":169
 *             sax.endElement = <xmlparser.endElementSAXFunc>_handleSaxEndNoNs
 * 
 *         self._origSaxComment = sax.comment             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 */
  __pyx_t_9 = __pyx_v_sax->comment;
  __pyx_v_self->_origSaxComment = __pyx_t_9;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":170
 * 
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":171
 *         self._origSaxComment = sax.comment
 *         if self._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment             # <<<<<<<<<<<<<<
 * 
 *         self._origSaxPI = sax.processingInstruction
 */
    __pyx_v_sax->comment = ((commentSAXFunc)__pyx_f_4lxml_5etree__handleSaxComment);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":173
 *             sax.comment = <xmlparser.commentSAXFunc>_handleSaxComment
 * 
 *         self._origSaxPI = sax.processingInstruction             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 */
  __pyx_t_10 = __pyx_v_sax->processingInstruction;
  __pyx_v_self->_origSaxPI = __pyx_t_10;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":174
 * 
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":175
 *         self._origSaxPI = sax.processingInstruction
 *         if self._event_filter & PARSE_EVENT_FILTER_PI:
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent             # <<<<<<<<<<<<<<
 * 
 *     cdef _setEventFilter(self, events, tag):
 */
    __pyx_v_sax->processingInstruction = ((processingInstructionSAXFunc)__pyx_f_4lxml_5etree__handleSaxPIEvent);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":144
 *         c_ctxt.replaceEntities = 1
 * 
 *     cdef void _connectEvents(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         """wrap original SAX2 callbacks to collect parse events"""
 *         sax = c_ctxt.sax
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":177
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 *     cdef _setEventFilter(self, events, tag):             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
 */

static PyObject *__pyx_f_4lxml_5etree_17_SaxParserContext__setEventFilter(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, PyObject *__pyx_v_events, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setEventFilter", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":178
 * 
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildParseEventFilter(events)             # <<<<<<<<<<<<<<
 *         if not self._event_filter or tag is None or tag == '*':
 *             self._matcher = None
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_events); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_event_filter = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":179
 *     cdef _setEventFilter(self, events, tag):
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
 */
  __pyx_t_2 = (!(__pyx_v_self->_event_filter != 0));
  if (!__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_tag == Py_None);
    if (!__pyx_t_3) {
      __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_tag, __pyx_kp_s__34, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":180
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
 *             self._matcher = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._matcher = _MultiTagMatcher(tag)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_matcher);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_matcher));
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":182
 *             self._matcher = None
 *         else:
 *             self._matcher = _MultiTagMatcher(tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_v_self->_matcher);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_matcher));
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":177
 *             sax.processingInstruction = <xmlparser.processingInstructionSAXFunc>_handleSaxPIEvent
 * 
 *     cdef _setEventFilter(self, events, tag):             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildParseEventFilter(events)
 *         if not self._event_filter or tag is None or tag == '*':
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext._setEventFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":184
 *             self._matcher = _MultiTagMatcher(tag)
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:             # <<<<<<<<<<<<<<
 *         try:
 *             self._doc = _documentFactory(c_doc, self._parser)
 */

static int __pyx_f_4lxml_5etree_17_SaxParserContext_startDocument(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("startDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":185
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 *         try:             # <<<<<<<<<<<<<<
 *             self._doc = _documentFactory(c_doc, self._parser)
 *         finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":186
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:
 *         try:
 *             self._doc = _documentFactory(c_doc, self._parser)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._parser = None  # clear circular reference ASAP
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_self->_parser);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base._doc);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._doc));
    __pyx_v_self->__pyx_base._doc = ((struct LxmlDocument *)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":188
 *             self._doc = _documentFactory(c_doc, self._parser)
 *         finally:
 *             self._parser = None  # clear circular reference ASAP             # <<<<<<<<<<<<<<
 *         if self._matcher is not None:
 *             self._matcher.cacheTags(self._doc, True) # force entry in libxml2 dict
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_parser);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser));
      __pyx_v_self->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_parser);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser));
        __pyx_v_self->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":189
 *         finally:
 *             self._parser = None  # clear circular reference ASAP
 *         if self._matcher is not None:             # <<<<<<<<<<<<<<
 *             self._matcher.cacheTags(self._doc, True) # force entry in libxml2 dict
 *         return 0
 */
  __pyx_t_12 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
  __pyx_t_13 = (__pyx_t_12 != 0);
  if (__pyx_t_13) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":190
 *             self._parser = None  # clear circular reference ASAP
 *         if self._matcher is not None:
 *             self._matcher.cacheTags(self._doc, True) # force entry in libxml2 dict             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_14.__pyx_n = 1;
    __pyx_t_14.force_into_dict = 1;
    __pyx_t_4 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_2), &__pyx_t_14); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":191
 *         if self._matcher is not None:
 *             self._matcher.cacheTags(self._doc, True) # force entry in libxml2 dict
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":184
 *             self._matcher = _MultiTagMatcher(tag)
 * 
 *     cdef int startDocument(self, xmlDoc* c_doc) except -1:             # <<<<<<<<<<<<<<
 *         try:
 *             self._doc = _documentFactory(c_doc, self._parser)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.startDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":193
 *         return 0
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         if self._root is None:
 */

static int __pyx_f_4lxml_5etree_17_SaxParserContext_pushEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, PyObject *__pyx_v_event, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_v_root = 0;
  struct LxmlElement *__pyx_v_node = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pushEvent", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":195
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:
 *         cdef _Element root
 *         if self._root is None:             # <<<<<<<<<<<<<<
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_root) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":196
 *         cdef _Element root
 *         if self._root is None:
 *             root = self._doc.getroot()             # <<<<<<<<<<<<<<
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->__pyx_base._doc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_root = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":197
 *         if self._root is None:
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_root) != Py_None);
    if ((__pyx_t_2 != 0)) {
      __pyx_t_1 = ((__pyx_v_root->_c_node->type == XML_ELEMENT_NODE) != 0);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = (__pyx_t_2 != 0);
    }
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":198
 *             root = self._doc.getroot()
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root             # <<<<<<<<<<<<<<
 *         node = _elementFactory(self._doc, c_node)
 *         self.events_iterator._events.append( (event, node) )
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_root));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
      __Pyx_GOTREF(__pyx_v_self->_root);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_root));
      __pyx_v_self->_root = __pyx_v_root;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":199
 *             if root is not None and root._c_node.type == tree.XML_ELEMENT_NODE:
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 *         self.events_iterator._events.append( (event, node) )
 *         return 0
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_3), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_node = ((struct LxmlElement *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":200
 *                 self._root = root
 *         node = _elementFactory(self._doc, c_node)
 *         self.events_iterator._events.append( (event, node) )             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->events_iterator->_events == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_event);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_event);
  __Pyx_GIVEREF(__pyx_v_event);
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
  __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_self->events_iterator->_events, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":201
 *         node = _elementFactory(self._doc, c_node)
 *         self.events_iterator._events.append( (event, node) )
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef int flushEvents(self) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":193
 *         return 0
 * 
 *     cdef int pushEvent(self, event, xmlNode* c_node) except -1:             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         if self._root is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.pushEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":203
 *         return 0
 * 
 *     cdef int flushEvents(self) except -1:             # <<<<<<<<<<<<<<
 *         events = self.events_iterator._events
 *         while self._node_stack:
 */

static int __pyx_f_4lxml_5etree_17_SaxParserContext_flushEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self) {
  PyObject *__pyx_v_events = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flushEvents", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":204
 * 
 *     cdef int flushEvents(self) except -1:
 *         events = self.events_iterator._events             # <<<<<<<<<<<<<<
 *         while self._node_stack:
 *             events.append( ('end', self._node_stack.pop()) )
 */
  __pyx_t_1 = __pyx_v_self->events_iterator->_events;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_events = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":205
 *     cdef int flushEvents(self) except -1:
 *         events = self.events_iterator._events
 *         while self._node_stack:             # <<<<<<<<<<<<<<
 *             events.append( ('end', self._node_stack.pop()) )
 *             _pushSaxNsEndEvents(self)
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_self->_node_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_node_stack) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":206
 *         events = self.events_iterator._events
 *         while self._node_stack:
 *             events.append( ('end', self._node_stack.pop()) )             # <<<<<<<<<<<<<<
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:
 */
    if (unlikely(__pyx_v_events == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_node_stack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 206; __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[12]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_end);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_end);
    __Pyx_GIVEREF(__pyx_n_s_end);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_events, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":207
 *         while self._node_stack:
 *             events.append( ('end', self._node_stack.pop()) )
 *             _pushSaxNsEndEvents(self)             # <<<<<<<<<<<<<<
 *         while self._ns_stack:
 *             _pushSaxNsEndEvents(self)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_self); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":208
 *             events.append( ('end', self._node_stack.pop()) )
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:             # <<<<<<<<<<<<<<
 *             _pushSaxNsEndEvents(self)
 * 
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_self->_ns_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_ns_stack) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":209
 *             _pushSaxNsEndEvents(self)
 *         while self._ns_stack:
 *             _pushSaxNsEndEvents(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_self); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":203
 *         return 0
 * 
 *     cdef int flushEvents(self) except -1:             # <<<<<<<<<<<<<<
 *         events = self.events_iterator._events
 *         while self._node_stack:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._SaxParserContext.flushEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":211
 *             _pushSaxNsEndEvents(self)
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */

static void __pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_handleSaxException", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":212
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->errNo == XML_ERR_OK) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":213
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR             # <<<<<<<<<<<<<<
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
 */
    __pyx_v_c_ctxt->errNo = XML_ERR_INTERNAL_ERROR;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":215
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0             # <<<<<<<<<<<<<<
 *         c_ctxt.disableSAX = 1
 *         self._store_raised()
 */
  __pyx_v_c_ctxt->wellFormed = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":216
 *         # stop parsing immediately
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1             # <<<<<<<<<<<<<<
 *         self._store_raised()
 * 
 */
  __pyx_v_c_ctxt->disableSAX = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":217
 *         c_ctxt.wellFormed = 0
 *         c_ctxt.disableSAX = 1
 *         self._store_raised()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":211
 *             _pushSaxNsEndEvents(self)
 * 
 *     cdef void _handleSaxException(self, xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *         if c_ctxt.errNo == xmlerror.XML_ERR_OK:
 *             c_ctxt.errNo = xmlerror.XML_ERR_INTERNAL_ERROR
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":227
 *     cdef int _event_index
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._event_index = 0
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":228
 * 
 *     def __cinit__(self):
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._event_index = 0
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":229
 *     def __cinit__(self):
 *         self._events = []
 *         self._event_index = 0             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_v_self->_event_index = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":227
 *     cdef int _event_index
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._event_index = 0
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ParseEventsIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":231
 *         self._event_index = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ParseEventsIterator_2__iter__(((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_2__iter__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":232
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":231
 *         self._event_index = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":234
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         events = self._events
 *         event_index = self._event_index
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ParseEventsIterator_4__next__(((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_20_ParseEventsIterator_4__next__(struct __pyx_obj_4lxml_5etree__ParseEventsIterator *__pyx_v_self) {
  PyObject *__pyx_v_events = NULL;
  PyObject *__pyx_v_event_index = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":235
 * 
 *     def __next__(self):
 *         events = self._events             # <<<<<<<<<<<<<<
 *         event_index = self._event_index
 *         if event_index * 2 >= len(events):
 */
  __pyx_t_1 = __pyx_v_self->_events;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_events = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":236
 *     def __next__(self):
 *         events = self._events
 *         event_index = self._event_index             # <<<<<<<<<<<<<<
 *         if event_index * 2 >= len(events):
 *             if event_index:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_event_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_event_index = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":237
 *         events = self._events
 *         event_index = self._event_index
 *         if event_index * 2 >= len(events):             # <<<<<<<<<<<<<<
 *             if event_index:
 *                 # clean up from time to time
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_event_index, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_v_events == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_events); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":238
 *         event_index = self._event_index
 *         if event_index * 2 >= len(events):
 *             if event_index:             # <<<<<<<<<<<<<<
 *                 # clean up from time to time
 *                 del events[:event_index]
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_event_index); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":240
 *             if event_index:
 *                 # clean up from time to time
 *                 del events[:event_index]             # <<<<<<<<<<<<<<
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):
 */
      if (unlikely(__pyx_v_events == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_event_index); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__Pyx_PyObject_DelSlice(__pyx_v_events, 0, __pyx_t_2, NULL, NULL, NULL, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":241
 *                 # clean up from time to time
 *                 del events[:event_index]
 *                 self._event_index = event_index = 0             # <<<<<<<<<<<<<<
 *             if event_index >= len(events):
 *                 raise StopIteration
 */
      __pyx_v_self->_event_index = 0;
      __pyx_t_4 = __Pyx_PyInt_From_long(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_event_index, __pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":242
 *                 del events[:event_index]
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *         item = events[event_index]
 */
    if (unlikely(__pyx_v_events == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = PyList_GET_SIZE(__pyx_v_events); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_event_index, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":243
 *                 self._event_index = event_index = 0
 *             if event_index >= len(events):
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *         item = events[event_index]
 *         self._event_index = event_index + 1
 */
      __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":244
 *             if event_index >= len(events):
 *                 raise StopIteration
 *         item = events[event_index]             # <<<<<<<<<<<<<<
 *         self._event_index = event_index + 1
 *         return item
 */
  if (unlikely(__pyx_v_events == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyObject_GetItem(__pyx_v_events, __pyx_v_event_index); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_item = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":245
 *                 raise StopIteration
 *         item = events[event_index]
 *         self._event_index = event_index + 1             # <<<<<<<<<<<<<<
 *         return item
 * 
 */
  __pyx_t_3 = PyNumber_Add(__pyx_v_event_index, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->_event_index = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":246
 *         item = events[event_index]
 *         self._event_index = event_index + 1
 *         return item             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_item);
  __pyx_r = __pyx_v_item;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":234
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         events = self._events
 *         event_index = self._event_index
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ParseEventsIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_event_index);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":249
 * 
 * 
 * cdef int _appendNsEvents(_SaxParserContext context, int c_nb_namespaces,             # <<<<<<<<<<<<<<
 *                          const_xmlChar** c_namespaces) except -1:
 *     cdef int i
 */

static int __pyx_f_4lxml_5etree__appendNsEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, int __pyx_v_c_nb_namespaces, const xmlChar **__pyx_v_c_namespaces) {
  CYTHON_UNUSED int __pyx_v_i;
  PyObject *__pyx_v_ns_tuple = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendNsEvents", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":252
 *                          const_xmlChar** c_namespaces) except -1:
 *     cdef int i
 *     for i in xrange(c_nb_namespaces):             # <<<<<<<<<<<<<<
 *         ns_tuple = (funicodeOrEmpty(c_namespaces[0]),
 *                     funicode(c_namespaces[1]))
 */
  __pyx_t_1 = __pyx_v_c_nb_namespaces;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":253
 *     cdef int i
 *     for i in xrange(c_nb_namespaces):
 *         ns_tuple = (funicodeOrEmpty(c_namespaces[0]),             # <<<<<<<<<<<<<<
 *                     funicode(c_namespaces[1]))
 *         context.events_iterator._events.append( ("start-ns", ns_tuple) )
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicodeOrEmpty((__pyx_v_c_namespaces[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":254
 *     for i in xrange(c_nb_namespaces):
 *         ns_tuple = (funicodeOrEmpty(c_namespaces[0]),
 *                     funicode(c_namespaces[1]))             # <<<<<<<<<<<<<<
 *         context.events_iterator._events.append( ("start-ns", ns_tuple) )
 *         c_namespaces += 2
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_namespaces[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":253
 *     cdef int i
 *     for i in xrange(c_nb_namespaces):
 *         ns_tuple = (funicodeOrEmpty(c_namespaces[0]),             # <<<<<<<<<<<<<<
 *                     funicode(c_namespaces[1]))
 *         context.events_iterator._events.append( ("start-ns", ns_tuple) )
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 253; __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);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ns_tuple, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":255
 *         ns_tuple = (funicodeOrEmpty(c_namespaces[0]),
 *                     funicode(c_namespaces[1]))
 *         context.events_iterator._events.append( ("start-ns", ns_tuple) )             # <<<<<<<<<<<<<<
 *         c_namespaces += 2
 *     return 0
 */
    if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_kp_s_start_ns);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_s_start_ns);
    __Pyx_GIVEREF(__pyx_kp_s_start_ns);
    __Pyx_INCREF(__pyx_v_ns_tuple);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ns_tuple);
    __Pyx_GIVEREF(__pyx_v_ns_tuple);
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":256
 *                     funicode(c_namespaces[1]))
 *         context.events_iterator._events.append( ("start-ns", ns_tuple) )
 *         c_namespaces += 2             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_v_c_namespaces = (__pyx_v_c_namespaces + 2);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":257
 *         context.events_iterator._events.append( ("start-ns", ns_tuple) )
 *         c_namespaces += 2
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":249
 * 
 * 
 * cdef int _appendNsEvents(_SaxParserContext context, int c_nb_namespaces,             # <<<<<<<<<<<<<<
 *                          const_xmlChar** c_namespaces) except -1:
 *     cdef int i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._appendNsEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_tuple);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":260
 * 
 * 
 * cdef void _handleSaxStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
 */

static void __pyx_f_4lxml_5etree__handleSaxStart(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_localname, const xmlChar *__pyx_v_c_prefix, const xmlChar *__pyx_v_c_namespace, int __pyx_v_c_nb_namespaces, const xmlChar **__pyx_v_c_namespaces, int __pyx_v_c_nb_attributes, int __pyx_v_c_nb_defaulted, const xmlChar **__pyx_v_c_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":268
 *     cdef int i
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":269
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":270
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":271
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if (c_nb_namespaces and
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":272
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":273
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)
 */
        if ((__pyx_v_c_nb_namespaces != 0)) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":274
 *     try:
 *         if (c_nb_namespaces and
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):             # <<<<<<<<<<<<<<
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
 */
          __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
          __pyx_t_6 = __pyx_t_1;
        } else {
          __pyx_t_6 = (__pyx_v_c_nb_namespaces != 0);
        }
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":275
 *         if (c_nb_namespaces and
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)             # <<<<<<<<<<<<<<
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 */
          __pyx_t_7 = __pyx_f_4lxml_5etree__appendNsEvents(__pyx_v_context, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":276
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)
 *         context._origSaxStart(c_ctxt, c_localname, c_prefix, c_namespace,             # <<<<<<<<<<<<<<
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 */
        __pyx_v_context->_origSaxStart(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces, __pyx_v_c_nb_attributes, __pyx_v_c_nb_defaulted, __pyx_v_c_attributes);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":279
 *                               c_nb_namespaces, c_namespaces, c_nb_attributes,
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 * 
 */
        __pyx_t_6 = (__pyx_v_c_ctxt->html != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":280
 *                               c_nb_defaulted, c_attributes)
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)             # <<<<<<<<<<<<<<
 * 
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 */
          __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->node);
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":282
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 * 
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(c_nb_namespaces)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 */
        __pyx_t_6 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":283
 * 
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(c_nb_namespaces)             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 */
          if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
            {__pyx_filename = __pyx_f[12]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
          __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c_nb_namespaces); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_context->_ns_stack, __pyx_t_2); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L17;
        }
        __pyx_L17:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":284
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(c_nb_namespaces)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 */
        __pyx_t_6 = ((__pyx_v_context->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":286
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,             # <<<<<<<<<<<<<<
 *                                c_localname, None)
 *     except:
 */
          __pyx_t_7 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, __pyx_v_c_namespace, __pyx_v_c_localname, Py_None); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          goto __pyx_L18;
        }
        __pyx_L18:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":288
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 *                                c_localname, None)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_10);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":289
 *                                c_localname, None)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":291
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        goto __pyx_L21_return;
      }
      __pyx_L21_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":260
 * 
 * 
 * cdef void _handleSaxStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":294
 * 
 * 
 * cdef void _handleSaxTargetStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
 */

static void __pyx_f_4lxml_5etree__handleSaxTargetStart(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_localname, CYTHON_UNUSED const xmlChar *__pyx_v_c_prefix, const xmlChar *__pyx_v_c_namespace, int __pyx_v_c_nb_namespaces, const xmlChar **__pyx_v_c_namespaces, int __pyx_v_c_nb_attributes, int __pyx_v_c_nb_defaulted, const xmlChar **__pyx_v_c_attributes) {
  CYTHON_UNUSED int __pyx_v_i;
  size_t __pyx_v_c_len;
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_element = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetStart", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":302
 *     cdef int i
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":303
 *     cdef size_t c_len
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":304
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":305
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if (c_nb_namespaces and
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":306
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if (c_nb_namespaces and
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":307
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if (c_nb_namespaces and             # <<<<<<<<<<<<<<
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)
 */
        if ((__pyx_v_c_nb_namespaces != 0)) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":308
 *     try:
 *         if (c_nb_namespaces and
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):             # <<<<<<<<<<<<<<
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)
 *         if c_nb_defaulted > 0:
 */
          __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
          __pyx_t_6 = __pyx_t_1;
        } else {
          __pyx_t_6 = (__pyx_v_c_nb_namespaces != 0);
        }
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":309
 *         if (c_nb_namespaces and
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)             # <<<<<<<<<<<<<<
 *         if c_nb_defaulted > 0:
 *             # only add default attributes if we asked for them
 */
          __pyx_t_7 = __pyx_f_4lxml_5etree__appendNsEvents(__pyx_v_context, __pyx_v_c_nb_namespaces, __pyx_v_c_namespaces); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":310
 *                 context._event_filter & PARSE_EVENT_FILTER_START_NS):
 *             _appendNsEvents(context, c_nb_namespaces, c_namespaces)
 *         if c_nb_defaulted > 0:             # <<<<<<<<<<<<<<
 *             # only add default attributes if we asked for them
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 */
        __pyx_t_6 = ((__pyx_v_c_nb_defaulted > 0) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":312
 *         if c_nb_defaulted > 0:
 *             # only add default attributes if we asked for them
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:             # <<<<<<<<<<<<<<
 *                 c_nb_attributes -= c_nb_defaulted
 *         if c_nb_attributes == 0:
 */
          __pyx_t_6 = (((__pyx_v_c_ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0) != 0);
          if (__pyx_t_6) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":313
 *             # only add default attributes if we asked for them
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                 c_nb_attributes -= c_nb_defaulted             # <<<<<<<<<<<<<<
 *         if c_nb_attributes == 0:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 */
            __pyx_v_c_nb_attributes = (__pyx_v_c_nb_attributes - __pyx_v_c_nb_defaulted);
            goto __pyx_L17;
          }
          __pyx_L17:;
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":314
 *             if c_ctxt.loadsubset & xmlparser.XML_COMPLETE_ATTRS == 0:
 *                 c_nb_attributes -= c_nb_defaulted
 *         if c_nb_attributes == 0:             # <<<<<<<<<<<<<<
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 */
        __pyx_t_6 = ((__pyx_v_c_nb_attributes == 0) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":315
 *                 c_nb_attributes -= c_nb_defaulted
 *         if c_nb_attributes == 0:
 *             attrib = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = {}
 */
          __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
          __pyx_v_attrib = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
          goto __pyx_L18;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":317
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 *             attrib = {}             # <<<<<<<<<<<<<<
 *             for i in xrange(c_nb_attributes):
 *                 name = _namespacedNameFromNsName(
 */
          __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_v_attrib = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":318
 *         else:
 *             attrib = {}
 *             for i in xrange(c_nb_attributes):             # <<<<<<<<<<<<<<
 *                 name = _namespacedNameFromNsName(
 *                     c_attributes[2], c_attributes[0])
 */
          __pyx_t_7 = __pyx_v_c_nb_attributes;
          for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
            __pyx_v_i = __pyx_t_8;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":319
 *             attrib = {}
 *             for i in xrange(c_nb_attributes):
 *                 name = _namespacedNameFromNsName(             # <<<<<<<<<<<<<<
 *                     c_attributes[2], c_attributes[0])
 *                 if c_attributes[3] is NULL:
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedNameFromNsName((__pyx_v_c_attributes[2]), (__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":321
 *                 name = _namespacedNameFromNsName(
 *                     c_attributes[2], c_attributes[0])
 *                 if c_attributes[3] is NULL:             # <<<<<<<<<<<<<<
 *                     value = ''
 *                 else:
 */
            __pyx_t_6 = (((__pyx_v_c_attributes[3]) == NULL) != 0);
            if (__pyx_t_6) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":322
 *                     c_attributes[2], c_attributes[0])
 *                 if c_attributes[3] is NULL:
 *                     value = ''             # <<<<<<<<<<<<<<
 *                 else:
 *                     c_len = c_attributes[4] - c_attributes[3]
 */
              __Pyx_INCREF(__pyx_kp_s__15);
              __Pyx_XDECREF_SET(__pyx_v_value, __pyx_kp_s__15);
              goto __pyx_L21;
            }
            /*else*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":324
 *                     value = ''
 *                 else:
 *                     c_len = c_attributes[4] - c_attributes[3]             # <<<<<<<<<<<<<<
 *                     value = c_attributes[3][:c_len].decode('utf8')
 *                 attrib[name] = value
 */
              __pyx_v_c_len = ((__pyx_v_c_attributes[4]) - (__pyx_v_c_attributes[3]));

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":325
 *                 else:
 *                     c_len = c_attributes[4] - c_attributes[3]
 *                     value = c_attributes[3][:c_len].decode('utf8')             # <<<<<<<<<<<<<<
 *                 attrib[name] = value
 *                 c_attributes += 5
 */
              __pyx_t_2 = __Pyx_decode_c_string(((char *)(__pyx_v_c_attributes[3])), 0, __pyx_v_c_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
              __pyx_t_2 = 0;
            }
            __pyx_L21:;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":326
 *                     c_len = c_attributes[4] - c_attributes[3]
 *                     value = c_attributes[3][:c_len].decode('utf8')
 *                 attrib[name] = value             # <<<<<<<<<<<<<<
 *                 c_attributes += 5
 *         if c_nb_namespaces == 0:
 */
            if (unlikely(PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L7_error;}

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":327
 *                     value = c_attributes[3][:c_len].decode('utf8')
 *                 attrib[name] = value
 *                 c_attributes += 5             # <<<<<<<<<<<<<<
 *         if c_nb_namespaces == 0:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 */
            __pyx_v_c_attributes = (__pyx_v_c_attributes + 5);
          }
        }
        __pyx_L18:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":328
 *                 attrib[name] = value
 *                 c_attributes += 5
 *         if c_nb_namespaces == 0:             # <<<<<<<<<<<<<<
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         else:
 */
        __pyx_t_6 = ((__pyx_v_c_nb_namespaces == 0) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":329
 *                 c_attributes += 5
 *         if c_nb_namespaces == 0:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *         else:
 *             nsmap = {}
 */
          __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
          __pyx_v_nsmap = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
          goto __pyx_L22;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":331
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         else:
 *             nsmap = {}             # <<<<<<<<<<<<<<
 *             for i in xrange(c_nb_namespaces):
 *                 prefix = funicodeOrNone(c_namespaces[0])
 */
          __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_v_nsmap = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":332
 *         else:
 *             nsmap = {}
 *             for i in xrange(c_nb_namespaces):             # <<<<<<<<<<<<<<
 *                 prefix = funicodeOrNone(c_namespaces[0])
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 */
          __pyx_t_7 = __pyx_v_c_nb_namespaces;
          for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
            __pyx_v_i = __pyx_t_8;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":333
 *             nsmap = {}
 *             for i in xrange(c_nb_namespaces):
 *                 prefix = funicodeOrNone(c_namespaces[0])             # <<<<<<<<<<<<<<
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 *                 c_namespaces += 2
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone((__pyx_v_c_namespaces[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":334
 *             for i in xrange(c_nb_namespaces):
 *                 prefix = funicodeOrNone(c_namespaces[0])
 *                 nsmap[prefix] = funicode(c_namespaces[1])             # <<<<<<<<<<<<<<
 *                 c_namespaces += 2
 *         element = _callTargetSaxStart(
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_namespaces[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            if (unlikely(PyObject_SetItem(__pyx_v_nsmap, __pyx_v_prefix, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":335
 *                 prefix = funicodeOrNone(c_namespaces[0])
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 *                 c_namespaces += 2             # <<<<<<<<<<<<<<
 *         element = _callTargetSaxStart(
 *             context, c_ctxt,
 */
            __pyx_v_c_namespaces = (__pyx_v_c_namespaces + 2);
          }
        }
        __pyx_L22:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":338
 *         element = _callTargetSaxStart(
 *             context, c_ctxt,
 *             _namespacedNameFromNsName(c_namespace, c_localname),             # <<<<<<<<<<<<<<
 *             attrib, nsmap)
 * 
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":336
 *                 nsmap[prefix] = funicode(c_namespaces[1])
 *                 c_namespaces += 2
 *         element = _callTargetSaxStart(             # <<<<<<<<<<<<<<
 *             context, c_ctxt,
 *             _namespacedNameFromNsName(c_namespace, c_localname),
 */
        __pyx_t_9 = __pyx_f_4lxml_5etree__callTargetSaxStart(__pyx_v_context, __pyx_v_c_ctxt, __pyx_t_2, __pyx_v_attrib, __pyx_v_nsmap); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_element = __pyx_t_9;
        __pyx_t_9 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":341
 *             attrib, nsmap)
 * 
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             context._ns_stack.append(c_nb_namespaces)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 */
        __pyx_t_6 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":342
 * 
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(c_nb_namespaces)             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 */
          if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
            {__pyx_filename = __pyx_f[12]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
          __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_c_nb_namespaces); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_context->_ns_stack, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L25;
        }
        __pyx_L25:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":343
 *         if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             context._ns_stack.append(c_nb_namespaces)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 */
        __pyx_t_6 = ((__pyx_v_context->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":345
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,             # <<<<<<<<<<<<<<
 *                                c_localname, element)
 *     except:
 */
          __pyx_t_7 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, __pyx_v_c_namespace, __pyx_v_c_localname, __pyx_v_element); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          goto __pyx_L26;
        }
        __pyx_L26:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":347
 *             _pushSaxStartEvent(context, c_ctxt, c_namespace,
 *                                c_localname, element)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_11);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":348
 *                                c_localname, element)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":350
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L29_return;
      }
      __pyx_L29_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":294
 * 
 * 
 * cdef void _handleSaxTargetStart(             # <<<<<<<<<<<<<<
 *         void* ctxt, const_xmlChar* c_localname, const_xmlChar* c_prefix,
 *         const_xmlChar* c_namespace, int c_nb_namespaces,
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":353
 * 
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                               const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

static void __pyx_f_4lxml_5etree__handleSaxStartNoNs(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name, const xmlChar **__pyx_v_c_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStartNoNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":355
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,
 *                               const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":356
 *                               const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":357
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":358
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":359
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":360
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)             # <<<<<<<<<<<<<<
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 */
        __pyx_v_context->_origSaxStartNoNs(__pyx_v_c_ctxt, __pyx_v_c_name, __pyx_v_c_attributes);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":361
 *     try:
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:             # <<<<<<<<<<<<<<
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 */
        __pyx_t_1 = (__pyx_v_c_ctxt->html != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":362
 *         context._origSaxStartNoNs(c_ctxt, c_name, c_attributes)
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 */
          __pyx_f_4lxml_5etree__fixHtmlDictNodeNames(__pyx_v_c_ctxt->dict, __pyx_v_c_ctxt->node);
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":363
 *         if c_ctxt.html:
 *             _fixHtmlDictNodeNames(c_ctxt.dict, c_ctxt.node)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
 */
        __pyx_t_1 = ((__pyx_v_context->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":365
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          __pyx_t_6 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, NULL, __pyx_v_c_name, Py_None); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":366
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxStartNoNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":367
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, None)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":369
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L19_return;
      }
      __pyx_L19_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":353
 * 
 * 
 * cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                               const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":372
 * 
 * 
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

static void __pyx_f_4lxml_5etree__handleSaxTargetStartNoNs(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name, const xmlChar **__pyx_v_c_attributes) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_element = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetStartNoNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":374
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,
 *                                     const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":375
 *                                     const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":376
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":377
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if c_attributes is NULL:
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":378
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":379
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if c_attributes is NULL:             # <<<<<<<<<<<<<<
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 */
        __pyx_t_1 = ((__pyx_v_c_attributes == NULL) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":380
 *     try:
 *         if c_attributes is NULL:
 *             attrib = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = {}
 */
          __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
          __pyx_v_attrib = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":382
 *             attrib = IMMUTABLE_EMPTY_MAPPING
 *         else:
 *             attrib = {}             # <<<<<<<<<<<<<<
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
 */
          __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_v_attrib = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":383
 *         else:
 *             attrib = {}
 *             while c_attributes[0] is not NULL:             # <<<<<<<<<<<<<<
 *                 name = funicode(c_attributes[0])
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 */
          while (1) {
            __pyx_t_1 = (((__pyx_v_c_attributes[0]) != NULL) != 0);
            if (!__pyx_t_1) break;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":384
 *             attrib = {}
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])             # <<<<<<<<<<<<<<
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree_funicode((__pyx_v_c_attributes[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":385
 *             while c_attributes[0] is not NULL:
 *                 name = funicode(c_attributes[0])
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])             # <<<<<<<<<<<<<<
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrEmpty((__pyx_v_c_attributes[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            if (unlikely(PyObject_SetItem(__pyx_v_attrib, __pyx_v_name, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":386
 *                 name = funicode(c_attributes[0])
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2             # <<<<<<<<<<<<<<
 *         element = _callTargetSaxStart(
 *             context, c_ctxt, funicode(c_name),
 */
            __pyx_v_c_attributes = (__pyx_v_c_attributes + 2);
          }
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":388
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(
 *             context, c_ctxt, funicode(c_name),             # <<<<<<<<<<<<<<
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":389
 *         element = _callTargetSaxStart(
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)             # <<<<<<<<<<<<<<
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 */
        __pyx_t_6 = __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING;
        __Pyx_INCREF(__pyx_t_6);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":387
 *                 attrib[name] = funicodeOrEmpty(c_attributes[1])
 *                 c_attributes += 2
 *         element = _callTargetSaxStart(             # <<<<<<<<<<<<<<
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__callTargetSaxStart(__pyx_v_context, __pyx_v_c_ctxt, __pyx_t_2, __pyx_v_attrib, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_element = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":390
 *             context, c_ctxt, funicode(c_name),
 *             attrib, IMMUTABLE_EMPTY_MAPPING)
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |             # <<<<<<<<<<<<<<
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
 */
        __pyx_t_1 = ((__pyx_v_context->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START)) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":392
 *         if context._event_filter & (PARSE_EVENT_FILTER_END |
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxStartEvent(__pyx_v_context, __pyx_v_c_ctxt, NULL, __pyx_v_c_name, __pyx_v_element); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          goto __pyx_L18;
        }
        __pyx_L18:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":393
 *                                     PARSE_EVENT_FILTER_START):
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetStartNoNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":394
 *             _pushSaxStartEvent(context, c_ctxt, NULL, c_name, element)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":396
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L21_return;
      }
      __pyx_L21_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":372
 * 
 * 
 * cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar** c_attributes) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":399
 * 
 * 
 * cdef _callTargetSaxStart(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                          xmlparser.xmlParserCtxt* c_ctxt,
 *                          tag, attrib, nsmap):
 */

static PyObject *__pyx_f_4lxml_5etree__callTargetSaxStart(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  unsigned short __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_callTargetSaxStart", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":402
 *                          xmlparser.xmlParserCtxt* c_ctxt,
 *                          tag, attrib, nsmap):
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)             # <<<<<<<<<<<<<<
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxStart(__pyx_v_context->_target, __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":403
 *                          tag, attrib, nsmap):
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)
 *     if element is not None and c_ctxt.input is not NULL:             # <<<<<<<<<<<<<<
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (
 */
  __pyx_t_2 = (__pyx_v_element != Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = ((__pyx_v_c_ctxt->input != NULL) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":404
 *     element = context._target._handleSaxStart(tag, attrib, nsmap)
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):             # <<<<<<<<<<<<<<
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line
 */
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_element, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":407
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)             # <<<<<<<<<<<<<<
 *     return element
 * 
 */
      if (((__pyx_v_c_ctxt->input->line < 65535) != 0)) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":406
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (
 *                 <unsigned short>c_ctxt.input.line             # <<<<<<<<<<<<<<
 *                 if c_ctxt.input.line < 65535 else 65535)
 *     return element
 */
        __pyx_t_5 = ((unsigned short)__pyx_v_c_ctxt->input->line);
      } else {
        __pyx_t_5 = 65535;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":405
 *     if element is not None and c_ctxt.input is not NULL:
 *         if isinstance(element, _Element):
 *             (<_Element>element)._c_node.line = (             # <<<<<<<<<<<<<<
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)
 */
      ((struct LxmlElement *)__pyx_v_element)->_c_node->line = __pyx_t_5;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":408
 *                 <unsigned short>c_ctxt.input.line
 *                 if c_ctxt.input.line < 65535 else 65535)
 *     return element             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_element);
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":399
 * 
 * 
 * cdef _callTargetSaxStart(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                          xmlparser.xmlParserCtxt* c_ctxt,
 *                          tag, attrib, nsmap):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._callTargetSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":411
 * 
 * 
 * cdef int _pushSaxStartEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlParserCtxt* c_ctxt,
 *                             const_xmlChar* c_href,
 */

static int __pyx_f_4lxml_5etree__pushSaxStartEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, xmlParserCtxt *__pyx_v_c_ctxt, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name, PyObject *__pyx_v_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxStartEvent", 0);
  __Pyx_INCREF(__pyx_v_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":415
 *                             const_xmlChar* c_href,
 *                             const_xmlChar* c_name, node) except -1:
 *     if (context._matcher is None or             # <<<<<<<<<<<<<<
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_context->_matcher) == Py_None);
  if (!(__pyx_t_1 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":416
 *                             const_xmlChar* c_name, node) except -1:
 *     if (context._matcher is None or
 *             context._matcher.matchesNsTag(c_href, c_name)):             # <<<<<<<<<<<<<<
 *         if node is None and context._target is None:
 *             assert context._doc is not None
 */
    __pyx_t_2 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(__pyx_v_context->_matcher, __pyx_v_c_href, __pyx_v_c_name) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":417
 *     if (context._matcher is None or
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:             # <<<<<<<<<<<<<<
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)
 */
    __pyx_t_3 = (__pyx_v_node == Py_None);
    if ((__pyx_t_3 != 0)) {
      __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) == Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
    } else {
      __pyx_t_2 = (__pyx_t_3 != 0);
    }
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":418
 *             context._matcher.matchesNsTag(c_href, c_name)):
 *         if node is None and context._target is None:
 *             assert context._doc is not None             # <<<<<<<<<<<<<<
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (((PyObject *)__pyx_v_context->__pyx_base._doc) != Py_None);
        if (unlikely(!(__pyx_t_2 != 0))) {
          PyErr_SetNone(PyExc_AssertionError);
          {__pyx_filename = __pyx_f[12]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
      }
      #endif

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":419
 *         if node is None and context._target is None:
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)             # <<<<<<<<<<<<<<
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_context->__pyx_base._doc);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_c_ctxt->node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":420
 *             assert context._doc is not None
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and
 */
    __pyx_t_2 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":421
 *             node = _elementFactory(context._doc, c_ctxt.node)
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))             # <<<<<<<<<<<<<<
 *         if (context._target is None and
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 */
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[12]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_n_s_start);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_start);
      __Pyx_GIVEREF(__pyx_n_s_start);
      __Pyx_INCREF(__pyx_v_node);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":422
 *         if context._event_filter & PARSE_EVENT_FILTER_START:
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and             # <<<<<<<<<<<<<<
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_context->_target) == Py_None);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":423
 *             context.events_iterator._events.append(('start', node))
 *         if (context._target is None and
 *                 context._event_filter & PARSE_EVENT_FILTER_END):             # <<<<<<<<<<<<<<
 *             context._node_stack.append(node)
 *     return 0
 */
      __pyx_t_3 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":424
 *         if (context._target is None and
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      if (unlikely(__pyx_v_context->_node_stack == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[12]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_context->_node_stack, __pyx_v_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":425
 *                 context._event_filter & PARSE_EVENT_FILTER_END):
 *             context._node_stack.append(node)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":411
 * 
 * 
 * cdef int _pushSaxStartEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                             xmlparser.xmlParserCtxt* c_ctxt,
 *                             const_xmlChar* c_href,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._pushSaxStartEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":428
 * 
 * 
 * cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) with gil:
 */

static void __pyx_f_4lxml_5etree__handleSaxEnd(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_localname, const xmlChar *__pyx_v_c_prefix, const xmlChar *__pyx_v_c_namespace) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_node = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":431
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":432
 *                         const_xmlChar* c_namespace) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":433
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":434
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if context._target is not None:
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":435
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":436
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             node = context._target._handleSaxEnd(
 *                 _namespacedNameFromNsName(c_namespace, c_localname))
 */
        __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) != Py_None);
        __pyx_t_6 = (__pyx_t_1 != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":438
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(
 *                 _namespacedNameFromNsName(c_namespace, c_localname))             # <<<<<<<<<<<<<<
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_c_namespace, __pyx_v_c_localname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_2);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":437
 *     try:
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(             # <<<<<<<<<<<<<<
 *                 _namespacedNameFromNsName(c_namespace, c_localname))
 *         else:
 */
          __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_node = __pyx_t_7;
          __pyx_t_7 = 0;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":440
 *                 _namespacedNameFromNsName(c_namespace, c_localname))
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)             # <<<<<<<<<<<<<<
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 */
          __pyx_v_context->_origSaxEnd(__pyx_v_c_ctxt, __pyx_v_c_localname, __pyx_v_c_prefix, __pyx_v_c_namespace);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":441
 *         else:
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *             node = None             # <<<<<<<<<<<<<<
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 *         _pushSaxNsEndEvents(context)
 */
          __Pyx_INCREF(Py_None);
          __pyx_v_node = Py_None;
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":442
 *             context._origSaxEnd(c_ctxt, c_localname, c_prefix, c_namespace)
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)             # <<<<<<<<<<<<<<
 *         _pushSaxNsEndEvents(context)
 *     except:
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxEndEvent(__pyx_v_context, __pyx_v_c_namespace, __pyx_v_c_localname, __pyx_v_node); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L7_error;}

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":443
 *             node = None
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 *         _pushSaxNsEndEvents(context)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxNsEndEvents(__pyx_v_context); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":444
 *         _pushSaxEndEvent(context, c_namespace, c_localname, node)
 *         _pushSaxNsEndEvents(context)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":445
 *         _pushSaxNsEndEvents(context)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":447
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":428
 * 
 * 
 * cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_prefix,
 *                         const_xmlChar* c_namespace) with gil:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":450
 * 
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 */

static void __pyx_f_4lxml_5etree__handleSaxEndNoNs(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_node = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxEndNoNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":451
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":452
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":453
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":454
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         if context._target is not None:
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":455
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":456
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         if context._target is not None:             # <<<<<<<<<<<<<<
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
 */
        __pyx_t_1 = (((PyObject *)__pyx_v_context->_target) != Py_None);
        __pyx_t_6 = (__pyx_t_1 != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":457
 *     try:
 *         if context._target is not None:
 *             node = context._target._handleSaxEnd(funicode(c_name))             # <<<<<<<<<<<<<<
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxEnd(__pyx_v_context->_target, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_node = __pyx_t_7;
          __pyx_t_7 = 0;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":459
 *             node = context._target._handleSaxEnd(funicode(c_name))
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)             # <<<<<<<<<<<<<<
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 */
          __pyx_v_context->_origSaxEndNoNs(__pyx_v_c_ctxt, __pyx_v_c_name);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":460
 *         else:
 *             context._origSaxEndNoNs(c_ctxt, c_name)
 *             node = None             # <<<<<<<<<<<<<<
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 *     except:
 */
          __Pyx_INCREF(Py_None);
          __pyx_v_node = Py_None;
        }
        __pyx_L15:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":461
 *             context._origSaxEndNoNs(c_ctxt, c_name)
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree__pushSaxEndEvent(__pyx_v_context, NULL, __pyx_v_c_name, __pyx_v_node); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":462
 *             node = None
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxEndNoNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":463
 *         _pushSaxEndEvent(context, NULL, c_name, node)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":465
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":450
 * 
 * 
 * cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":471
 * 
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:             # <<<<<<<<<<<<<<
 *     cdef int i
 *     if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 */

static int __pyx_f_4lxml_5etree__pushSaxNsEndEvents(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context) {
  CYTHON_UNUSED int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxNsEndEvents", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":473
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:
 *     cdef int i
 *     if context._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *         for i in range(context._ns_stack.pop()):
 *             context.events_iterator._events.append(NS_END_EVENT)
 */
  __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":474
 *     cdef int i
 *     if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 *         for i in range(context._ns_stack.pop()):             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(NS_END_EVENT)
 *     return 0
 */
    if (unlikely(__pyx_v_context->_ns_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_PyList_Pop(__pyx_v_context->_ns_stack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":475
 *     if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 *         for i in range(context._ns_stack.pop()):
 *             context.events_iterator._events.append(NS_END_EVENT)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[12]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __pyx_v_4lxml_5etree_NS_END_EVENT;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":476
 *         for i in range(context._ns_stack.pop()):
 *             context.events_iterator._events.append(NS_END_EVENT)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":471
 * 
 * 
 * cdef int _pushSaxNsEndEvents(_SaxParserContext context) except -1:             # <<<<<<<<<<<<<<
 *     cdef int i
 *     if context._event_filter & PARSE_EVENT_FILTER_END_NS:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._pushSaxNsEndEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":479
 * 
 * 
 * cdef int _pushSaxEndEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
 */

static int __pyx_f_4lxml_5etree__pushSaxEndEvent(struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name, PyObject *__pyx_v_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pushSaxEndEvent", 0);
  __Pyx_INCREF(__pyx_v_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":482
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 */
  __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":483
 *                           const_xmlChar* c_name, node) except -1:
 *     if context._event_filter & PARSE_EVENT_FILTER_END:
 *         if (context._matcher is None or             # <<<<<<<<<<<<<<
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_context->_matcher) == Py_None);
    if (!(__pyx_t_1 != 0)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":484
 *     if context._event_filter & PARSE_EVENT_FILTER_END:
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):             # <<<<<<<<<<<<<<
 *             if context._target is None:
 *                 node = context._node_stack.pop()
 */
      __pyx_t_2 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag(__pyx_v_context->_matcher, __pyx_v_c_href, __pyx_v_c_name) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":485
 *         if (context._matcher is None or
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:             # <<<<<<<<<<<<<<
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))
 */
      __pyx_t_3 = (((PyObject *)__pyx_v_context->_target) == Py_None);
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":486
 *                 context._matcher.matchesNsTag(c_href, c_name)):
 *             if context._target is None:
 *                 node = context._node_stack.pop()             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('end', node))
 *     return 0
 */
        if (unlikely(__pyx_v_context->_node_stack == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
          {__pyx_filename = __pyx_f[12]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = __Pyx_PyList_Pop(__pyx_v_context->_node_stack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L5;
      }
      __pyx_L5:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":487
 *             if context._target is None:
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
      if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[12]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_n_s_end);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_end);
      __Pyx_GIVEREF(__pyx_n_s_end);
      __Pyx_INCREF(__pyx_v_node);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":488
 *                 node = context._node_stack.pop()
 *             context.events_iterator._events.append(('end', node))
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":479
 * 
 * 
 * cdef int _pushSaxEndEvent(_SaxParserContext context,             # <<<<<<<<<<<<<<
 *                           const_xmlChar* c_href,
 *                           const_xmlChar* c_name, node) except -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._pushSaxEndEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_node);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":491
 * 
 * 
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

static void __pyx_f_4lxml_5etree__handleSaxData(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_data, int __pyx_v_data_len) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":493
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":494
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_c_ctxt->disableSAX != 0);
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":495
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":496
 *     if c_ctxt._private is NULL or c_ctxt.disableSAX:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxData(
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":497
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":499
 *     try:
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_3 = __Pyx_decode_c_string(((char *)__pyx_v_c_data), 0, __pyx_v_data_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":498
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._target._handleSaxData(             # <<<<<<<<<<<<<<
 *             c_data[:data_len].decode('utf8'))
 *     except:
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxData(__pyx_v_context->_target, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":500
 *         context._target._handleSaxData(
 *             c_data[:data_len].decode('utf8'))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":501
 *             c_data[:data_len].decode('utf8'))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":503
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":491
 * 
 * 
 * cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":506
 * 
 * 
 * cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_public,
 *                                   const_xmlChar* c_system) with gil:
 */

static void __pyx_f_4lxml_5etree__handleSaxTargetDoctype(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_name, const xmlChar *__pyx_v_c_public, const xmlChar *__pyx_v_c_system) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetDoctype", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":510
 *                                   const_xmlChar* c_system) with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":511
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         context._target._handleSaxDoctype(
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":512
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":514
 *     try:
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":515
 *         context._target._handleSaxDoctype(
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_system))
 *     except:
 */
        __pyx_t_5 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_public); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_5);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":516
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_6 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_system); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":513
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         context._target._handleSaxDoctype(             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_name),
 *             funicodeOrNone(c_public),
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxDoctype(__pyx_v_context->_target, __pyx_t_1, __pyx_t_5, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":517
 *             funicodeOrNone(c_public),
 *             funicodeOrNone(c_system))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetDoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":518
 *             funicodeOrNone(c_system))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L7_exception_handled;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L13_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":520
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      {
        goto __pyx_L16_return;
      }
      __pyx_L16_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":506
 * 
 * 
 * cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name,             # <<<<<<<<<<<<<<
 *                                   const_xmlChar* c_public,
 *                                   const_xmlChar* c_system) with gil:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":523
 * 
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private
 */

static void __pyx_f_4lxml_5etree__handleSaxStartDocument(void *__pyx_v_ctxt) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  xmlDoc *__pyx_v_c_doc;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlDict *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxStartDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":524
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":525
 * cdef void _handleSaxStartDocument(void* ctxt) with gil:
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":526
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)             # <<<<<<<<<<<<<<
 *     c_doc = c_ctxt.myDoc
 *     if c_doc and c_ctxt.dict and not c_doc.dict:
 */
  __pyx_v_context->_origSaxStartDocument(__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":527
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc             # <<<<<<<<<<<<<<
 *     if c_doc and c_ctxt.dict and not c_doc.dict:
 *         # I have no idea why libxml2 disables this - we need it
 */
  __pyx_t_2 = __pyx_v_c_ctxt->myDoc;
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":528
 *     context._origSaxStartDocument(ctxt)
 *     c_doc = c_ctxt.myDoc
 *     if c_doc and c_ctxt.dict and not c_doc.dict:             # <<<<<<<<<<<<<<
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1
 */
  if ((__pyx_v_c_doc != 0)) {
    if ((__pyx_v_c_ctxt->dict != 0)) {
      __pyx_t_3 = ((!(__pyx_v_c_doc->dict != 0)) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = (__pyx_v_c_ctxt->dict != 0);
    }
    __pyx_t_3 = __pyx_t_4;
  } else {
    __pyx_t_3 = (__pyx_v_c_doc != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":530
 *     if c_doc and c_ctxt.dict and not c_doc.dict:
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1             # <<<<<<<<<<<<<<
 *         c_doc.dict = c_ctxt.dict
 *         xmlparser.xmlDictReference(c_ctxt.dict)
 */
    __pyx_v_c_ctxt->dictNames = 1;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":531
 *         # I have no idea why libxml2 disables this - we need it
 *         c_ctxt.dictNames = 1
 *         c_doc.dict = c_ctxt.dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_ctxt.dict)
 *     try:
 */
    __pyx_t_5 = __pyx_v_c_ctxt->dict;
    __pyx_v_c_doc->dict = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":532
 *         c_ctxt.dictNames = 1
 *         c_doc.dict = c_ctxt.dict
 *         xmlparser.xmlDictReference(c_ctxt.dict)             # <<<<<<<<<<<<<<
 *     try:
 *         context.startDocument(c_doc)
 */
    xmlDictReference(__pyx_v_c_ctxt->dict);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":533
 *         c_doc.dict = c_ctxt.dict
 *         xmlparser.xmlDictReference(c_ctxt.dict)
 *     try:             # <<<<<<<<<<<<<<
 *         context.startDocument(c_doc)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":534
 *         xmlparser.xmlDictReference(c_ctxt.dict)
 *     try:
 *         context.startDocument(c_doc)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_9 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->startDocument(__pyx_v_context, __pyx_v_c_doc); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":535
 *     try:
 *         context.startDocument(c_doc)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxStartDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_11);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":536
 *         context.startDocument(c_doc)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":538
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":523
 * 
 * 
 * cdef void _handleSaxStartDocument(void* ctxt) with gil:             # <<<<<<<<<<<<<<
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":541
 * 
 * 
 * cdef void _handleSaxPI(void* ctxt, const_xmlChar* c_target,             # <<<<<<<<<<<<<<
 *                        const_xmlChar* c_data) with gil:
 *     # can only be called if parsing with a target
 */

static void __pyx_f_4lxml_5etree__handleSaxPI(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_target, const xmlChar *__pyx_v_c_data) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_pi = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxPI", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":544
 *                        const_xmlChar* c_data) with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":545
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":546
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":547
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         pi = context._target._handleSaxPi(
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":548
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":550
 *     try:
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),             # <<<<<<<<<<<<<<
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_c_target); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":551
 *         pi = context._target._handleSaxPi(
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))             # <<<<<<<<<<<<<<
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 *             context.events_iterator._events.append(('pi', pi))
 */
        __pyx_t_6 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_6);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":549
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         pi = context._target._handleSaxPi(             # <<<<<<<<<<<<<<
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxPi(__pyx_v_context->_target, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_pi = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":552
 *             funicodeOrNone(c_target),
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('pi', pi))
 *     except:
 */
        __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_PI) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":553
 *             funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 *             context.events_iterator._events.append(('pi', pi))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
            {__pyx_filename = __pyx_f[12]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_n_s_pi);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_pi);
          __Pyx_GIVEREF(__pyx_n_s_pi);
          __Pyx_INCREF(__pyx_v_pi);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_pi);
          __Pyx_GIVEREF(__pyx_v_pi);
          __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L15;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":554
 *         if context._event_filter & PARSE_EVENT_FILTER_PI:
 *             context.events_iterator._events.append(('pi', pi))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxPI", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":555
 *             context.events_iterator._events.append(('pi', pi))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":557
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":541
 * 
 * 
 * cdef void _handleSaxPI(void* ctxt, const_xmlChar* c_target,             # <<<<<<<<<<<<<<
 *                        const_xmlChar* c_data) with gil:
 *     # can only be called if parsing with a target
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_pi);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":560
 * 
 * 
 * cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target,             # <<<<<<<<<<<<<<
 *                             const_xmlChar* data) with gil:
 *     # can only be called when collecting pi events
 */

static void __pyx_f_4lxml_5etree__handleSaxPIEvent(void *__pyx_v_ctxt, const xmlChar *__pyx_v_target, const xmlChar *__pyx_v_data) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  xmlNode *__pyx_v_c_node;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxPIEvent", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":563
 *                             const_xmlChar* data) with gil:
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":564
 *     # can only be called when collecting pi events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":565
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)             # <<<<<<<<<<<<<<
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 */
  __pyx_v_context->_origSaxPI(__pyx_v_ctxt, __pyx_v_target, __pyx_v_data);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":566
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findLastEventNode(__pyx_v_c_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":567
 *     context._origSaxPI(ctxt, target, data)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
 */
  __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":568
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     try:
 *         context.pushEvent('pi', c_node)
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":569
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('pi', c_node)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":570
 *         return
 *     try:
 *         context.pushEvent('pi', c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_n_s_pi, __pyx_v_c_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":571
 *     try:
 *         context.pushEvent('pi', c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxPIEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":572
 *         context.pushEvent('pi', c_node)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":574
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":560
 * 
 * 
 * cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target,             # <<<<<<<<<<<<<<
 *                             const_xmlChar* data) with gil:
 *     # can only be called when collecting pi events
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":577
 * 
 * 
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

static void __pyx_f_4lxml_5etree__handleSaxTargetComment(void *__pyx_v_ctxt, const xmlChar *__pyx_v_c_data) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  PyObject *__pyx_v_comment = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxTargetComment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":579
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil:
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     if c_ctxt._private is NULL:
 *         return
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":580
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->_private == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":581
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     if c_ctxt._private is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":582
 *     if c_ctxt._private is NULL:
 *         return
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":583
 *         return
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:             # <<<<<<<<<<<<<<
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":584
 *     context = <_SaxParserContext>c_ctxt._private
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))             # <<<<<<<<<<<<<<
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             context.events_iterator._events.append(('comment', comment))
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrEmpty(__pyx_v_c_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget *)__pyx_v_context->_target->__pyx_vtab)->_handleSaxComment(__pyx_v_context->_target, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_comment = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":585
 *     try:
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:             # <<<<<<<<<<<<<<
 *             context.events_iterator._events.append(('comment', comment))
 *     except:
 */
        __pyx_t_1 = ((__pyx_v_context->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_COMMENT) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":586
 *         comment = context._target._handleSaxComment(funicodeOrEmpty(c_data))
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             context.events_iterator._events.append(('comment', comment))             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
          if (unlikely(__pyx_v_context->events_iterator->_events == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
            {__pyx_filename = __pyx_f[12]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_n_s_comment);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_comment);
          __Pyx_GIVEREF(__pyx_n_s_comment);
          __Pyx_INCREF(__pyx_v_comment);
          PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_comment);
          __Pyx_GIVEREF(__pyx_v_comment);
          __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_context->events_iterator->_events, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L15;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":587
 *         if context._event_filter & PARSE_EVENT_FILTER_COMMENT:
 *             context.events_iterator._events.append(('comment', comment))
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxTargetComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":588
 *             context.events_iterator._events.append(('comment', comment))
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":590
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":577
 * 
 * 
 * cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil:             # <<<<<<<<<<<<<<
 *     # can only be called if parsing with a target
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_comment);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":593
 * 
 * 
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) with gil:             # <<<<<<<<<<<<<<
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

static void __pyx_f_4lxml_5etree__handleSaxComment(void *__pyx_v_ctxt, const xmlChar *__pyx_v_text) {
  xmlParserCtxt *__pyx_v_c_ctxt;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  xmlNode *__pyx_v_c_node;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":595
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) with gil:
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt             # <<<<<<<<<<<<<<
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 */
  __pyx_v_c_ctxt = ((xmlParserCtxt *)__pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":596
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private             # <<<<<<<<<<<<<<
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_c_ctxt->_private);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":597
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)             # <<<<<<<<<<<<<<
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 */
  __pyx_v_context->_origSaxComment(__pyx_v_ctxt, __pyx_v_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":598
 *     context = <_SaxParserContext>c_ctxt._private
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return
 */
  __pyx_v_c_node = __pyx_f_4lxml_5etree__findLastEventNode(__pyx_v_c_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":599
 *     context._origSaxComment(ctxt, text)
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     try:
 */
  __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":600
 *     c_node = _findLastEventNode(c_ctxt)
 *     if c_node is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     try:
 *         context.pushEvent('comment', c_node)
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":601
 *     if c_node is NULL:
 *         return
 *     try:             # <<<<<<<<<<<<<<
 *         context.pushEvent('comment', c_node)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":602
 *         return
 *     try:
 *         context.pushEvent('comment', c_node)             # <<<<<<<<<<<<<<
 *     except:
 *         context._handleSaxException(c_ctxt)
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pushEvent(__pyx_v_context, __pyx_n_s_comment, __pyx_v_c_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":603
 *     try:
 *         context.pushEvent('comment', c_node)
 *     except:             # <<<<<<<<<<<<<<
 *         context._handleSaxException(c_ctxt)
 *     finally:
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":604
 *         context.pushEvent('comment', c_node)
 *     except:
 *         context._handleSaxException(c_ctxt)             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->_handleSaxException(__pyx_v_context, __pyx_v_c_ctxt);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L14_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":606
 *         context._handleSaxException(c_ctxt)
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":593
 * 
 * 
 * cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) with gil:             # <<<<<<<<<<<<<<
 *     # can only be called when collecting comment events
 *     c_ctxt = <xmlparser.xmlParserCtxt*>ctxt
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":609
 * 
 * 
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
 */

static CYTHON_INLINE xmlNode *__pyx_f_4lxml_5etree__findLastEventNode(xmlParserCtxt *__pyx_v_c_ctxt) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_findLastEventNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":611
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt):
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->inSubset == 1) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":612
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
 */
    __pyx_r = __pyx_v_c_ctxt->myDoc->intSubset->last;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":613
 *     if c_ctxt.inSubset == 1:
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->inSubset == 2) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":614
 *         return c_ctxt.myDoc.intSubset.last
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
 */
    __pyx_r = __pyx_v_c_ctxt->myDoc->extSubset->last;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":615
 *     elif c_ctxt.inSubset == 2:
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:             # <<<<<<<<<<<<<<
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":616
 *         return c_ctxt.myDoc.extSubset.last
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last             # <<<<<<<<<<<<<<
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 *         return c_ctxt.node.last
 */
    __pyx_r = __pyx_v_c_ctxt->myDoc->last;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":617
 *     elif c_ctxt.node is NULL:
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         return c_ctxt.node.last
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":618
 *         return c_ctxt.myDoc.last
 *     elif c_ctxt.node.type == tree.XML_ELEMENT_NODE:
 *         return c_ctxt.node.last             # <<<<<<<<<<<<<<
 *     else:
 *         return c_ctxt.node.next
 */
    __pyx_r = __pyx_v_c_ctxt->node->last;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":620
 *         return c_ctxt.node.last
 *     else:
 *         return c_ctxt.node.next             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = __pyx_v_c_ctxt->node->next;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":609
 * 
 * 
 * cdef inline xmlNode* _findLastEventNode(xmlparser.xmlParserCtxt* c_ctxt):             # <<<<<<<<<<<<<<
 *     # this mimics what libxml2 creates for comments/PIs
 *     if c_ctxt.inSubset == 1:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":641
 *     cdef bint _in_tail
 * 
 *     def __init__(self, *, element_factory=None, parser=None):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = \
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_11TreeBuilder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_11TreeBuilder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_factory = 0;
  PyObject *__pyx_v_parser = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_factory,&__pyx_n_s_parser,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 0; index < 2 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    __pyx_v_element_factory = values[0];
    __pyx_v_parser = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder___init__(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_element_factory, __pyx_v_parser);

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

static int __pyx_pf_4lxml_5etree_11TreeBuilder___init__(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_element_factory, PyObject *__pyx_v_parser) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":642
 * 
 *     def __init__(self, *, element_factory=None, parser=None):
 *         self._sax_event_filter = \             # <<<<<<<<<<<<<<
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 */
  __pyx_v_self->__pyx_base._sax_event_filter = ((((__pyx_e_4lxml_5etree_SAX_EVENT_START | __pyx_e_4lxml_5etree_SAX_EVENT_END) | __pyx_e_4lxml_5etree_SAX_EVENT_DATA) | __pyx_e_4lxml_5etree_SAX_EVENT_PI) | __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":645
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 *         self._data = [] # data collector             # <<<<<<<<<<<<<<
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_data);
  __Pyx_DECREF(__pyx_v_self->_data);
  __pyx_v_self->_data = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":646
 *             SAX_EVENT_PI | SAX_EVENT_COMMENT
 *         self._data = [] # data collector
 *         self._element_stack = [] # element stack             # <<<<<<<<<<<<<<
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_element_stack);
  __Pyx_DECREF(__pyx_v_self->_element_stack);
  __pyx_v_self->_element_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":647
 *         self._data = [] # data collector
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop             # <<<<<<<<<<<<<<
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_element_stack, __pyx_n_s_pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_element_stack_pop);
  __Pyx_DECREF(__pyx_v_self->_element_stack_pop);
  __pyx_v_self->_element_stack_pop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":648
 *         self._element_stack = [] # element stack
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element             # <<<<<<<<<<<<<<
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":649
 *         self._element_stack_pop = self._element_stack.pop
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag             # <<<<<<<<<<<<<<
 *         self._factory = element_factory
 *         self._parser = parser
 */
  __pyx_v_self->_in_tail = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":650
 *         self._last = None # last element
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory             # <<<<<<<<<<<<<<
 *         self._parser = parser
 * 
 */
  __Pyx_INCREF(__pyx_v_element_factory);
  __Pyx_GIVEREF(__pyx_v_element_factory);
  __Pyx_GOTREF(__pyx_v_self->_factory);
  __Pyx_DECREF(__pyx_v_self->_factory);
  __pyx_v_self->_factory = __pyx_v_element_factory;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":651
 *         self._in_tail = 0 # true if we're after an end tag
 *         self._factory = element_factory
 *         self._parser = parser             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_parser;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser));
  __pyx_v_self->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":641
 *     cdef bint _in_tail
 * 
 *     def __init__(self, *, element_factory=None, parser=None):             # <<<<<<<<<<<<<<
 *         self._sax_event_filter = \
 *             SAX_EVENT_START | SAX_EVENT_END | SAX_EVENT_DATA | \
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":654
 * 
 *     @cython.final
 *     cdef int _flush(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._data:
 *             if self._last is not None:
 */

static int __pyx_f_4lxml_5etree_11TreeBuilder__flush(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self) {
  PyObject *__pyx_v_text = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flush", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":655
 *     @cython.final
 *     cdef int _flush(self) except -1:
 *         if self._data:             # <<<<<<<<<<<<<<
 *             if self._last is not None:
 *                 text = u"".join(self._data)
 */
  __pyx_t_1 = (__pyx_v_self->_data != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_data) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":656
 *     cdef int _flush(self) except -1:
 *         if self._data:
 *             if self._last is not None:             # <<<<<<<<<<<<<<
 *                 text = u"".join(self._data)
 *                 if self._in_tail:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_last) != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":657
 *         if self._data:
 *             if self._last is not None:
 *                 text = u"".join(self._data)             # <<<<<<<<<<<<<<
 *                 if self._in_tail:
 *                     assert self._last.tail is None, u"internal error (tail)"
 */
      __pyx_t_3 = __pyx_v_self->_data;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__15, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_text = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":658
 *             if self._last is not None:
 *                 text = u"".join(self._data)
 *                 if self._in_tail:             # <<<<<<<<<<<<<<
 *                     assert self._last.tail is None, u"internal error (tail)"
 *                     self._last.tail = text
 */
      __pyx_t_2 = (__pyx_v_self->_in_tail != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":659
 *                 text = u"".join(self._data)
 *                 if self._in_tail:
 *                     assert self._last.tail is None, u"internal error (tail)"             # <<<<<<<<<<<<<<
 *                     self._last.tail = text
 *                 else:
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tail); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = (__pyx_t_4 == Py_None);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!(__pyx_t_2 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_internal_error_tail);
            {__pyx_filename = __pyx_f[12]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
        }
        #endif

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":660
 *                 if self._in_tail:
 *                     assert self._last.tail is None, u"internal error (tail)"
 *                     self._last.tail = text             # <<<<<<<<<<<<<<
 *                 else:
 *                     assert self._last.text is None, u"internal error (text)"
 */
        if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tail, __pyx_v_text) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":662
 *                     self._last.tail = text
 *                 else:
 *                     assert self._last.text is None, u"internal error (text)"             # <<<<<<<<<<<<<<
 *                     self._last.text = text
 *             del self._data[:]
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = (__pyx_t_4 == Py_None);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!(__pyx_t_2 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_internal_error_text);
            {__pyx_filename = __pyx_f[12]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
        }
        #endif

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":663
 *                 else:
 *                     assert self._last.text is None, u"internal error (text)"
 *                     self._last.text = text             # <<<<<<<<<<<<<<
 *             del self._data[:]
 *         return 0
 */
        if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_text, __pyx_v_text) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":664
 *                     assert self._last.text is None, u"internal error (text)"
 *                     self._last.text = text
 *             del self._data[:]             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    if (unlikely(__pyx_v_self->_data == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_PyObject_DelSlice(__pyx_v_self->_data, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":665
 *                     self._last.text = text
 *             del self._data[:]
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # internal SAX event handlers
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":654
 * 
 *     @cython.final
 *     cdef int _flush(self) except -1:             # <<<<<<<<<<<<<<
 *         if self._data:
 *             if self._last is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":670
 * 
 *     @cython.final
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         if self._factory is not None:
 */

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":671
 *     @cython.final
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":672
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         self._flush()
 *         if self._factory is not None:             # <<<<<<<<<<<<<<
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:
 */
  __pyx_t_2 = (__pyx_v_self->_factory != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":673
 *         self._flush()
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_self->_factory, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_last);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":674
 *         if self._factory is not None:
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:
 */
    __pyx_t_3 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":675
 *             self._last = self._factory(tag, attrib)
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         elif self._element_stack:
 *             self._last = _makeSubElement(
 */
      if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[12]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = ((PyObject *)__pyx_v_self->_last);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_5), ((struct LxmlElement *)__pyx_t_4)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":676
 *             if self._element_stack:
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:             # <<<<<<<<<<<<<<
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 */
  __pyx_t_3 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":678
 *         elif self._element_stack:
 *             self._last = _makeSubElement(
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 *         else:
 *             self._last = _makeElement(
 */
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":677
 *                 _appendChild(self._element_stack[-1], self._last)
 *         elif self._element_stack:
 *             self._last = _makeSubElement(             # <<<<<<<<<<<<<<
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
 */
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(((struct LxmlElement *)__pyx_t_4), __pyx_v_tag, Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_last);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":681
 *         else:
 *             self._last = _makeElement(
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_parser);
    __Pyx_INCREF(__pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":680
 *                 self._element_stack[-1], tag, None, None, attrib, nsmap, None)
 *         else:
 *             self._last = _makeElement(             # <<<<<<<<<<<<<<
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_5), Py_None, Py_None, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_last);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
    __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":682
 *             self._last = _makeElement(
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 0
 *         return self._last
 */
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_last);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_self->_element_stack, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":683
 *                 tag, NULL, None, self._parser, None, None, attrib, nsmap, None)
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":684
 *         self._element_stack.append(self._last)
 *         self._in_tail = 0
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":670
 * 
 *     @cython.final
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         if self._factory is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":687
 * 
 *     @cython.final
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = self._element_stack_pop()
 */

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":688
 *     @cython.final
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":689
 *     cdef _handleSaxEnd(self, tag):
 *         self._flush()
 *         self._last = self._element_stack_pop()             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_element_stack_pop, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 689; __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_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":690
 *         self._flush()
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":691
 *         self._last = self._element_stack_pop()
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":687
 * 
 *     @cython.final
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = self._element_stack_pop()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":694
 * 
 *     @cython.final
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */

static int __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":695
 *     @cython.final
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._data.append(data)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  if (unlikely(__pyx_v_self->_data == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[12]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->_data, __pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":694
 * 
 *     @cython.final
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._data.append(data)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":698
 * 
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)
 */

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxPi", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":699
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = ProcessingInstruction(target, data)
 *         if self._element_stack:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":700
 *     cdef _handleSaxPi(self, target, data):
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)             # <<<<<<<<<<<<<<
 *         if self._element_stack:
 *             _appendChild(self._element_stack[-1], self._last)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 700; __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[12]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":701
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 */
  __pyx_t_5 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":702
 *         self._last = ProcessingInstruction(target, data)
 *         if self._element_stack:
 *             _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_4), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":703
 *         if self._element_stack:
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":704
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":698
 * 
 *     @cython.final
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = ProcessingInstruction(target, data)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxPi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":707
 * 
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = Comment(comment)
 */

static PyObject *__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":708
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):
 *         self._flush()             # <<<<<<<<<<<<<<
 *         self._last = Comment(comment)
 *         if self._element_stack:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__flush(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":709
 *     cdef _handleSaxComment(self, comment):
 *         self._flush()
 *         self._last = Comment(comment)             # <<<<<<<<<<<<<<
 *         if self._element_stack:
 *             _appendChild(self._element_stack[-1], self._last)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 709; __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[12]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_comment);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_comment);
  __Pyx_GIVEREF(__pyx_v_comment);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_last);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last));
  __pyx_v_self->_last = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":710
 *         self._flush()
 *         self._last = Comment(comment)
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 */
  __pyx_t_5 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":711
 *         self._last = Comment(comment)
 *         if self._element_stack:
 *             _appendChild(self._element_stack[-1], self._last)             # <<<<<<<<<<<<<<
 *         self._in_tail = 1
 *         return self._last
 */
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_last);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(((struct LxmlElement *)__pyx_t_4), ((struct LxmlElement *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":712
 *         if self._element_stack:
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  __pyx_v_self->_in_tail = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":713
 *             _appendChild(self._element_stack[-1], self._last)
 *         self._in_tail = 1
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     # Python level event handlers
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":707
 * 
 *     @cython.final
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         self._flush()
 *         self._last = Comment(comment)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":717
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         u"""close(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_2close[] = "close(self)\n\n        Flushes the builder buffers, and returns the toplevel document\n        element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_2close(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_2close(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":723
 *         element.
 *         """
 *         assert not self._element_stack, u"missing end tags"             # <<<<<<<<<<<<<<
 *         assert self._last is not None, u"missing toplevel element"
 *         return self._last
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
    if (unlikely(!((!__pyx_t_1) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_missing_end_tags);
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":724
 *         """
 *         assert not self._element_stack, u"missing end tags"
 *         assert self._last is not None, u"missing toplevel element"             # <<<<<<<<<<<<<<
 *         return self._last
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_last) != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_missing_toplevel_element);
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":725
 *         assert not self._element_stack, u"missing end tags"
 *         assert self._last is not None, u"missing toplevel element"
 *         return self._last             # <<<<<<<<<<<<<<
 * 
 *     def data(self, data):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last));
  __pyx_r = ((PyObject *)__pyx_v_self->_last);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":717
 *     # Python level event handlers
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         u"""close(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":727
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         u"""data(self, data)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_5data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_4data[] = "data(self, data)\n\n        Adds text to the current element.  The value should be either an\n        8-bit string containing ASCII text, or a Unicode string.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_5data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_4data(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), ((PyObject *)__pyx_v_data));

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

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_4data(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":733
 *         8-bit string containing ASCII text, or a Unicode string.
 *         """
 *         self._handleSaxData(data)             # <<<<<<<<<<<<<<
 * 
 *     def start(self, tag, attrs, nsmap=None):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":727
 *         return self._last
 * 
 *     def data(self, data):             # <<<<<<<<<<<<<<
 *         u"""data(self, data)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":735
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         u"""start(self, tag, attrs, nsmap=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_7start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_6start[] = "start(self, tag, attrs, nsmap=None)\n\n        Opens a new element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_7start(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrs = 0;
  PyObject *__pyx_v_nsmap = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_attrs,&__pyx_n_s_nsmap,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "start") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrs = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_6start(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrs, __pyx_v_nsmap);

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

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_6start(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrs, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start", 0);
  __Pyx_INCREF(__pyx_v_nsmap);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":740
 *         Opens a new element.
 *         """
 *         if nsmap is None:             # <<<<<<<<<<<<<<
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)
 */
  __pyx_t_1 = (__pyx_v_nsmap == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":741
 *         """
 *         if nsmap is None:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING             # <<<<<<<<<<<<<<
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 */
    __Pyx_INCREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
    __Pyx_DECREF_SET(__pyx_v_nsmap, __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":742
 *         if nsmap is None:
 *             nsmap = IMMUTABLE_EMPTY_MAPPING
 *         return self._handleSaxStart(tag, attrs, nsmap)             # <<<<<<<<<<<<<<
 * 
 *     def end(self, tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrs, __pyx_v_nsmap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":735
 *         self._handleSaxData(data)
 * 
 *     def start(self, tag, attrs, nsmap=None):             # <<<<<<<<<<<<<<
 *         u"""start(self, tag, attrs, nsmap=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":744
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         u"""end(self, tag)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_9end(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_8end[] = "end(self, tag)\n\n        Closes the current element.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_9end(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("end (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_8end(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), ((PyObject *)__pyx_v_tag));

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

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_8end(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_element = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("end", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":749
 *         Closes the current element.
 *         """
 *         element = self._handleSaxEnd(tag)             # <<<<<<<<<<<<<<
 *         assert self._last.tag == tag,\
 *                u"end tag mismatch (expected %s, got %s)" % (
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":750
 *         """
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\             # <<<<<<<<<<<<<<
 *                u"end tag mismatch (expected %s, got %s)" % (
 *                    self._last.tag, tag)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_tag, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":752
 *         assert self._last.tag == tag,\
 *                u"end tag mismatch (expected %s, got %s)" % (
 *                    self._last.tag, tag)             # <<<<<<<<<<<<<<
 *         return element
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_last), __pyx_n_s_tag); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 752; __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[12]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_tag);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tag);
      __Pyx_GIVEREF(__pyx_v_tag);
      __pyx_t_2 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":751
 *         element = self._handleSaxEnd(tag)
 *         assert self._last.tag == tag,\
 *                u"end tag mismatch (expected %s, got %s)" % (             # <<<<<<<<<<<<<<
 *                    self._last.tag, tag)
 *         return element
 */
      __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_end_tag_mismatch_expected_s_got, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[12]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":753
 *                u"end tag mismatch (expected %s, got %s)" % (
 *                    self._last.tag, tag)
 *         return element             # <<<<<<<<<<<<<<
 * 
 *     def pi(self, target, data):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_element);
  __pyx_r = __pyx_v_element;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":744
 *         return self._handleSaxStart(tag, attrs, nsmap)
 * 
 *     def end(self, tag):             # <<<<<<<<<<<<<<
 *         u"""end(self, tag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":755
 *         return element
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         u"""pi(self, target, data)
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_11pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_10pi[] = "pi(self, target, data)\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_11pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pi") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_target = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pi", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_10pi(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), __pyx_v_target, __pyx_v_data);

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

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_10pi(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pi", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":758
 *         u"""pi(self, target, data)
 *         """
 *         return self._handleSaxPi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     def comment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_target, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":755
 *         return element
 * 
 *     def pi(self, target, data):             # <<<<<<<<<<<<<<
 *         u"""pi(self, target, data)
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":760
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         u"""comment(self, comment)
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_13comment(PyObject *__pyx_v_self, PyObject *__pyx_v_comment); /*proto*/
static char __pyx_doc_4lxml_5etree_11TreeBuilder_12comment[] = "comment(self, comment)\n        ";
static PyObject *__pyx_pw_4lxml_5etree_11TreeBuilder_13comment(PyObject *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("comment (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_11TreeBuilder_12comment(((struct __pyx_obj_4lxml_5etree_TreeBuilder *)__pyx_v_self), ((PyObject *)__pyx_v_comment));

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

static PyObject *__pyx_pf_4lxml_5etree_11TreeBuilder_12comment(struct __pyx_obj_4lxml_5etree_TreeBuilder *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("comment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":763
 *         u"""comment(self, comment)
 *         """
 *         return self._handleSaxComment(comment)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment(((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_self), __pyx_v_comment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":760
 *         return self._handleSaxPi(target, data)
 * 
 *     def comment(self, comment):             # <<<<<<<<<<<<<<
 *         u"""comment(self, comment)
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.TreeBuilder.comment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":10
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_19_TargetParserResult_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_19_TargetParserResult_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_result = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._TargetParserResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_19_TargetParserResult___init__(__pyx_self, __pyx_v_self, __pyx_v_result);

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":11
 *     # machinery towards the API level functions
 *     def __init__(self, result):
 *         self.result = result             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_result, __pyx_v_result) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":10
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._TargetParserResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":24
 *     cdef bint _start_takes_nsmap
 * 
 *     def __cinit__(self, target):             # <<<<<<<<<<<<<<
 *         cdef int event_filter
 *         event_filter = 0
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_PythonSaxParserTarget_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22_PythonSaxParserTarget_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_target = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_target,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_target = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)__pyx_v_self), __pyx_v_target);

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

static int __pyx_pf_4lxml_5etree_22_PythonSaxParserTarget___cinit__(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target) {
  int __pyx_v_event_filter;
  PyObject *__pyx_v_arguments = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":26
 *     def __cinit__(self, target):
 *         cdef int event_filter
 *         event_filter = 0             # <<<<<<<<<<<<<<
 *         self._start_takes_nsmap = 0
 *         try:
 */
  __pyx_v_event_filter = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":27
 *         cdef int event_filter
 *         event_filter = 0
 *         self._start_takes_nsmap = 0             # <<<<<<<<<<<<<<
 *         try:
 *             self._target_start = target.start
 */
  __pyx_v_self->_start_takes_nsmap = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":28
 *         event_filter = 0
 *         self._start_takes_nsmap = 0
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_start = target.start
 *             if self._target_start is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":29
 *         self._start_takes_nsmap = 0
 *         try:
 *             self._target_start = target.start             # <<<<<<<<<<<<<<
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_target_start);
      __Pyx_DECREF(__pyx_v_self->_target_start);
      __pyx_v_self->_target_start = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":30
 *         try:
 *             self._target_start = target.start
 *             if self._target_start is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:
 */
      __pyx_t_5 = (__pyx_v_self->_target_start != Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":31
 *             self._target_start = target.start
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_START);
        goto __pyx_L11;
      }
      __pyx_L11:;
    }
    /*else:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":35
 *             pass
 *         else:
 *             try:             # <<<<<<<<<<<<<<
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":36
 *         else:
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)             # <<<<<<<<<<<<<<
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
 */
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_v_self->_target_start);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->_target_start);
          __Pyx_GIVEREF(__pyx_v_self->_target_start);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_inspect_getargspec, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_v_arguments = __pyx_t_10;
          __pyx_t_10 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":37
 *             try:
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:             # <<<<<<<<<<<<<<
 *                     self._start_takes_nsmap = 1
 *             except TypeError:
 */
          __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_arguments, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_6 = ((__pyx_t_11 > 3) != 0);
          if (!__pyx_t_6) {
            __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_arguments, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_5 = (__pyx_t_10 != Py_None);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_t_12 = (__pyx_t_5 != 0);
          } else {
            __pyx_t_12 = __pyx_t_6;
          }
          if (__pyx_t_12) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":38
 *                 arguments = inspect_getargspec(self._target_start)
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 pass
 */
            __pyx_v_self->_start_takes_nsmap = 1;
            goto __pyx_L20;
          }
          __pyx_L20:;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L19_try_end;
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":39
 *                 if len(arguments[0]) > 3 or arguments[1] is not None:
 *                     self._start_takes_nsmap = 1
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 pass
 *         try:
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
        if (__pyx_t_13) {
          PyErr_Restore(0,0,0);
          goto __pyx_L13_exception_handled;
        }
        goto __pyx_L14_except_error;
        __pyx_L14_except_error:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L5_except_error;
        __pyx_L13_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L19_try_end:;
      }
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":32
 *             if self._target_start is not None:
 *                 event_filter |= SAX_EVENT_START
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         else:
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":41
 *             except TypeError:
 *                 pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_end = target.end
 *             if self._target_end is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":42
 *                 pass
 *         try:
 *             self._target_end = target.end             # <<<<<<<<<<<<<<
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_end); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->_target_end);
      __Pyx_DECREF(__pyx_v_self->_target_end);
      __pyx_v_self->_target_end = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":43
 *         try:
 *             self._target_end = target.end
 *             if self._target_end is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:
 */
      __pyx_t_12 = (__pyx_v_self->_target_end != Py_None);
      __pyx_t_6 = (__pyx_t_12 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":44
 *             self._target_end = target.end
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_END);
        goto __pyx_L29;
      }
      __pyx_L29:;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L28_try_end;
    __pyx_L21_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":45
 *             if self._target_end is not None:
 *                 event_filter |= SAX_EVENT_END
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L22_exception_handled;
    }
    goto __pyx_L23_except_error;
    __pyx_L23_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L22_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L28_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":47
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_data = target.data
 *             if self._target_data is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":48
 *             pass
 *         try:
 *             self._target_data = target.data             # <<<<<<<<<<<<<<
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_data); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->_target_data);
      __Pyx_DECREF(__pyx_v_self->_target_data);
      __pyx_v_self->_target_data = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":49
 *         try:
 *             self._target_data = target.data
 *             if self._target_data is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:
 */
      __pyx_t_6 = (__pyx_v_self->_target_data != Py_None);
      __pyx_t_12 = (__pyx_t_6 != 0);
      if (__pyx_t_12) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":50
 *             self._target_data = target.data
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_DATA);
        goto __pyx_L38;
      }
      __pyx_L38:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L37_try_end;
    __pyx_L30_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":51
 *             if self._target_data is not None:
 *                 event_filter |= SAX_EVENT_DATA
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L31_exception_handled;
    }
    goto __pyx_L32_except_error;
    __pyx_L32_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L31_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L37_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":53
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":54
 *             pass
 *         try:
 *             self._target_doctype = target.doctype             # <<<<<<<<<<<<<<
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_doctype); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L39_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->_target_doctype);
      __Pyx_DECREF(__pyx_v_self->_target_doctype);
      __pyx_v_self->_target_doctype = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":55
 *         try:
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:
 */
      __pyx_t_12 = (__pyx_v_self->_target_doctype != Py_None);
      __pyx_t_6 = (__pyx_t_12 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":56
 *             self._target_doctype = target.doctype
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_DOCTYPE);
        goto __pyx_L47;
      }
      __pyx_L47:;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L46_try_end;
    __pyx_L39_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":57
 *             if self._target_doctype is not None:
 *                 event_filter |= SAX_EVENT_DOCTYPE
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L40_exception_handled;
    }
    goto __pyx_L41_except_error;
    __pyx_L41_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L40_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L46_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":59
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":60
 *             pass
 *         try:
 *             self._target_pi = target.pi             # <<<<<<<<<<<<<<
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_pi); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L48_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->_target_pi);
      __Pyx_DECREF(__pyx_v_self->_target_pi);
      __pyx_v_self->_target_pi = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":61
 *         try:
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:
 */
      __pyx_t_6 = (__pyx_v_self->_target_pi != Py_None);
      __pyx_t_12 = (__pyx_t_6 != 0);
      if (__pyx_t_12) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":62
 *             self._target_pi = target.pi
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_PI);
        goto __pyx_L56;
      }
      __pyx_L56:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L55_try_end;
    __pyx_L48_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":63
 *             if self._target_pi is not None:
 *                 event_filter |= SAX_EVENT_PI
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L49_exception_handled;
    }
    goto __pyx_L50_except_error;
    __pyx_L50_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L49_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L55_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":65
 *         except AttributeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":66
 *             pass
 *         try:
 *             self._target_comment = target.comment             # <<<<<<<<<<<<<<
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_target, __pyx_n_s_comment); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L57_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->_target_comment);
      __Pyx_DECREF(__pyx_v_self->_target_comment);
      __pyx_v_self->_target_comment = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":67
 *         try:
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:             # <<<<<<<<<<<<<<
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:
 */
      __pyx_t_12 = (__pyx_v_self->_target_comment != Py_None);
      __pyx_t_6 = (__pyx_t_12 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":68
 *             self._target_comment = target.comment
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             pass
 */
        __pyx_v_event_filter = (__pyx_v_event_filter | __pyx_e_4lxml_5etree_SAX_EVENT_COMMENT);
        goto __pyx_L65;
      }
      __pyx_L65:;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L64_try_end;
    __pyx_L57_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":69
 *             if self._target_comment is not None:
 *                 event_filter |= SAX_EVENT_COMMENT
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             pass
 *         self._sax_event_filter = event_filter
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L58_exception_handled;
    }
    goto __pyx_L59_except_error;
    __pyx_L59_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L58_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L64_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":71
 *         except AttributeError:
 *             pass
 *         self._sax_event_filter = event_filter             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 */
  __pyx_v_self->__pyx_base._sax_event_filter = __pyx_v_event_filter;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":24
 *     cdef bint _start_takes_nsmap
 * 
 *     def __cinit__(self, target):             # <<<<<<<<<<<<<<
 *         cdef int event_filter
 *         event_filter = 0
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arguments);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":73
 *         self._sax_event_filter = event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)
 */

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxStart", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":74
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:             # <<<<<<<<<<<<<<
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_start_takes_nsmap != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":75
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._target_start(tag, attrib)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __Pyx_INCREF(__pyx_v_nsmap);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_nsmap);
    __Pyx_GIVEREF(__pyx_v_nsmap);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_self->_target_start, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 75; __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;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":77
 *             return self._target_start(tag, attrib, nsmap)
 *         else:
 *             return self._target_start(tag, attrib)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxEnd(self, tag):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_target_start, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":73
 *         self._sax_event_filter = event_filter
 * 
 *     cdef _handleSaxStart(self, tag, attrib, nsmap):             # <<<<<<<<<<<<<<
 *         if self._start_takes_nsmap:
 *             return self._target_start(tag, attrib, nsmap)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxStart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":79
 *             return self._target_start(tag, attrib)
 * 
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return self._target_end(tag)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxEnd", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":80
 * 
 *     cdef _handleSaxEnd(self, tag):
 *         return self._target_end(tag)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
  __Pyx_GIVEREF(__pyx_v_tag);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_target_end, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 80; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":79
 *             return self._target_start(tag, attrib)
 * 
 *     cdef _handleSaxEnd(self, tag):             # <<<<<<<<<<<<<<
 *         return self._target_end(tag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxEnd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":82
 *         return self._target_end(tag)
 * 
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._target_data(data)
 * 
 */

static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxData", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":83
 * 
 *     cdef int _handleSaxData(self, data) except -1:
 *         self._target_data(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_target_data, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 83; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":82
 *         return self._target_end(tag)
 * 
 *     cdef int _handleSaxData(self, data) except -1:             # <<<<<<<<<<<<<<
 *         self._target_data(data)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":85
 *         self._target_data(data)
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 */

static int __pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_root_tag, PyObject *__pyx_v_public_id, PyObject *__pyx_v_system_id) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxDoctype", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":86
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:
 *         self._target_doctype(root_tag, public_id, system_id)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxPi(self, target, data):
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_root_tag);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_root_tag);
  __Pyx_GIVEREF(__pyx_v_root_tag);
  __Pyx_INCREF(__pyx_v_public_id);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_public_id);
  __Pyx_GIVEREF(__pyx_v_public_id);
  __Pyx_INCREF(__pyx_v_system_id);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_system_id);
  __Pyx_GIVEREF(__pyx_v_system_id);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_target_doctype, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 86; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":85
 *         self._target_data(data)
 * 
 *     cdef int _handleSaxDoctype(self, root_tag, public_id, system_id) except -1:             # <<<<<<<<<<<<<<
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxDoctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":88
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return self._target_pi(target, data)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxPi", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":89
 * 
 *     cdef _handleSaxPi(self, target, data):
 *         return self._target_pi(target, data)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handleSaxComment(self, comment):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_target_pi, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 89; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":88
 *         self._target_doctype(root_tag, public_id, system_id)
 * 
 *     cdef _handleSaxPi(self, target, data):             # <<<<<<<<<<<<<<
 *         return self._target_pi(target, data)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxPi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":91
 *         return self._target_pi(target, data)
 * 
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return self._target_comment(comment)
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *__pyx_v_self, PyObject *__pyx_v_comment) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleSaxComment", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":92
 * 
 *     cdef _handleSaxComment(self, comment):
 *         return self._target_comment(comment)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_comment);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_comment);
  __Pyx_GIVEREF(__pyx_v_comment);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_target_comment, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 92; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":91
 *         return self._target_pi(target, data)
 * 
 *     cdef _handleSaxComment(self, comment):             # <<<<<<<<<<<<<<
 *         return self._target_comment(comment)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._PythonSaxParserTarget._handleSaxComment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":101
 *     """
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:             # <<<<<<<<<<<<<<
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 */

static int __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, PyObject *__pyx_v_target) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setTarget", 0);
  __Pyx_INCREF(__pyx_v_target);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":102
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target             # <<<<<<<<<<<<<<
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, u'__dict__'):
 */
  __Pyx_INCREF(__pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __Pyx_GOTREF(__pyx_v_self->_python_target);
  __Pyx_DECREF(__pyx_v_self->_python_target);
  __pyx_v_self->_python_target = __pyx_v_target;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":103
 *     cdef int _setTarget(self, target) except -1:
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \             # <<<<<<<<<<<<<<
 *                 hasattr(target, u'__dict__'):
 *             target = _PythonSaxParserTarget(target)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_target, ((PyObject*)__pyx_ptype_4lxml_5etree__SaxParserTarget)); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (!__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":104
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, u'__dict__'):             # <<<<<<<<<<<<<<
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 */
    __pyx_t_1 = PyObject_HasAttr(__pyx_v_target, __pyx_n_u_dict); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (__pyx_t_1 != 0);
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":105
 *         if not isinstance(target, _SaxParserTarget) or \
 *                 hasattr(target, u'__dict__'):
 *             target = _PythonSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         self._setSaxParserTarget(target)
 *         return 0
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_target);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_target);
    __Pyx_GIVEREF(__pyx_v_target);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__PythonSaxParserTarget)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":106
 *                 hasattr(target, u'__dict__'):
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (!(likely(((__pyx_v_target) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_target, __pyx_ptype_4lxml_5etree__SaxParserTarget))))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._setSaxParserTarget(((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_v_self), ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)__pyx_v_target));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":107
 *             target = _PythonSaxParserTarget(target)
 *         self._setSaxParserTarget(target)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserContext _copy(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":101
 *     """
 *     cdef object _python_target
 *     cdef int _setTarget(self, target) except -1:             # <<<<<<<<<<<<<<
 *         self._python_target = target
 *         if not isinstance(target, _SaxParserTarget) or \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._setTarget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":109
 *         return 0
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
 */

static struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_f_4lxml_5etree_20_TargetParserContext__copy(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":111
 *     cdef _ParserContext _copy(self):
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._setTarget(self._python_target)
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_4lxml_5etree__ParserContext->_copy(((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__TargetParserContext))))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":112
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_1 = __pyx_v_self->_python_target;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_20_TargetParserContext__setTarget(__pyx_v_context, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":113
 *         context = _ParserContext._copy(self)
 *         context._setTarget(self._python_target)
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserContext *)__pyx_v_context);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":109
 *         return 0
 * 
 *     cdef _ParserContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _TargetParserContext context
 *         context = _ParserContext._copy(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":115
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 */

static void __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, xmlDoc *__pyx_v_result) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_cleanupTargetParserContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":116
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):
 *         if self._c_ctxt.myDoc is not NULL:             # <<<<<<<<<<<<<<
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":117
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \             # <<<<<<<<<<<<<<
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
 */
    __pyx_t_1 = ((__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc != __pyx_v_result) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":118
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 *                     self._c_ctxt.myDoc._private is NULL:             # <<<<<<<<<<<<<<
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)
 */
      __pyx_t_2 = ((__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc->_private == NULL) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":120
 *                     self._c_ctxt.myDoc._private is NULL:
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)             # <<<<<<<<<<<<<<
 *             self._c_ctxt.myDoc = NULL
 * 
 */
      xmlFreeDoc(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":121
 *                 # no _Document proxy => orphen
 *                 tree.xmlFreeDoc(self._c_ctxt.myDoc)
 *             self._c_ctxt.myDoc = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,
 */
    __pyx_v_self->__pyx_base.__pyx_base._c_ctxt->myDoc = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":115
 *         return context
 * 
 *     cdef void _cleanupTargetParserContext(self, xmlDoc* result):             # <<<<<<<<<<<<<<
 *         if self._c_ctxt.myDoc is not NULL:
 *             if self._c_ctxt.myDoc is not result and \
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":123
 *             self._c_ctxt.myDoc = NULL
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,             # <<<<<<<<<<<<<<
 *                                    filename):
 *         cdef bint recover
 */

static PyObject *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResult", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":126
 *                                    filename):
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         try:
 *             if self._has_raised():
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":127
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:             # <<<<<<<<<<<<<<
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":128
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         try:
 *             if self._has_raised():             # <<<<<<<<<<<<<<
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 */
      __pyx_t_4 = (((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":129
 *         try:
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)             # <<<<<<<<<<<<<<
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 */
        __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(__pyx_v_self, __pyx_v_result);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":130
 *             if self._has_raised():
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()             # <<<<<<<<<<<<<<
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 */
        __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":131
 *                 self._cleanupTargetParserContext(result)
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 */
      __pyx_t_4 = ((!(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed != 0)) != 0);
      if (__pyx_t_4) {
        __pyx_t_6 = ((!(__pyx_v_recover != 0)) != 0);
        __pyx_t_7 = __pyx_t_6;
      } else {
        __pyx_t_7 = __pyx_t_4;
      }
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":132
 *                 self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         except:
 *             if python.IS_PYTHON3:
 */
        __pyx_t_8 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_5 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_8)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":133
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:             # <<<<<<<<<<<<<<
 *             if python.IS_PYTHON3:
 *                 self._python_target.close()
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":134
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 *             if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 self._python_target.close()
 *                 raise
 */
      __pyx_t_7 = (IS_PYTHON3 != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":135
 *         except:
 *             if python.IS_PYTHON3:
 *                 self._python_target.close()             # <<<<<<<<<<<<<<
 *                 raise
 *             else:
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":136
 *             if python.IS_PYTHON3:
 *                 self._python_target.close()
 *                 raise             # <<<<<<<<<<<<<<
 *             else:
 *                 exc = sys.exc_info()
 */
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; 
        {__pyx_filename = __pyx_f[13]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":138
 *                 raise
 *             else:
 *                 exc = sys.exc_info()             # <<<<<<<<<<<<<<
 *                 # Python 2 can't chain exceptions
 *                 try: self._python_target.close()
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_v_exc = __pyx_t_11;
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":140
 *                 exc = sys.exc_info()
 *                 # Python 2 can't chain exceptions
 *                 try: self._python_target.close()             # <<<<<<<<<<<<<<
 *                 except: pass
 *                 raise exc[0], exc[1], exc[2]
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          /*try:*/ {
            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L23_try_end;
          __pyx_L16_error:;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":141
 *                 # Python 2 can't chain exceptions
 *                 try: self._python_target.close()
 *                 except: pass             # <<<<<<<<<<<<<<
 *                 raise exc[0], exc[1], exc[2]
 *         return self._python_target.close()
 */
          /*except:*/ {
            PyErr_Restore(0,0,0);
            goto __pyx_L17_exception_handled;
          }
          __pyx_L17_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_L23_try_end:;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":142
 *                 try: self._python_target.close()
 *                 except: pass
 *                 raise exc[0], exc[1], exc[2]             # <<<<<<<<<<<<<<
 *         return self._python_target.close()
 * 
 */
        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_exc, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;};
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_exc, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;};
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_exc, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;};
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_Raise(__pyx_t_12, __pyx_t_11, __pyx_t_16, 0);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        {__pyx_filename = __pyx_f[13]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":143
 *                 except: pass
 *                 raise exc[0], exc[1], exc[2]
 *         return self._python_target.close()             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":123
 *             self._c_ctxt.myDoc = NULL
 * 
 *     cdef object _handleParseResult(self, _BaseParser parser, xmlDoc* result,             # <<<<<<<<<<<<<<
 *                                    filename):
 *         cdef bint recover
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":145
 *         return self._python_target.close()
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 */

static xmlDoc *__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc(struct __pyx_obj_4lxml_5etree__TargetParserContext *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser, xmlDoc *__pyx_v_result, PyObject *__pyx_v_filename) {
  int __pyx_v_recover;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_v_parse_result = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handleParseResultDoc", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":148
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER             # <<<<<<<<<<<<<<
 *         if result is not NULL and result._private is NULL:
 *             # no _Document proxy => orphen
 */
  __pyx_v_recover = (__pyx_v_parser->_parse_options & XML_PARSE_RECOVER);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":149
 *         cdef bint recover
 *         recover = parser._parse_options & xmlparser.XML_PARSE_RECOVER
 *         if result is not NULL and result._private is NULL:             # <<<<<<<<<<<<<<
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 */
  __pyx_t_1 = ((__pyx_v_result != NULL) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_result->_private == NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":151
 *         if result is not NULL and result._private is NULL:
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)             # <<<<<<<<<<<<<<
 *         try:
 *             self._cleanupTargetParserContext(result)
 */
    xmlFreeDoc(__pyx_v_result);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":152
 *             # no _Document proxy => orphen
 *             tree.xmlFreeDoc(result)
 *         try:             # <<<<<<<<<<<<<<
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":153
 *             tree.xmlFreeDoc(result)
 *         try:
 *             self._cleanupTargetParserContext(result)             # <<<<<<<<<<<<<<
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 */
      __pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext(__pyx_v_self, __pyx_v_result);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":154
 *         try:
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()             # <<<<<<<<<<<<<<
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 */
      __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L4_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":155
 *             self._cleanupTargetParserContext(result)
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:             # <<<<<<<<<<<<<<
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 */
      __pyx_t_3 = ((!(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt->wellFormed != 0)) != 0);
      if (__pyx_t_3) {
        __pyx_t_1 = ((!(__pyx_v_recover != 0)) != 0);
        __pyx_t_2 = __pyx_t_1;
      } else {
        __pyx_t_2 = __pyx_t_3;
      }
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":156
 *             self._raise_if_stored()
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)             # <<<<<<<<<<<<<<
 *         except:
 *             if python.IS_PYTHON3:
 */
        __pyx_t_8 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base._error_log);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_7 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_self->__pyx_base.__pyx_base._c_ctxt, __pyx_v_filename, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_8)); if (unlikely(__pyx_t_7 == 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":157
 *             if not self._c_ctxt.wellFormed and not recover:
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:             # <<<<<<<<<<<<<<
 *             if python.IS_PYTHON3:
 *                 self._python_target.close()
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":158
 *                 _raiseParseError(self._c_ctxt, filename, self._error_log)
 *         except:
 *             if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 self._python_target.close()
 *                 raise
 */
      __pyx_t_2 = (IS_PYTHON3 != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":159
 *         except:
 *             if python.IS_PYTHON3:
 *                 self._python_target.close()             # <<<<<<<<<<<<<<
 *                 raise
 *             else:
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":160
 *             if python.IS_PYTHON3:
 *                 self._python_target.close()
 *                 raise             # <<<<<<<<<<<<<<
 *             else:
 *                 exc = sys.exc_info()
 */
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; 
        {__pyx_filename = __pyx_f[13]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":162
 *                 raise
 *             else:
 *                 exc = sys.exc_info()             # <<<<<<<<<<<<<<
 *                 # Python 2 can't chain exceptions
 *                 try: self._python_target.close()
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_v_exc = __pyx_t_11;
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":164
 *                 exc = sys.exc_info()
 *                 # Python 2 can't chain exceptions
 *                 try: self._python_target.close()             # <<<<<<<<<<<<<<
 *                 except: pass
 *                 raise exc[0], exc[1], exc[2]
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          /*try:*/ {
            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L23_try_end;
          __pyx_L16_error:;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":165
 *                 # Python 2 can't chain exceptions
 *                 try: self._python_target.close()
 *                 except: pass             # <<<<<<<<<<<<<<
 *                 raise exc[0], exc[1], exc[2]
 *         parse_result = self._python_target.close()
 */
          /*except:*/ {
            PyErr_Restore(0,0,0);
            goto __pyx_L17_exception_handled;
          }
          __pyx_L17_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_L23_try_end:;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":166
 *                 try: self._python_target.close()
 *                 except: pass
 *                 raise exc[0], exc[1], exc[2]             # <<<<<<<<<<<<<<
 *         parse_result = self._python_target.close()
 *         raise _TargetParserResult(parse_result)
 */
        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_exc, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;};
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_exc, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;};
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_exc, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;};
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_Raise(__pyx_t_12, __pyx_t_11, __pyx_t_16, 0);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        {__pyx_filename = __pyx_f[13]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L11_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":167
 *                 except: pass
 *                 raise exc[0], exc[1], exc[2]
 *         parse_result = self._python_target.close()             # <<<<<<<<<<<<<<
 *         raise _TargetParserResult(parse_result)
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_python_target, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_parse_result = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":168
 *                 raise exc[0], exc[1], exc[2]
 *         parse_result = self._python_target.close()
 *         raise _TargetParserResult(parse_result)             # <<<<<<<<<<<<<<
 */
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_TargetParserResult); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_parse_result);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_parse_result);
  __Pyx_GIVEREF(__pyx_v_parse_result);
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  {__pyx_filename = __pyx_f[13]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":145
 *         return self._python_target.close()
 * 
 *     cdef xmlDoc* _handleParseResultDoc(self, _BaseParser parser,             # <<<<<<<<<<<<<<
 *                                        xmlDoc* result, filename) except NULL:
 *         cdef bint recover
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("lxml.etree._TargetParserContext._handleParseResultDoc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XDECREF(__pyx_v_parse_result);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":15
 *     OUTPUT_METHOD_TEXT
 * 
 * cdef int _findOutputMethod(method) except -1:             # <<<<<<<<<<<<<<
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 */

static int __pyx_f_4lxml_5etree__findOutputMethod(PyObject *__pyx_v_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findOutputMethod", 0);
  __Pyx_INCREF(__pyx_v_method);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":16
 * 
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 */
  __pyx_t_1 = (__pyx_v_method == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":17
 * cdef int _findOutputMethod(method) except -1:
 *     if method is None:
 *         return OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 *     method = method.lower()
 *     if method == "xml":
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":18
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()             # <<<<<<<<<<<<<<
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":19
 *         return OUTPUT_METHOD_XML
 *     method = method.lower()
 *     if method == "xml":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_xml, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":20
 *     method = method.lower()
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML             # <<<<<<<<<<<<<<
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":21
 *     if method == "xml":
 *         return OUTPUT_METHOD_XML
 *     if method == "html":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_html, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":22
 *         return OUTPUT_METHOD_XML
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML             # <<<<<<<<<<<<<<
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":23
 *     if method == "html":
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":             # <<<<<<<<<<<<<<
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(u"unknown output method %r" % method)
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_text, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":24
 *         return OUTPUT_METHOD_HTML
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT             # <<<<<<<<<<<<<<
 *     raise ValueError(u"unknown output method %r" % method)
 * 
 */
    __pyx_r = __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":25
 *     if method == "text":
 *         return OUTPUT_METHOD_TEXT
 *     raise ValueError(u"unknown output method %r" % method)             # <<<<<<<<<<<<<<
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):
 */
  __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_unknown_output_method_r, __pyx_v_method); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 25; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  {__pyx_filename = __pyx_f[7]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":15
 *     OUTPUT_METHOD_TEXT
 * 
 * cdef int _findOutputMethod(method) except -1:             # <<<<<<<<<<<<<<
 *     if method is None:
 *         return OUTPUT_METHOD_XML
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._findOutputMethod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":27
 *     raise ValueError(u"unknown output method %r" % method)
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):             # <<<<<<<<<<<<<<
 *     cdef bint needs_conversion
 *     cdef const_xmlChar* c_text
 */

static PyObject *__pyx_f_4lxml_5etree__textToString(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_encoding, int __pyx_v_with_tail) {
  int __pyx_v_needs_conversion;
  const xmlChar *__pyx_v_c_text;
  xmlNode *__pyx_v_c_text_node;
  xmlBuffer *__pyx_v_c_buffer;
  int __pyx_v_error_result;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_textToString", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":34
 *     cdef int error_result
 * 
 *     c_buffer = tree.xmlBufferCreate()             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         raise MemoryError()
 */
  __pyx_v_c_buffer = xmlBufferCreate();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":35
 * 
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
  __pyx_t_1 = ((__pyx_v_c_buffer == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":36
 *     c_buffer = tree.xmlBufferCreate()
 *     if c_buffer is NULL:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":38
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":39
 * 
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)             # <<<<<<<<<<<<<<
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)
 */
        __pyx_v_error_result = xmlNodeBufGetContent(__pyx_v_c_buffer, __pyx_v_c_node);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":40
 *     with nogil:
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:             # <<<<<<<<<<<<<<
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
 */
        __pyx_t_1 = (__pyx_v_with_tail != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":41
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)             # <<<<<<<<<<<<<<
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 */
          __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_node->next);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":42
 *         if with_tail:
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 */
          while (1) {
            __pyx_t_1 = ((__pyx_v_c_text_node != NULL) != 0);
            if (!__pyx_t_1) break;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":43
 *             c_text_node = _textNodeOrSkip(c_node.next)
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)             # <<<<<<<<<<<<<<
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 *         c_text = tree.xmlBufferContent(c_buffer)
 */
            xmlBufferWriteChar(__pyx_v_c_buffer, ((const char *)__pyx_v_c_text_node->content));

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":44
 *             while c_text_node is not NULL:
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)             # <<<<<<<<<<<<<<
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 */
            __pyx_v_c_text_node = __pyx_f_4lxml_5etree__textNodeOrSkip(__pyx_v_c_text_node->next);
          }
          goto __pyx_L7;
        }
        __pyx_L7:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":45
 *                 tree.xmlBufferWriteChar(c_buffer, <const_char*>c_text_node.content)
 *                 c_text_node = _textNodeOrSkip(c_text_node.next)
 *         c_text = tree.xmlBufferContent(c_buffer)             # <<<<<<<<<<<<<<
 * 
 *     if error_result < 0 or c_text is NULL:
 */
        __pyx_v_c_text = xmlBufferContent(__pyx_v_c_buffer);
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":38
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlNodeBufGetContent(c_buffer, c_node)
 *         if with_tail:
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":47
 *         c_text = tree.xmlBufferContent(c_buffer)
 * 
 *     if error_result < 0 or c_text is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"
 */
  __pyx_t_1 = ((__pyx_v_error_result < 0) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_text == NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":48
 * 
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"
 * 
 */
    xmlBufferFree(__pyx_v_c_buffer);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":49
 *     if error_result < 0 or c_text is NULL:
 *         tree.xmlBufferFree(c_buffer)
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_SerialisationError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, __pyx_kp_u_Error_during_serialisation_out_o, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":51
 *         raise SerialisationError, u"Error during serialisation (out of memory?)"
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         needs_conversion = 0
 *         if encoding is _unicode:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":52
 * 
 *     try:
 *         needs_conversion = 0             # <<<<<<<<<<<<<<
 *         if encoding is _unicode:
 *             needs_conversion = 1
 */
    __pyx_v_needs_conversion = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":53
 *     try:
 *         needs_conversion = 0
 *         if encoding is _unicode:             # <<<<<<<<<<<<<<
 *             needs_conversion = 1
 *         elif encoding is not None:
 */
    __pyx_t_3 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":54
 *         needs_conversion = 0
 *         if encoding is _unicode:
 *             needs_conversion = 1             # <<<<<<<<<<<<<<
 *         elif encoding is not None:
 *             # Python prefers lower case encoding names
 */
      __pyx_v_needs_conversion = 1;
      goto __pyx_L14;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":55
 *         if encoding is _unicode:
 *             needs_conversion = 1
 *         elif encoding is not None:             # <<<<<<<<<<<<<<
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 */
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":57
 *         elif encoding is not None:
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()             # <<<<<<<<<<<<<<
 *             if encoding not in (u'utf8', u'utf-8'):
 *                 if encoding == u'ascii':
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":58
 *             # Python prefers lower case encoding names
 *             encoding = encoding.lower()
 *             if encoding not in (u'utf8', u'utf-8'):             # <<<<<<<<<<<<<<
 *                 if encoding == u'ascii':
 *                     if isutf8(c_text):
 */
      __Pyx_INCREF(__pyx_v_encoding);
      __pyx_t_5 = __pyx_v_encoding;
      __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_utf8, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      if (__pyx_t_3) {
        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_utf_8, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __pyx_t_2 = __pyx_t_1;
      } else {
        __pyx_t_2 = __pyx_t_3;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":59
 *             encoding = encoding.lower()
 *             if encoding not in (u'utf8', u'utf-8'):
 *                 if encoding == u'ascii':             # <<<<<<<<<<<<<<
 *                     if isutf8(c_text):
 *                         # will raise a decode error below
 */
        __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_encoding, __pyx_n_u_ascii, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":60
 *             if encoding not in (u'utf8', u'utf-8'):
 *                 if encoding == u'ascii':
 *                     if isutf8(c_text):             # <<<<<<<<<<<<<<
 *                         # will raise a decode error below
 *                         needs_conversion = 1
 */
          __pyx_t_3 = (__pyx_f_4lxml_5etree_isutf8(__pyx_v_c_text) != 0);
          if (__pyx_t_3) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":62
 *                     if isutf8(c_text):
 *                         # will raise a decode error below
 *                         needs_conversion = 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     needs_conversion = 1
 */
            __pyx_v_needs_conversion = 1;
            goto __pyx_L17;
          }
          __pyx_L17:;
          goto __pyx_L16;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":64
 *                         needs_conversion = 1
 *                 else:
 *                     needs_conversion = 1             # <<<<<<<<<<<<<<
 * 
 *         if needs_conversion:
 */
          __pyx_v_needs_conversion = 1;
        }
        __pyx_L16:;
        goto __pyx_L15;
      }
      __pyx_L15:;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":66
 *                     needs_conversion = 1
 * 
 *         if needs_conversion:             # <<<<<<<<<<<<<<
 *             text = python.PyUnicode_DecodeUTF8(
 *                 <const_char*>c_text, tree.xmlBufferLength(c_buffer), 'strict')
 */
    __pyx_t_3 = (__pyx_v_needs_conversion != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":67
 * 
 *         if needs_conversion:
 *             text = python.PyUnicode_DecodeUTF8(             # <<<<<<<<<<<<<<
 *                 <const_char*>c_text, tree.xmlBufferLength(c_buffer), 'strict')
 *             if encoding is not _unicode:
 */
      __pyx_t_5 = PyUnicode_DecodeUTF8(((const char *)__pyx_v_c_text), xmlBufferLength(__pyx_v_c_buffer), __pyx_k_strict); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_text = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":69
 *             text = python.PyUnicode_DecodeUTF8(
 *                 <const_char*>c_text, tree.xmlBufferLength(c_buffer), 'strict')
 *             if encoding is not _unicode:             # <<<<<<<<<<<<<<
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 */
      __pyx_t_3 = (__pyx_v_encoding != __pyx_v_4lxml_5etree__unicode);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":70
 *                 <const_char*>c_text, tree.xmlBufferLength(c_buffer), 'strict')
 *             if encoding is not _unicode:
 *                 encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')
 */
        __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":72
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(
 *                     text, encoding, 'strict')             # <<<<<<<<<<<<<<
 *         else:
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]
 */
        __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L12_error;}

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":71
 *             if encoding is not _unicode:
 *                 encoding = _utf8(encoding)
 *                 text = python.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *                     text, encoding, 'strict')
 *         else:
 */
        __pyx_t_5 = PyUnicode_AsEncodedString(__pyx_v_text, __pyx_t_6, __pyx_k_strict); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_5);
        __pyx_t_5 = 0;
        goto __pyx_L19;
      }
      __pyx_L19:;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":74
 *                     text, encoding, 'strict')
 *         else:
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 */
      __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_c_text)) + 0, xmlBufferLength(__pyx_v_c_buffer) - 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_text = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_L18:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":76
 *             text = (<unsigned char*>c_text)[:tree.xmlBufferLength(c_buffer)]
 *     finally:
 *         tree.xmlBufferFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return text
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlBufferFree(__pyx_v_c_buffer);
      goto __pyx_L13;
    }
    /*exception exit:*/{
      __pyx_L12_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        xmlBufferFree(__pyx_v_c_buffer);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L13:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":77
 *     finally:
 *         tree.xmlBufferFree(c_buffer)
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":27
 *     raise ValueError(u"unknown output method %r" % method)
 * 
 * cdef _textToString(xmlNode* c_node, encoding, bint with_tail):             # <<<<<<<<<<<<<<
 *     cdef bint needs_conversion
 *     cdef const_xmlChar* c_text
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._textToString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":80
 * 
 * 
 * cdef _tostring(_Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                bint write_xml_declaration, bint write_complete_document,
 *                bint pretty_print, bint with_tail, int standalone):
 */

static PyObject *__pyx_f_4lxml_5etree__tostring(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_encoding, PyObject *__pyx_v_doctype, PyObject *__pyx_v_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_complete_document, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlBuf *__pyx_v_c_result_buffer;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  const char *__pyx_v_c_enc;
  const xmlChar *__pyx_v_c_doctype;
  int __pyx_v_c_method;
  int __pyx_v_error_result;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  xmlBuf *__pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tostring", 0);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":94
 *     cdef int c_method
 *     cdef int error_result
 *     if element is None:             # <<<<<<<<<<<<<<
 *         return None
 *     _assertValidNode(element)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_element) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":95
 *     cdef int error_result
 *     if element is None:
 *         return None             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":96
 *     if element is None:
 *         return None
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":97
 *         return None
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_method = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":98
 *     _assertValidNode(element)
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is _unicode:
 */
  __pyx_t_2 = ((__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":99
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)             # <<<<<<<<<<<<<<
 *     if encoding is None or encoding is _unicode:
 *         c_enc = NULL
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":100
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is _unicode:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
 */
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  if (!(__pyx_t_2 != 0)) {
    __pyx_t_1 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
    __pyx_t_5 = (__pyx_t_1 != 0);
  } else {
    __pyx_t_5 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":101
 *         return _textToString(element._c_node, encoding, with_tail)
 *     if encoding is None or encoding is _unicode:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
 */
    __pyx_v_c_enc = NULL;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":103
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":104
 *     else:
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)             # <<<<<<<<<<<<<<
 *     if doctype is None:
 *         c_doctype = NULL
 */
    __pyx_v_c_enc = PyBytes_AS_STRING(__pyx_v_encoding);
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":105
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
  __pyx_t_5 = (__pyx_v_doctype == Py_None);
  __pyx_t_2 = (__pyx_t_5 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":106
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
 */
    __pyx_v_c_doctype = NULL;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":108
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _xcstr(doctype)
 *     # it is necessary to *and* find the encoding handler *and* use
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":109
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _xcstr(doctype)             # <<<<<<<<<<<<<<
 *     # it is necessary to *and* find the encoding handler *and* use
 *     # encoding during output
 */
    __pyx_v_c_doctype = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":112
 *     # it is necessary to *and* find the encoding handler *and* use
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":113
 *     # encoding during output
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:             # <<<<<<<<<<<<<<
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')
 */
  __pyx_t_2 = ((__pyx_v_enchandler == NULL) != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = ((__pyx_v_c_enc != NULL) != 0);
    __pyx_t_1 = __pyx_t_5;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":114
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:             # <<<<<<<<<<<<<<
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 */
    __pyx_t_1 = (__pyx_v_encoding != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":115
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":116
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding             # <<<<<<<<<<<<<<
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 */
    __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_encoding_s, __pyx_v_encoding); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_Raise(__pyx_builtin_LookupError, __pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":117
 *             encoding = encoding.decode('UTF-8')
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
  __pyx_v_c_buffer = xmlAllocOutputBuffer(__pyx_v_enchandler);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":118
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()
 */
  __pyx_t_2 = ((__pyx_v_c_buffer == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":119
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
    xmlCharEncCloseFunc(__pyx_v_enchandler);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":120
 *     if c_buffer is NULL:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     with nogil:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":122
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":123
 * 
 *     with nogil:
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,             # <<<<<<<<<<<<<<
 *                            write_xml_declaration, write_complete_document,
 *                            pretty_print, with_tail, standalone)
 */
        __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_c_buffer, __pyx_v_element->_c_node, __pyx_v_c_enc, __pyx_v_c_doctype, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_complete_document, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":126
 *                            write_xml_declaration, write_complete_document,
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)             # <<<<<<<<<<<<<<
 *         if c_buffer.conv is not NULL:
 *             c_result_buffer = c_buffer.conv
 */
        xmlOutputBufferFlush(__pyx_v_c_buffer);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":127
 *                            pretty_print, with_tail, standalone)
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:             # <<<<<<<<<<<<<<
 *             c_result_buffer = c_buffer.conv
 *         else:
 */
        __pyx_t_2 = ((__pyx_v_c_buffer->conv != NULL) != 0);
        if (__pyx_t_2) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":128
 *         tree.xmlOutputBufferFlush(c_buffer)
 *         if c_buffer.conv is not NULL:
 *             c_result_buffer = c_buffer.conv             # <<<<<<<<<<<<<<
 *         else:
 *             c_result_buffer = c_buffer.buffer
 */
          __pyx_t_7 = __pyx_v_c_buffer->conv;
          __pyx_v_c_result_buffer = __pyx_t_7;
          goto __pyx_L13;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":130
 *             c_result_buffer = c_buffer.conv
 *         else:
 *             c_result_buffer = c_buffer.buffer             # <<<<<<<<<<<<<<
 * 
 *     error_result = c_buffer.error
 */
          __pyx_t_7 = __pyx_v_c_buffer->buffer;
          __pyx_v_c_result_buffer = __pyx_t_7;
        }
        __pyx_L13:;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":122
 *         raise MemoryError()
 * 
 *     with nogil:             # <<<<<<<<<<<<<<
 *         _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 *                            write_xml_declaration, write_complete_document,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L12;
        }
        __pyx_L12:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":132
 *             c_result_buffer = c_buffer.buffer
 * 
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 */
  __pyx_t_3 = __pyx_v_c_buffer->error;
  __pyx_v_error_result = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":133
 * 
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)
 */
  __pyx_t_2 = ((__pyx_v_error_result != XML_ERR_OK) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":134
 *     error_result = c_buffer.error
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
 */
    xmlOutputBufferClose(__pyx_v_c_buffer);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":135
 *     if error_result != xmlerror.XML_ERR_OK:
 *         tree.xmlOutputBufferClose(c_buffer)
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":137
 *         _raiseSerialisationError(error_result)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         if encoding is _unicode:
 *             result = (<unsigned char*>tree.xmlBufContent(
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":138
 * 
 *     try:
 *         if encoding is _unicode:             # <<<<<<<<<<<<<<
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
 */
    __pyx_t_2 = (__pyx_v_encoding == __pyx_v_4lxml_5etree__unicode);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":140
 *         if encoding is _unicode:
 *             result = (<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')             # <<<<<<<<<<<<<<
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(
 */
      __pyx_t_6 = __Pyx_decode_c_string(((char *)((unsigned char *)xmlBufContent(__pyx_v_c_result_buffer))), 0, xmlBufUse(__pyx_v_c_result_buffer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_result = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":143
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]             # <<<<<<<<<<<<<<
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 */
      __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)xmlBufContent(__pyx_v_c_result_buffer))) + 0, xmlBufUse(__pyx_v_c_result_buffer) - 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":142
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
 *         else:
 *             result = <bytes>(<unsigned char*>tree.xmlBufContent(             # <<<<<<<<<<<<<<
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
 *     finally:
 */
      __pyx_t_4 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_result = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L18:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":145
 *                 c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     if error_result < 0:
 *         _raiseSerialisationError(error_result)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
      goto __pyx_L17;
    }
    /*exception exit:*/{
      __pyx_L16_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_3 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L17:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":146
 *     finally:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result < 0:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 *     return result
 */
  __pyx_t_1 = ((__pyx_v_error_result < 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":147
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *     if error_result < 0:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L21;
  }
  __pyx_L21:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":148
 *     if error_result < 0:
 *         _raiseSerialisationError(error_result)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":80
 * 
 * 
 * cdef _tostring(_Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                bint write_xml_declaration, bint write_complete_document,
 *                bint pretty_print, bint with_tail, int standalone):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":150
 *     return result
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL
 */

static PyObject *__pyx_f_4lxml_5etree__tostringC14N(PyObject *__pyx_v_element_or_tree, int __pyx_v_exclusive, int __pyx_v_with_comments, PyObject *__pyx_v_inclusive_ns_prefixes) {
  xmlDoc *__pyx_v_c_doc;
  xmlChar *__pyx_v_c_buffer;
  int __pyx_v_byte_count;
  PyObject *__pyx_v_result = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlChar **__pyx_v_c_inclusive_ns_prefixes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  xmlDoc *__pyx_t_5;
  xmlChar **__pyx_t_6;
  xmlChar **__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tostringC14N", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":152
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL             # <<<<<<<<<<<<<<
 *     cdef int byte_count = -1
 *     cdef bytes result
 */
  __pyx_v_c_buffer = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":153
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL
 *     cdef int byte_count = -1             # <<<<<<<<<<<<<<
 *     cdef bytes result
 *     cdef _Document doc
 */
  __pyx_v_byte_count = -1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":159
 *     cdef xmlChar **c_inclusive_ns_prefixes
 * 
 *     if isinstance(element_or_tree, _Element):             # <<<<<<<<<<<<<<
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_element_or_tree, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":160
 * 
 *     if isinstance(element_or_tree, _Element):
 *         _assertValidNode(<_Element>element_or_tree)             # <<<<<<<<<<<<<<
 *         doc = (<_Element>element_or_tree)._doc
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_element_or_tree)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":161
 *     if isinstance(element_or_tree, _Element):
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc             # <<<<<<<<<<<<<<
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 *     else:
 */
    __pyx_t_4 = ((PyObject *)((struct LxmlElement *)__pyx_v_element_or_tree)->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":162
 *         _assertValidNode(<_Element>element_or_tree)
 *         doc = (<_Element>element_or_tree)._doc
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)             # <<<<<<<<<<<<<<
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__plainFakeRootDoc(__pyx_v_doc->_c_doc, ((struct LxmlElement *)__pyx_v_element_or_tree)->_c_node, 0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_doc = __pyx_t_5;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":164
 *         c_doc = _plainFakeRootDoc(doc._c_doc, (<_Element>element_or_tree)._c_node, 0)
 *     else:
 *         doc = _documentOrRaise(element_or_tree)             # <<<<<<<<<<<<<<
 *         _assertValidDoc(doc)
 *         c_doc = doc._c_doc
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":165
 *     else:
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)             # <<<<<<<<<<<<<<
 *         c_doc = doc._c_doc
 * 
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__assertValidDoc(__pyx_v_doc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":166
 *         doc = _documentOrRaise(element_or_tree)
 *         _assertValidDoc(doc)
 *         c_doc = doc._c_doc             # <<<<<<<<<<<<<<
 * 
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 */
    __pyx_t_5 = __pyx_v_doc->_c_doc;
    __pyx_v_c_doc = __pyx_t_5;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":168
 *         c_doc = doc._c_doc
 * 
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL             # <<<<<<<<<<<<<<
 *     try:
 *          with nogil:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __pyx_t_7 = __pyx_f_4lxml_5etree__convert_ns_prefixes(__pyx_v_c_doc->dict, __pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = NULL;
  }
  __pyx_v_c_inclusive_ns_prefixes = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":169
 * 
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 *     try:             # <<<<<<<<<<<<<<
 *          with nogil:
 *              byte_count = c14n.xmlC14NDocDumpMemory(
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":170
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 *     try:
 *          with nogil:             # <<<<<<<<<<<<<<
 *              byte_count = c14n.xmlC14NDocDumpMemory(
 *                  c_doc, NULL, exclusive, c_inclusive_ns_prefixes, with_comments, &c_buffer)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":171
 *     try:
 *          with nogil:
 *              byte_count = c14n.xmlC14NDocDumpMemory(             # <<<<<<<<<<<<<<
 *                  c_doc, NULL, exclusive, c_inclusive_ns_prefixes, with_comments, &c_buffer)
 * 
 */
          __pyx_v_byte_count = xmlC14NDocDumpMemory(__pyx_v_c_doc, NULL, __pyx_v_exclusive, __pyx_v_c_inclusive_ns_prefixes, __pyx_v_with_comments, (&__pyx_v_c_buffer));
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":170
 *     c_inclusive_ns_prefixes = _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes) if inclusive_ns_prefixes else NULL
 *     try:
 *          with nogil:             # <<<<<<<<<<<<<<
 *              byte_count = c14n.xmlC14NDocDumpMemory(
 *                  c_doc, NULL, exclusive, c_inclusive_ns_prefixes, with_comments, &c_buffer)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":175
 * 
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *          if c_inclusive_ns_prefixes is not NULL:
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":176
 *     finally:
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 * 
 */
      __pyx_t_2 = ((__pyx_v_c_inclusive_ns_prefixes != NULL) != 0);
      if (__pyx_t_2) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":177
 *          _destroyFakeDoc(doc._c_doc, c_doc)
 *          if c_inclusive_ns_prefixes is not NULL:
 *             python.PyMem_Free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 */
        PyMem_Free(__pyx_v_c_inclusive_ns_prefixes);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":179
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 * 
 *     if byte_count < 0 or c_buffer is NULL:             # <<<<<<<<<<<<<<
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 */
  __pyx_t_2 = ((__pyx_v_byte_count < 0) != 0);
  if (!__pyx_t_2) {
    __pyx_t_1 = ((__pyx_v_c_buffer == NULL) != 0);
    __pyx_t_8 = __pyx_t_1;
  } else {
    __pyx_t_8 = __pyx_t_2;
  }
  if (__pyx_t_8) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":180
 * 
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, u"C14N failed"
 */
    __pyx_t_8 = ((__pyx_v_c_buffer != NULL) != 0);
    if (__pyx_t_8) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":181
 *     if byte_count < 0 or c_buffer is NULL:
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *         raise C14NError, u"C14N failed"
 *     try:
 */
      xmlFree(__pyx_v_c_buffer);
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":182
 *         if c_buffer is not NULL:
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, u"C14N failed"             # <<<<<<<<<<<<<<
 *     try:
 *         result = c_buffer[:byte_count]
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C14NError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, __pyx_kp_u_C14N_failed, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":183
 *             tree.xmlFree(c_buffer)
 *         raise C14NError, u"C14N failed"
 *     try:             # <<<<<<<<<<<<<<
 *         result = c_buffer[:byte_count]
 *     finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":184
 *         raise C14NError, u"C14N failed"
 *     try:
 *         result = c_buffer[:byte_count]             # <<<<<<<<<<<<<<
 *     finally:
 *         tree.xmlFree(c_buffer)
 */
    __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_c_buffer) + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_result = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":186
 *         result = c_buffer[:byte_count]
 *     finally:
 *         tree.xmlFree(c_buffer)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_c_buffer);
      goto __pyx_L15;
    }
    /*exception exit:*/{
      __pyx_L14_error:;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_3 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        xmlFree(__pyx_v_c_buffer);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
    }
    __pyx_L15:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":187
 *     finally:
 *         tree.xmlFree(c_buffer)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _raiseSerialisationError(int error_result):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":150
 *     return result
 * 
 * cdef bytes _tostringC14N(element_or_tree, bint exclusive, bint with_comments, inclusive_ns_prefixes):             # <<<<<<<<<<<<<<
 *     cdef xmlDoc* c_doc
 *     cdef xmlChar* c_buffer = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._tostringC14N", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":189
 *     return result
 * 
 * cdef _raiseSerialisationError(int error_result):             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
 */

static PyObject *__pyx_f_4lxml_5etree__raiseSerialisationError(int __pyx_v_error_result) {
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raiseSerialisationError", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":190
 * 
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 */
  __pyx_t_1 = ((__pyx_v_error_result == XML_ERR_NO_MEMORY) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":191
 * cdef _raiseSerialisationError(int error_result):
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":192
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)             # <<<<<<<<<<<<<<
 *     if message is None:
 *         message = u"unknown error %d" % error_result
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getName); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_error_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __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[7]; __pyx_lineno = 192; __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 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __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_4); __pyx_t_4 = 0;
  __pyx_v_message = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":193
 *         raise MemoryError()
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:             # <<<<<<<<<<<<<<
 *         message = u"unknown error %d" % error_result
 *     raise SerialisationError, message
 */
  __pyx_t_1 = (__pyx_v_message == Py_None);
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":194
 *     message = ErrorTypes._getName(error_result)
 *     if message is None:
 *         message = u"unknown error %d" % error_result             # <<<<<<<<<<<<<<
 *     raise SerialisationError, message
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_error_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_unknown_error_d, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":195
 *     if message is None:
 *         message = u"unknown error %d" % error_result
 *     raise SerialisationError, message             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_SerialisationError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_Raise(__pyx_t_4, __pyx_v_message, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  {__pyx_filename = __pyx_f[7]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":189
 *     return result
 * 
 * cdef _raiseSerialisationError(int error_result):             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_NO_MEMORY:
 *         raise MemoryError()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._raiseSerialisationError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":200
 * # low-level serialisation functions
 * 
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_doctype) nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
 */

static void __pyx_f_4lxml_5etree__writeDoctype(xmlOutputBuffer *__pyx_v_c_buffer, const xmlChar *__pyx_v_c_doctype) {

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":202
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,
 *                         const_xmlChar* c_doctype) nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),             # <<<<<<<<<<<<<<
 *                               <const_char*>c_doctype)
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, xmlStrlen(__pyx_v_c_doctype), ((const char *)__pyx_v_c_doctype));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":204
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
 *                               <const_char*>c_doctype)
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k__21);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":200
 * # low-level serialisation functions
 * 
 * cdef void _writeDoctype(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                         const_xmlChar* c_doctype) nogil:
 *     tree.xmlOutputBufferWrite(c_buffer, tree.xmlStrlen(c_doctype),
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":206
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                              xmlNode* c_node, const_char* encoding, const_xmlChar* c_doctype,
 *                              int c_method, bint write_xml_declaration,
 */

static void __pyx_f_4lxml_5etree__writeNodeToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, const xmlChar *__pyx_v_c_doctype, int __pyx_v_c_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_complete_document, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone) {
  xmlNode *__pyx_v_c_nsdecl_node;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlNode *__pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":213
 *                              int standalone) nogil:
 *     cdef xmlNode* c_nsdecl_node
 *     cdef xmlDoc* c_doc = c_node.doc             # <<<<<<<<<<<<<<
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 */
  __pyx_t_1 = __pyx_v_c_node->doc;
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":214
 *     cdef xmlNode* c_nsdecl_node
 *     cdef xmlDoc* c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:             # <<<<<<<<<<<<<<
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 *     if c_doctype:
 */
  if ((__pyx_v_write_xml_declaration != 0)) {
    __pyx_t_2 = ((__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_v_write_xml_declaration != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":215
 *     cdef xmlDoc* c_doc = c_node.doc
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)             # <<<<<<<<<<<<<<
 *     if c_doctype:
 *         _writeDoctype(c_buffer, c_doctype)
 */
    __pyx_f_4lxml_5etree__writeDeclarationToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc->version, __pyx_v_encoding, __pyx_v_standalone);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":216
 *     if write_xml_declaration and c_method == OUTPUT_METHOD_XML:
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 *     if c_doctype:             # <<<<<<<<<<<<<<
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
 */
  __pyx_t_3 = (__pyx_v_c_doctype != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":217
 *         _writeDeclarationToBuffer(c_buffer, c_doc.version, encoding, standalone)
 *     if c_doctype:
 *         _writeDoctype(c_buffer, c_doctype)             # <<<<<<<<<<<<<<
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:
 */
    __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_c_buffer, __pyx_v_c_doctype);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":219
 *         _writeDoctype(c_buffer, c_doctype)
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)
 */
  if ((__pyx_v_write_complete_document != 0)) {
    __pyx_t_3 = ((!(__pyx_v_c_buffer->error != 0)) != 0);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = (__pyx_v_write_complete_document != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":220
 *     # write internal DTD subset, preceding PIs/comments, etc.
 *     if write_complete_document and not c_buffer.error:
 *         if c_doctype is NULL:             # <<<<<<<<<<<<<<
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 */
    __pyx_t_2 = ((__pyx_v_c_doctype == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":221
 *     if write_complete_document and not c_buffer.error:
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)             # <<<<<<<<<<<<<<
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 * 
 */
      __pyx_f_4lxml_5etree__writeDtdToBuffer(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_node->name, __pyx_v_encoding);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":222
 *         if c_doctype is NULL:
 *             _writeDtdToBuffer(c_buffer, c_doc, c_node.name, encoding)
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 * 
 *     c_nsdecl_node = c_node
 */
    __pyx_f_4lxml_5etree__writePrevSiblings(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":224
 *         _writePrevSiblings(c_buffer, c_node, encoding, pretty_print)
 * 
 *     c_nsdecl_node = c_node             # <<<<<<<<<<<<<<
 *     if not c_node.parent or c_node.parent.type != tree.XML_DOCUMENT_NODE:
 *         # copy the node and add namespaces from parents
 */
  __pyx_v_c_nsdecl_node = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":225
 * 
 *     c_nsdecl_node = c_node
 *     if not c_node.parent or c_node.parent.type != tree.XML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
 */
  __pyx_t_2 = ((!(__pyx_v_c_node->parent != 0)) != 0);
  if (!__pyx_t_2) {
    __pyx_t_3 = ((__pyx_v_c_node->parent->type != XML_DOCUMENT_NODE) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":228
 *         # copy the node and add namespaces from parents
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)             # <<<<<<<<<<<<<<
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 */
    __pyx_v_c_nsdecl_node = xmlCopyNode(__pyx_v_c_node, 2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":229
 *         # this is required to make libxml write them
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if not c_nsdecl_node:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 */
    __pyx_t_4 = ((!(__pyx_v_c_nsdecl_node != 0)) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":230
 *         c_nsdecl_node = tree.xmlCopyNode(c_node, 2)
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY             # <<<<<<<<<<<<<<
 *             return
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 */
      __pyx_v_c_buffer->error = XML_ERR_NO_MEMORY;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":231
 *         if not c_nsdecl_node:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return             # <<<<<<<<<<<<<<
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
 */
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":232
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 *         _copyParentNamespaces(c_node, c_nsdecl_node)             # <<<<<<<<<<<<<<
 * 
 *         c_nsdecl_node.parent = c_node.parent
 */
    __pyx_f_4lxml_5etree__copyParentNamespaces(__pyx_v_c_node, __pyx_v_c_nsdecl_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":234
 *         _copyParentNamespaces(c_node, c_nsdecl_node)
 * 
 *         c_nsdecl_node.parent = c_node.parent             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.children = c_node.children
 *         c_nsdecl_node.last = c_node.last
 */
    __pyx_t_5 = __pyx_v_c_node->parent;
    __pyx_v_c_nsdecl_node->parent = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":235
 * 
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children             # <<<<<<<<<<<<<<
 *         c_nsdecl_node.last = c_node.last
 * 
 */
    __pyx_t_5 = __pyx_v_c_node->children;
    __pyx_v_c_nsdecl_node->children = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":236
 *         c_nsdecl_node.parent = c_node.parent
 *         c_nsdecl_node.children = c_node.children
 *         c_nsdecl_node.last = c_node.last             # <<<<<<<<<<<<<<
 * 
 *     # write node
 */
    __pyx_t_5 = __pyx_v_c_node->last;
    __pyx_v_c_nsdecl_node->last = __pyx_t_5;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":239
 * 
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *         tree.htmlNodeDumpFormatOutput(
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 */
  __pyx_t_4 = ((__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":240
 *     # write node
 *     if c_method == OUTPUT_METHOD_HTML:
 *         tree.htmlNodeDumpFormatOutput(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 *     else:
 */
    htmlNodeDumpFormatOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":243
 *             c_buffer, c_doc, c_nsdecl_node, encoding, pretty_print)
 *     else:
 *         tree.xmlNodeDumpOutput(             # <<<<<<<<<<<<<<
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_doc, __pyx_v_c_nsdecl_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":246
 *             c_buffer, c_doc, c_nsdecl_node, 0, pretty_print, encoding)
 * 
 *     if c_nsdecl_node is not c_node:             # <<<<<<<<<<<<<<
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
 */
  __pyx_t_4 = ((__pyx_v_c_nsdecl_node != __pyx_v_c_node) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":248
 *     if c_nsdecl_node is not c_node:
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL             # <<<<<<<<<<<<<<
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 */
    __pyx_v_c_nsdecl_node->children = NULL;
    __pyx_v_c_nsdecl_node->last = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":249
 *         # clean up
 *         c_nsdecl_node.children = c_nsdecl_node.last = NULL
 *         tree.xmlFreeNode(c_nsdecl_node)             # <<<<<<<<<<<<<<
 * 
 *     if c_buffer.error:
 */
    xmlFreeNode(__pyx_v_c_nsdecl_node);
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":251
 *         tree.xmlFreeNode(c_nsdecl_node)
 * 
 *     if c_buffer.error:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_4 = (__pyx_v_c_buffer->error != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":252
 * 
 *     if c_buffer.error:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # write tail, trailing comments, etc.
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":255
 * 
 *     # write tail, trailing comments, etc.
 *     if with_tail:             # <<<<<<<<<<<<<<
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
 */
  __pyx_t_4 = (__pyx_v_with_tail != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":256
 *     # write tail, trailing comments, etc.
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)             # <<<<<<<<<<<<<<
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 */
    __pyx_f_4lxml_5etree__writeTail(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_c_method, __pyx_v_pretty_print);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":257
 *     if with_tail:
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:             # <<<<<<<<<<<<<<
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
 */
  __pyx_t_4 = (__pyx_v_write_complete_document != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":258
 *         _writeTail(c_buffer, c_node, encoding, c_method, pretty_print)
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)             # <<<<<<<<<<<<<<
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 */
    __pyx_f_4lxml_5etree__writeNextSiblings(__pyx_v_c_buffer, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":259
 *     if write_complete_document:
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 */
  __pyx_t_4 = (__pyx_v_pretty_print != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":260
 *         _writeNextSiblings(c_buffer, c_node, encoding, pretty_print)
 *     if pretty_print:
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_k__21);
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":206
 *     tree.xmlOutputBufferWriteString(c_buffer, "\n")
 * 
 * cdef void _writeNodeToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                              xmlNode* c_node, const_char* encoding, const_xmlChar* c_doctype,
 *                              int c_method, bint write_xml_declaration,
 */

  /* function exit code */
  __pyx_L0:;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":262
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) nogil:
 */

static void __pyx_f_4lxml_5etree__writeDeclarationToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, const xmlChar *__pyx_v_version, const char *__pyx_v_encoding, int __pyx_v_standalone) {
  int __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":265
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) nogil:
 *     if version is NULL:             # <<<<<<<<<<<<<<
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 */
  __pyx_t_1 = ((__pyx_v_version == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":266
 *                                     int standalone) nogil:
 *     if version is NULL:
 *         version = <unsigned char*>"1.0"             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 */
    __pyx_v_version = ((unsigned char *)((unsigned char *)__pyx_k_1_0));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":267
 *     if version is NULL:
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 15, __pyx_k_xml_version);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":268
 *         version = <unsigned char*>"1.0"
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_version));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":269
 *     tree.xmlOutputBufferWrite(c_buffer, 15, "<?xml version='")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 12, __pyx_k_encoding_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":270
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>version)
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)             # <<<<<<<<<<<<<<
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_v_encoding);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":273
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 */
  switch (__pyx_v_standalone) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":271
 *     tree.xmlOutputBufferWrite(c_buffer, 12, "' encoding='")
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
 */
    case 0:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":272
 *     tree.xmlOutputBufferWriteString(c_buffer, encoding)
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")             # <<<<<<<<<<<<<<
 *     elif standalone == 1:
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 20, __pyx_k_standalone_no);
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":273
 *     if standalone == 0:
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 */
    case 1:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":274
 *         tree.xmlOutputBufferWrite(c_buffer, 20, "' standalone='no'?>\n")
 *     elif standalone == 1:
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 21, __pyx_k_standalone_yes);
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":276
 *         tree.xmlOutputBufferWrite(c_buffer, 21, "' standalone='yes'?>\n")
 *     else:
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 4, __pyx_k__51);
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":262
 *         tree.xmlOutputBufferWrite(c_buffer, 1, "\n")
 * 
 * cdef void _writeDeclarationToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                                     const_xmlChar* version, const_char* encoding,
 *                                     int standalone) nogil:
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":278
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, const_xmlChar* c_root_name,
 *                             const_char* encoding) nogil:
 */

static void __pyx_f_4lxml_5etree__writeDtdToBuffer(xmlOutputBuffer *__pyx_v_c_buffer, xmlDoc *__pyx_v_c_doc, const xmlChar *__pyx_v_c_root_name, const char *__pyx_v_encoding) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_node;
  xmlBuffer *__pyx_v_c_buf;
  xmlDtd *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  xmlNode *__pyx_t_8;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":283
 *     cdef tree.xmlDtd* c_dtd
 *     cdef xmlNode* c_node
 *     c_dtd = c_doc.intSubset             # <<<<<<<<<<<<<<
 *     if not c_dtd or not c_dtd.name:
 *         return
 */
  __pyx_t_1 = __pyx_v_c_doc->intSubset;
  __pyx_v_c_dtd = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":284
 *     cdef xmlNode* c_node
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:             # <<<<<<<<<<<<<<
 *         return
 *     if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 */
  __pyx_t_2 = ((!(__pyx_v_c_dtd != 0)) != 0);
  if (!__pyx_t_2) {
    __pyx_t_3 = ((!(__pyx_v_c_dtd->name != 0)) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":285
 *     c_dtd = c_doc.intSubset
 *     if not c_dtd or not c_dtd.name:
 *         return             # <<<<<<<<<<<<<<
 *     if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 *         return
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":286
 *     if not c_dtd or not c_dtd.name:
 *         return
 *     if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:             # <<<<<<<<<<<<<<
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 */
  __pyx_t_4 = ((xmlStrcmp(__pyx_v_c_root_name, __pyx_v_c_dtd->name) != 0) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":287
 *         return
 *     if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 *         return             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":288
 *     if tree.xmlStrcmp(c_root_name, c_dtd.name) != 0:
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 *     if c_dtd.SystemID and c_dtd.SystemID[0] != c'\0':
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 10, __pyx_k_DOCTYPE);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":289
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)             # <<<<<<<<<<<<<<
 *     if c_dtd.SystemID and c_dtd.SystemID[0] != c'\0':
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 */
  xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_c_dtd->name));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":290
 *     tree.xmlOutputBufferWrite(c_buffer, 10, "<!DOCTYPE ")
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 *     if c_dtd.SystemID and c_dtd.SystemID[0] != c'\0':             # <<<<<<<<<<<<<<
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 */
  if ((__pyx_v_c_dtd->SystemID != 0)) {
    __pyx_t_4 = (((__pyx_v_c_dtd->SystemID[0]) != '\x00') != 0);
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = (__pyx_v_c_dtd->SystemID != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":291
 *     tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.name)
 *     if c_dtd.SystemID and c_dtd.SystemID[0] != c'\0':
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *             tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.ExternalID)
 */
    __pyx_t_2 = ((__pyx_v_c_dtd->ExternalID != NULL) != 0);
    if (__pyx_t_2) {
      __pyx_t_4 = (((__pyx_v_c_dtd->ExternalID[0]) != '\x00') != 0);
      __pyx_t_3 = __pyx_t_4;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":292
 *     if c_dtd.SystemID and c_dtd.SystemID[0] != c'\0':
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.ExternalID)
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')
 */
      xmlOutputBufferWrite(__pyx_v_c_buffer, 9, __pyx_k_PUBLIC);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":293
 *         if c_dtd.ExternalID != NULL and c_dtd.ExternalID[0] != c'\0':
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *             tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')
 *         else:
 */
      xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_c_dtd->ExternalID));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":294
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' PUBLIC "')
 *             tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.ExternalID)
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')
 */
      xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k__52);
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":296
 *             tree.xmlOutputBufferWrite(c_buffer, 3, '" "')
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.SystemID)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 */
      xmlOutputBufferWrite(__pyx_v_c_buffer, 9, __pyx_k_SYSTEM);
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":297
 *         else:
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.SystemID)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     if not c_dtd.entities and not c_dtd.elements and \
 */
    xmlOutputBufferWriteString(__pyx_v_c_buffer, ((const char *)__pyx_v_c_dtd->SystemID));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":298
 *             tree.xmlOutputBufferWrite(c_buffer, 9, ' SYSTEM "')
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.SystemID)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')             # <<<<<<<<<<<<<<
 *     if not c_dtd.entities and not c_dtd.elements and \
 *            not c_dtd.attributes and not c_dtd.notations and \
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 1, __pyx_k__53);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":299
 *         tree.xmlOutputBufferWriteString(c_buffer, <const_char*>c_dtd.SystemID)
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     if not c_dtd.entities and not c_dtd.elements and \             # <<<<<<<<<<<<<<
 *            not c_dtd.attributes and not c_dtd.notations and \
 *            not c_dtd.pentities:
 */
  __pyx_t_3 = ((!(__pyx_v_c_dtd->entities != 0)) != 0);
  if (__pyx_t_3) {
    __pyx_t_2 = ((!(__pyx_v_c_dtd->elements != 0)) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":300
 *         tree.xmlOutputBufferWrite(c_buffer, 1, '"')
 *     if not c_dtd.entities and not c_dtd.elements and \
 *            not c_dtd.attributes and not c_dtd.notations and \             # <<<<<<<<<<<<<<
 *            not c_dtd.pentities:
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 */
      __pyx_t_4 = ((!(__pyx_v_c_dtd->attributes != 0)) != 0);
      if (__pyx_t_4) {
        __pyx_t_5 = ((!(__pyx_v_c_dtd->notations != 0)) != 0);
        if (__pyx_t_5) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":301
 *     if not c_dtd.entities and not c_dtd.elements and \
 *            not c_dtd.attributes and not c_dtd.notations and \
 *            not c_dtd.pentities:             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return
 */
          __pyx_t_6 = ((!(__pyx_v_c_dtd->pentities != 0)) != 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;
      }
      __pyx_t_4 = __pyx_t_5;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":302
 *            not c_dtd.attributes and not c_dtd.notations and \
 *            not c_dtd.pentities:
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')             # <<<<<<<<<<<<<<
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, 2, __pyx_k__54);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":303
 *            not c_dtd.pentities:
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":304
 *         tree.xmlOutputBufferWrite(c_buffer, 2, '>\n')
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')             # <<<<<<<<<<<<<<
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k__55);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":305
 *         return
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
 */
  if ((__pyx_v_c_dtd->notations != 0)) {
    __pyx_t_2 = ((!(__pyx_v_c_buffer->error != 0)) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_v_c_dtd->notations != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":306
 *     tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()             # <<<<<<<<<<<<<<
 *         if not c_buf:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 */
    __pyx_v_c_buf = xmlBufferCreate();

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":307
 *     if c_dtd.notations and not c_buffer.error:
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:             # <<<<<<<<<<<<<<
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 */
    __pyx_t_3 = ((!(__pyx_v_c_buf != 0)) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":308
 *         c_buf = tree.xmlBufferCreate()
 *         if not c_buf:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY             # <<<<<<<<<<<<<<
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
 */
      __pyx_v_c_buffer->error = XML_ERR_NO_MEMORY;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":309
 *         if not c_buf:
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
 *         tree.xmlOutputBufferWrite(
 */
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":310
 *             c_buffer.error = xmlerror.XML_ERR_NO_MEMORY
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(
 *             c_buffer, tree.xmlBufferLength(c_buf),
 */
    xmlDumpNotationTable(__pyx_v_c_buf, ((xmlNotationTable *)__pyx_v_c_dtd->notations));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":311
 *             return
 *         tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
 *         tree.xmlOutputBufferWrite(             # <<<<<<<<<<<<<<
 *             c_buffer, tree.xmlBufferLength(c_buf),
 *             <const_char*>tree.xmlBufferContent(c_buf))
 */
    xmlOutputBufferWrite(__pyx_v_c_buffer, xmlBufferLength(__pyx_v_c_buf), ((const char *)xmlBufferContent(__pyx_v_c_buf)));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":314
 *             c_buffer, tree.xmlBufferLength(c_buf),
 *             <const_char*>tree.xmlBufferContent(c_buf))
 *         tree.xmlBufferFree(c_buf)             # <<<<<<<<<<<<<<
 *     c_node = c_dtd.children
 *     while c_node and not c_buffer.error:
 */
    xmlBufferFree(__pyx_v_c_buf);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":315
 *             <const_char*>tree.xmlBufferContent(c_buf))
 *         tree.xmlBufferFree(c_buf)
 *     c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 */
  __pyx_t_8 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_8;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":316
 *         tree.xmlBufferFree(c_buf)
 *     c_node = c_dtd.children
 *     while c_node and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next
 */
  while (1) {
    if ((__pyx_v_c_node != 0)) {
      __pyx_t_3 = ((!(__pyx_v_c_buffer->error != 0)) != 0);
      __pyx_t_2 = __pyx_t_3;
    } else {
      __pyx_t_2 = (__pyx_v_c_node != 0);
    }
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":317
 *     c_node = c_dtd.children
 *     while c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, 0, __pyx_v_encoding);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":318
 *     while c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 */
    __pyx_t_8 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_8;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":319
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_node, 0, 0, encoding)
 *         c_node = c_node.next
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
 */
  xmlOutputBufferWrite(__pyx_v_c_buffer, 3, __pyx_k__56);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":278
 *         tree.xmlOutputBufferWrite(c_buffer, 4, "'?>\n")
 * 
 * cdef void _writeDtdToBuffer(tree.xmlOutputBuffer* c_buffer,             # <<<<<<<<<<<<<<
 *                             xmlDoc* c_doc, const_xmlChar* c_root_name,
 *                             const_char* encoding) nogil:
 */

  /* function exit code */
  __pyx_L0:;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":321
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                      const_char* encoding, int c_method, bint pretty_print) nogil:
 *     u"Write the element tail."
 */

static void __pyx_f_4lxml_5etree__writeTail(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, int __pyx_v_c_method, int __pyx_v_pretty_print) {
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":324
 *                      const_char* encoding, int c_method, bint pretty_print) nogil:
 *     u"Write the element tail."
 *     c_node = c_node.next             # <<<<<<<<<<<<<<
 *     while c_node and c_node.type == tree.XML_TEXT_NODE and not c_buffer.error:
 *         if c_method == OUTPUT_METHOD_HTML:
 */
  __pyx_t_1 = __pyx_v_c_node->next;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":325
 *     u"Write the element tail."
 *     c_node = c_node.next
 *     while c_node and c_node.type == tree.XML_TEXT_NODE and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         if c_method == OUTPUT_METHOD_HTML:
 *             tree.htmlNodeDumpFormatOutput(
 */
  while (1) {
    if ((__pyx_v_c_node != 0)) {
      __pyx_t_2 = ((__pyx_v_c_node->type == XML_TEXT_NODE) != 0);
      if (__pyx_t_2) {
        __pyx_t_3 = ((!(__pyx_v_c_buffer->error != 0)) != 0);
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = (__pyx_v_c_node != 0);
    }
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":326
 *     c_node = c_node.next
 *     while c_node and c_node.type == tree.XML_TEXT_NODE and not c_buffer.error:
 *         if c_method == OUTPUT_METHOD_HTML:             # <<<<<<<<<<<<<<
 *             tree.htmlNodeDumpFormatOutput(
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
 */
    __pyx_t_2 = ((__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_HTML) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":327
 *     while c_node and c_node.type == tree.XML_TEXT_NODE and not c_buffer.error:
 *         if c_method == OUTPUT_METHOD_HTML:
 *             tree.htmlNodeDumpFormatOutput(             # <<<<<<<<<<<<<<
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
 *         else:
 */
      htmlNodeDumpFormatOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, __pyx_v_encoding, __pyx_v_pretty_print);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":330
 *                 c_buffer, c_node.doc, c_node, encoding, pretty_print)
 *         else:
 *             tree.xmlNodeDumpOutput(             # <<<<<<<<<<<<<<
 *                 c_buffer, c_node.doc, c_node, 0, pretty_print, encoding)
 *         c_node = c_node.next
 */
      xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_node, 0, __pyx_v_pretty_print, __pyx_v_encoding);
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":332
 *             tree.xmlNodeDumpOutput(
 *                 c_buffer, c_node.doc, c_node, 0, pretty_print, encoding)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
 */
    __pyx_t_1 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":321
 *     tree.xmlOutputBufferWrite(c_buffer, 3, "]>\n")
 * 
 * cdef void _writeTail(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                      const_char* encoding, int c_method, bint pretty_print) nogil:
 *     u"Write the element tail."
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":334
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 */

static void __pyx_f_4lxml_5etree__writePrevSiblings(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  xmlNode *__pyx_v_c_sibling;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":337
 *                              const_char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
 */
  if ((__pyx_v_c_node->parent != 0)) {
    __pyx_t_1 = (_isElement(__pyx_v_c_node->parent) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = (__pyx_v_c_node->parent != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":338
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):
 *         return             # <<<<<<<<<<<<<<
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":340
 *         return
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node             # <<<<<<<<<<<<<<
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 */
  __pyx_v_c_sibling = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":341
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node
 *     while c_sibling.prev and \             # <<<<<<<<<<<<<<
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    if ((__pyx_v_c_sibling->prev != 0)) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":342
 *     c_sibling = c_node
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 */
      switch (__pyx_v_c_sibling->prev->type) {
        case XML_PI_NODE:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":343
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.prev
 *     while c_sibling is not c_node and not c_buffer.error:
 */
        case XML_COMMENT_NODE:

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":342
 *     c_sibling = c_node
 *     while c_sibling.prev and \
 *             (c_sibling.prev.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 */
        __pyx_t_2 = 1;
        break;
        default:
        __pyx_t_2 = 0;
        break;
      }
      __pyx_t_1 = __pyx_t_2;
    } else {
      __pyx_t_1 = (__pyx_v_c_sibling->prev != 0);
    }
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":344
 *             (c_sibling.prev.type == tree.XML_PI_NODE or
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev             # <<<<<<<<<<<<<<
 *     while c_sibling is not c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 */
    __pyx_t_3 = __pyx_v_c_sibling->prev;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":345
 *              c_sibling.prev.type == tree.XML_COMMENT_NODE):
 *         c_sibling = c_sibling.prev
 *     while c_sibling is not c_node and not c_buffer.error:             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_c_sibling != __pyx_v_c_node) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((!(__pyx_v_c_buffer->error != 0)) != 0);
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":346
 *         c_sibling = c_sibling.prev
 *     while c_sibling is not c_node and not c_buffer.error:
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,             # <<<<<<<<<<<<<<
 *                                pretty_print, encoding)
 *         if pretty_print:
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_sibling, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":348
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next
 */
    __pyx_t_4 = (__pyx_v_pretty_print != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":349
 *                                pretty_print, encoding)
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         c_sibling = c_sibling.next
 * 
 */
      xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k__21);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":350
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
 */
    __pyx_t_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":334
 *         c_node = c_node.next
 * 
 * cdef void _writePrevSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 */

  /* function exit code */
  __pyx_L0:;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":352
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 */

static void __pyx_f_4lxml_5etree__writeNextSiblings(xmlOutputBuffer *__pyx_v_c_buffer, xmlNode *__pyx_v_c_node, const char *__pyx_v_encoding, int __pyx_v_pretty_print) {
  xmlNode *__pyx_v_c_sibling;
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":355
 *                              const_char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):             # <<<<<<<<<<<<<<
 *         return
 *     # we are at a root node, so add PI and comment siblings
 */
  if ((__pyx_v_c_node->parent != 0)) {
    __pyx_t_1 = (_isElement(__pyx_v_c_node->parent) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = (__pyx_v_c_node->parent != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":356
 *     cdef xmlNode* c_sibling
 *     if c_node.parent and _isElement(c_node.parent):
 *         return             # <<<<<<<<<<<<<<
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":358
 *         return
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next             # <<<<<<<<<<<<<<
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or
 */
  __pyx_t_3 = __pyx_v_c_node->next;
  __pyx_v_c_sibling = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":359
 *     # we are at a root node, so add PI and comment siblings
 *     c_sibling = c_node.next
 *     while not c_buffer.error and c_sibling and \             # <<<<<<<<<<<<<<
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 */
  while (1) {
    __pyx_t_2 = ((!(__pyx_v_c_buffer->error != 0)) != 0);
    if (__pyx_t_2) {
      if ((__pyx_v_c_sibling != 0)) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":360
 *     c_sibling = c_node.next
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
 */
        switch (__pyx_v_c_sibling->type) {
          case XML_PI_NODE:

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":361
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 */
          case XML_COMMENT_NODE:

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":360
 *     c_sibling = c_node.next
 *     while not c_buffer.error and c_sibling and \
 *             (c_sibling.type == tree.XML_PI_NODE or             # <<<<<<<<<<<<<<
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
 */
          __pyx_t_1 = 1;
          break;
          default:
          __pyx_t_1 = 0;
          break;
        }
        __pyx_t_4 = __pyx_t_1;
      } else {
        __pyx_t_4 = (__pyx_v_c_sibling != 0);
      }
      __pyx_t_1 = __pyx_t_4;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":362
 *             (c_sibling.type == tree.XML_PI_NODE or
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 */
    __pyx_t_1 = (__pyx_v_pretty_print != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":363
 *              c_sibling.type == tree.XML_COMMENT_NODE):
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")             # <<<<<<<<<<<<<<
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 */
      xmlOutputBufferWriteString(__pyx_v_c_buffer, __pyx_k__21);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":364
 *         if pretty_print:
 *             tree.xmlOutputBufferWriteString(c_buffer, "\n")
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,             # <<<<<<<<<<<<<<
 *                                pretty_print, encoding)
 *         c_sibling = c_sibling.next
 */
    xmlNodeDumpOutput(__pyx_v_c_buffer, __pyx_v_c_node->doc, __pyx_v_c_sibling, 0, __pyx_v_pretty_print, __pyx_v_encoding);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":366
 *         tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
 *                                pretty_print, encoding)
 *         c_sibling = c_sibling.next             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
    __pyx_t_3 = __pyx_v_c_sibling->next;
    __pyx_v_c_sibling = __pyx_t_3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":352
 *         c_sibling = c_sibling.next
 * 
 * cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                              const_char* encoding, bint pretty_print) nogil:
 *     cdef xmlNode* c_sibling
 */

  /* function exit code */
  __pyx_L0:;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":378
 *     cdef _ExceptionContext _exc_context
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None):             # <<<<<<<<<<<<<<
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_15_FilelikeWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_15_FilelikeWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filelike = 0;
  PyObject *__pyx_v_exc_context = 0;
  PyObject *__pyx_v_compression = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filelike,&__pyx_n_s_exc_context,&__pyx_n_s_compression,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filelike)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_context);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filelike = values[0];
    __pyx_v_exc_context = values[1];
    __pyx_v_compression = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_self), __pyx_v_filelike, __pyx_v_exc_context, __pyx_v_compression);

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

static int __pyx_pf_4lxml_5etree_15_FilelikeWriter___cinit__(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, PyObject *__pyx_v_filelike, PyObject *__pyx_v_exc_context, PyObject *__pyx_v_compression) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_filelike);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":379
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None):
 *         if compression is not None and compression > 0:             # <<<<<<<<<<<<<<
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 */
  __pyx_t_1 = (__pyx_v_compression != Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_compression, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __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) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":380
 *     def __cinit__(self, filelike, exc_context=None, compression=None):
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":381
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)             # <<<<<<<<<<<<<<
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fileobj, __pyx_v_filelike) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_mode, __pyx_n_s_wb) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_compresslevel, __pyx_v_compression) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":380
 *     def __cinit__(self, filelike, exc_context=None, compression=None):
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_GzipFile, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_filelike, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":382
 *             filelike = GzipFile(
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close             # <<<<<<<<<<<<<<
 *         self._filelike = filelike
 *         if exc_context is None:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_filelike, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_close_filelike);
    __Pyx_DECREF(__pyx_v_self->_close_filelike);
    __pyx_v_self->_close_filelike = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":383
 *                 fileobj=filelike, mode='wb', compresslevel=compression)
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike             # <<<<<<<<<<<<<<
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()
 */
  __Pyx_INCREF(__pyx_v_filelike);
  __Pyx_GIVEREF(__pyx_v_filelike);
  __Pyx_GOTREF(__pyx_v_self->_filelike);
  __Pyx_DECREF(__pyx_v_self->_filelike);
  __pyx_v_self->_filelike = __pyx_v_filelike;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":384
 *             self._close_filelike = filelike.close
 *         self._filelike = filelike
 *         if exc_context is None:             # <<<<<<<<<<<<<<
 *             self._exc_context = _ExceptionContext()
 *         else:
 */
  __pyx_t_4 = (__pyx_v_exc_context == Py_None);
  __pyx_t_1 = (__pyx_t_4 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":385
 *         self._filelike = filelike
 *         if exc_context is None:
 *             self._exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         else:
 *             self._exc_context = exc_context
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_exc_context);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_exc_context));
    __pyx_v_self->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":387
 *             self._exc_context = _ExceptionContext()
 *         else:
 *             self._exc_context = exc_context             # <<<<<<<<<<<<<<
 *         self.error_log = _ErrorLog()
 * 
 */
    if (!(likely(((__pyx_v_exc_context) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_exc_context, __pyx_ptype_4lxml_5etree__ExceptionContext))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __pyx_v_exc_context;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->_exc_context);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_exc_context));
    __pyx_v_self->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":388
 *         else:
 *             self._exc_context = exc_context
 *         self.error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(
 */
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->error_log));
  __pyx_v_self->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":378
 *     cdef _ExceptionContext _exc_context
 *     cdef _ErrorLog error_log
 *     def __cinit__(self, filelike, exc_context=None, compression=None):             # <<<<<<<<<<<<<<
 *         if compression is not None and compression > 0:
 *             filelike = GzipFile(
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filelike);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":390
 *         self.error_log = _ErrorLog()
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(             # <<<<<<<<<<<<<<
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
 */

static xmlOutputBuffer *__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, xmlCharEncodingHandler *__pyx_v_enchandler) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlOutputBuffer *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createOutputBuffer", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":393
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
 *         c_buffer = tree.xmlOutputBufferCreateIO(             # <<<<<<<<<<<<<<
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 */
  __pyx_v_c_buffer = xmlOutputBufferCreateIO(((xmlOutputWriteCallback)__pyx_f_4lxml_5etree__writeFilelikeWriter), __pyx_f_4lxml_5etree__closeFilelikeWriter, ((PyObject *)__pyx_v_self), __pyx_v_enchandler);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":396
 *             <tree.xmlOutputWriteCallback>_writeFilelikeWriter, _closeFilelikeWriter,
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError, u"Could not create I/O writer context."
 *         return c_buffer
 */
  __pyx_t_1 = ((__pyx_v_c_buffer == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":397
 *             <python.PyObject*>self, enchandler)
 *         if c_buffer is NULL:
 *             raise IOError, u"Could not create I/O writer context."             # <<<<<<<<<<<<<<
 *         return c_buffer
 * 
 */
    __Pyx_Raise(__pyx_builtin_IOError, __pyx_kp_u_Could_not_create_I_O_writer_cont, 0, 0);
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":398
 *         if c_buffer is NULL:
 *             raise IOError, u"Could not create I/O writer context."
 *         return c_buffer             # <<<<<<<<<<<<<<
 * 
 *     cdef int write(self, char* c_buffer, int size):
 */
  __pyx_r = __pyx_v_c_buffer;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":390
 *         self.error_log = _ErrorLog()
 * 
 *     cdef tree.xmlOutputBuffer* _createOutputBuffer(             # <<<<<<<<<<<<<<
 *         self, tree.xmlCharEncodingHandler* enchandler) except NULL:
 *         cdef tree.xmlOutputBuffer* c_buffer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._FilelikeWriter._createOutputBuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":400
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._filelike is None:
 */

static int __pyx_f_4lxml_5etree_15_FilelikeWriter_write(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self, char *__pyx_v_c_buffer, int __pyx_v_size) {
  PyObject *__pyx_v_py_buffer = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":401
 * 
 *     cdef int write(self, char* c_buffer, int size):
 *         try:             # <<<<<<<<<<<<<<
 *             if self._filelike is None:
 *                 raise IOError, u"File is already closed"
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":402
 *     cdef int write(self, char* c_buffer, int size):
 *         try:
 *             if self._filelike is None:             # <<<<<<<<<<<<<<
 *                 raise IOError, u"File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 */
        __pyx_t_4 = (__pyx_v_self->_filelike == Py_None);
        __pyx_t_5 = (__pyx_t_4 != 0);
        if (__pyx_t_5) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":403
 *         try:
 *             if self._filelike is None:
 *                 raise IOError, u"File is already closed"             # <<<<<<<<<<<<<<
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)
 */
          __Pyx_Raise(__pyx_builtin_IOError, __pyx_kp_u_File_is_already_closed, 0, 0);
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":404
 *             if self._filelike is None:
 *                 raise IOError, u"File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]             # <<<<<<<<<<<<<<
 *             self._filelike.write(py_buffer)
 *         except:
 */
        __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_c_buffer + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __pyx_t_6;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_py_buffer = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":405
 *                 raise IOError, u"File is already closed"
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)             # <<<<<<<<<<<<<<
 *         except:
 *             size = -1
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filelike, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_py_buffer);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_py_buffer);
        __Pyx_GIVEREF(__pyx_v_py_buffer);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":406
 *             py_buffer = <bytes>c_buffer[:size]
 *             self._filelike.write(py_buffer)
 *         except:             # <<<<<<<<<<<<<<
 *             size = -1
 *             self._exc_context._store_raised()
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FilelikeWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_7);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":407
 *             self._filelike.write(py_buffer)
 *         except:
 *             size = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
 */
        __pyx_v_size = -1;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":408
 *         except:
 *             size = -1
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return size  # and swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_exception_handled;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L13_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":410
 *             self._exc_context._store_raised()
 *         finally:
 *             return size  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 *     cdef int close(self):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_size;
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        __pyx_r = __pyx_v_size;
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":400
 *         return c_buffer
 * 
 *     cdef int write(self, char* c_buffer, int size):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._filelike is None:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":412
 *             return size  # and swallow any further exceptions
 * 
 *     cdef int close(self):             # <<<<<<<<<<<<<<
 *         retval = 0
 *         try:
 */

static int __pyx_f_4lxml_5etree_15_FilelikeWriter_close(struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_self) {
  long __pyx_v_retval;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":413
 * 
 *     cdef int close(self):
 *         retval = 0             # <<<<<<<<<<<<<<
 *         try:
 *             if self._close_filelike is not None:
 */
  __pyx_v_retval = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":414
 *     cdef int close(self):
 *         retval = 0
 *         try:             # <<<<<<<<<<<<<<
 *             if self._close_filelike is not None:
 *                 self._close_filelike()
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":415
 *         retval = 0
 *         try:
 *             if self._close_filelike is not None:             # <<<<<<<<<<<<<<
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
 */
        __pyx_t_4 = (__pyx_v_self->_close_filelike != Py_None);
        __pyx_t_5 = (__pyx_t_4 != 0);
        if (__pyx_t_5) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":416
 *         try:
 *             if self._close_filelike is not None:
 *                 self._close_filelike()             # <<<<<<<<<<<<<<
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None
 */
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_self->_close_filelike, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":418
 *                 self._close_filelike()
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None             # <<<<<<<<<<<<<<
 *         except:
 *             retval = -1
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_filelike);
        __Pyx_DECREF(__pyx_v_self->_filelike);
        __pyx_v_self->_filelike = Py_None;
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":419
 *             # we should not close the file here as we didn't open it
 *             self._filelike = None
 *         except:             # <<<<<<<<<<<<<<
 *             retval = -1
 *             self._exc_context._store_raised()
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._FilelikeWriter.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":420
 *             self._filelike = None
 *         except:
 *             retval = -1             # <<<<<<<<<<<<<<
 *             self._exc_context._store_raised()
 *         finally:
 */
        __pyx_v_retval = -1;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":421
 *         except:
 *             retval = -1
 *             self._exc_context._store_raised()             # <<<<<<<<<<<<<<
 *         finally:
 *             return retval  # and swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc_context->__pyx_vtab)->_store_raised(__pyx_v_self->_exc_context);
        __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_exception_handled;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L13_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":423
 *             self._exc_context._store_raised()
 *         finally:
 *             return retval  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_retval;
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        __pyx_r = __pyx_v_retval;
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":412
 *             return size  # and swallow any further exceptions
 * 
 *     cdef int close(self):             # <<<<<<<<<<<<<<
 *         retval = 0
 *         try:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":425
 *             return retval  # and swallow any further exceptions
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length):             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 */

static int __pyx_f_4lxml_5etree__writeFilelikeWriter(void *__pyx_v_ctxt, char *__pyx_v_c_buffer, int __pyx_v_length) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_writeFilelikeWriter", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":426
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length):
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)             # <<<<<<<<<<<<<<
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):
 */
  __pyx_r = __pyx_f_4lxml_5etree_15_FilelikeWriter_write(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt), __pyx_v_c_buffer, __pyx_v_length);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":425
 *             return retval  # and swallow any further exceptions
 * 
 * cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length):             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":428
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 */

static int __pyx_f_4lxml_5etree__closeFilelikeWriter(void *__pyx_v_ctxt) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_closeFilelikeWriter", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":429
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):
 *     return (<_FilelikeWriter>ctxt).close()             # <<<<<<<<<<<<<<
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,
 */
  __pyx_r = __pyx_f_4lxml_5etree_15_FilelikeWriter_close(((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_v_ctxt));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":428
 *     return (<_FilelikeWriter>ctxt).write(c_buffer, length)
 * 
 * cdef int _closeFilelikeWriter(void* ctxt):             # <<<<<<<<<<<<<<
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":431
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                  bint write_xml_declaration, bint write_doctype,
 *                  bint pretty_print, bint with_tail, int standalone,
 */

static PyObject *__pyx_f_4lxml_5etree__tofilelike(PyObject *__pyx_v_f, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_encoding, PyObject *__pyx_v_doctype, PyObject *__pyx_v_method, int __pyx_v_write_xml_declaration, int __pyx_v_write_doctype, int __pyx_v_pretty_print, int __pyx_v_with_tail, int __pyx_v_standalone, int __pyx_v_compression) {
  PyThreadState *__pyx_v_state;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  xmlOutputBuffer *__pyx_v_c_buffer;
  const char *__pyx_v_c_enc;
  const xmlChar *__pyx_v_c_doctype;
  int __pyx_v_error_result;
  int __pyx_v_c_method;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_bytes_out = NULL;
  PyObject *__pyx_v_gzip_file = NULL;
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  char const *__pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tofilelike", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":435
 *                  bint pretty_print, bint with_tail, int standalone,
 *                  int compression):
 *     cdef python.PyThreadState* state = NULL             # <<<<<<<<<<<<<<
 *     cdef _FilelikeWriter writer = None
 *     cdef tree.xmlOutputBuffer* c_buffer
 */
  __pyx_v_state = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":436
 *                  int compression):
 *     cdef python.PyThreadState* state = NULL
 *     cdef _FilelikeWriter writer = None             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef tree.xmlCharEncodingHandler* enchandler
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":443
 *     cdef int error_result
 * 
 *     c_method = _findOutputMethod(method)             # <<<<<<<<<<<<<<
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__findOutputMethod(__pyx_v_method); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_method = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":444
 * 
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:             # <<<<<<<<<<<<<<
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 */
  __pyx_t_2 = ((__pyx_v_c_method == __pyx_e_4lxml_5etree_OUTPUT_METHOD_TEXT) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":445
 *     c_method = _findOutputMethod(method)
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)             # <<<<<<<<<<<<<<
 *         if compression:
 *             bytes_out = BytesIO()
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__textToString(__pyx_v_element->_c_node, __pyx_v_encoding, __pyx_v_with_tail); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_data = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":446
 *     if c_method == OUTPUT_METHOD_TEXT:
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:             # <<<<<<<<<<<<<<
 *             bytes_out = BytesIO()
 *             gzip_file = GzipFile(
 */
    __pyx_t_2 = (__pyx_v_compression != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":447
 *         data = _textToString(element._c_node, encoding, with_tail)
 *         if compression:
 *             bytes_out = BytesIO()             # <<<<<<<<<<<<<<
 *             gzip_file = GzipFile(
 *                 fileobj=bytes_out, mode='wb', compresslevel=compression)
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_BytesIO, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_bytes_out = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":448
 *         if compression:
 *             bytes_out = BytesIO()
 *             gzip_file = GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=bytes_out, mode='wb', compresslevel=compression)
 *             try:
 */
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":449
 *             bytes_out = BytesIO()
 *             gzip_file = GzipFile(
 *                 fileobj=bytes_out, mode='wb', compresslevel=compression)             # <<<<<<<<<<<<<<
 *             try:
 *                 gzip_file.write(data)
 */
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fileobj, __pyx_v_bytes_out) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mode, __pyx_n_s_wb) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compresslevel, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":448
 *         if compression:
 *             bytes_out = BytesIO()
 *             gzip_file = GzipFile(             # <<<<<<<<<<<<<<
 *                 fileobj=bytes_out, mode='wb', compresslevel=compression)
 *             try:
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree_GzipFile, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_gzip_file = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":450
 *             gzip_file = GzipFile(
 *                 fileobj=bytes_out, mode='wb', compresslevel=compression)
 *             try:             # <<<<<<<<<<<<<<
 *                 gzip_file.write(data)
 *             finally:
 */
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":451
 *                 fileobj=bytes_out, mode='wb', compresslevel=compression)
 *             try:
 *                 gzip_file.write(data)             # <<<<<<<<<<<<<<
 *             finally:
 *                 gzip_file.close()
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_gzip_file, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":453
 *                 gzip_file.write(data)
 *             finally:
 *                 gzip_file.close()             # <<<<<<<<<<<<<<
 *             data = bytes_out.getvalue()
 *         if _isString(f):
 */
      /*finally:*/ {
        /*normal exit:*/{
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_gzip_file, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L7;
        }
        /*exception exit:*/{
          __pyx_L6_error:;
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __pyx_t_1 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
          {
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_gzip_file, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
          goto __pyx_L1_error;
          __pyx_L9_error:;
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L7:;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":454
 *             finally:
 *                 gzip_file.close()
 *             data = bytes_out.getvalue()             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_bytes_out, __pyx_n_s_getvalue); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":455
 *                 gzip_file.close()
 *             data = bytes_out.getvalue()
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             f = open(filename8, 'wb')
 */
    __pyx_t_2 = (_isString(__pyx_v_f) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":456
 *             data = bytes_out.getvalue()
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             f = open(filename8, 'wb')
 *             try:
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_filename8 = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":457
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             f = open(filename8, 'wb')             # <<<<<<<<<<<<<<
 *             try:
 *                 f.write(data)
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_filename8);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename8);
      __Pyx_GIVEREF(__pyx_v_filename8);
      __Pyx_INCREF(__pyx_n_s_wb);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_wb);
      __Pyx_GIVEREF(__pyx_n_s_wb);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":458
 *             filename8 = _encodeFilename(f)
 *             f = open(filename8, 'wb')
 *             try:             # <<<<<<<<<<<<<<
 *                 f.write(data)
 *             finally:
 */
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":459
 *             f = open(filename8, 'wb')
 *             try:
 *                 f.write(data)             # <<<<<<<<<<<<<<
 *             finally:
 *                 f.close()
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":461
 *                 f.write(data)
 *             finally:
 *                 f.close()             # <<<<<<<<<<<<<<
 *         else:
 *             f.write(data)
 */
      /*finally:*/ {
        /*normal exit:*/{
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L13;
        }
        /*exception exit:*/{
          __pyx_L12_error:;
          __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_6 = __pyx_lineno; __pyx_t_1 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
          {
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
          }
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
          __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0;
          __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_1; __pyx_filename = __pyx_t_14;
          goto __pyx_L1_error;
          __pyx_L15_error:;
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
          }
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L13:;
      }
      goto __pyx_L10;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":463
 *                 f.close()
 *         else:
 *             f.write(data)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_data);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_L10:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":464
 *         else:
 *             f.write(data)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if encoding is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":466
 *         return
 * 
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         c_enc = NULL
 *     else:
 */
  __pyx_t_2 = (__pyx_v_encoding == Py_None);
  __pyx_t_15 = (__pyx_t_2 != 0);
  if (__pyx_t_15) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":467
 * 
 *     if encoding is None:
 *         c_enc = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         encoding = _utf8(encoding)
 */
    __pyx_v_c_enc = NULL;
    goto __pyx_L16;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":469
 *         c_enc = NULL
 *     else:
 *         encoding = _utf8(encoding)             # <<<<<<<<<<<<<<
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_v_encoding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":470
 *     else:
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)             # <<<<<<<<<<<<<<
 *     if doctype is None:
 *         c_doctype = NULL
 */
    __pyx_v_c_enc = PyBytes_AS_STRING(__pyx_v_encoding);
  }
  __pyx_L16:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":471
 *         encoding = _utf8(encoding)
 *         c_enc = _cstr(encoding)
 *     if doctype is None:             # <<<<<<<<<<<<<<
 *         c_doctype = NULL
 *     else:
 */
  __pyx_t_15 = (__pyx_v_doctype == Py_None);
  __pyx_t_2 = (__pyx_t_15 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":472
 *         c_enc = _cstr(encoding)
 *     if doctype is None:
 *         c_doctype = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         doctype = _utf8(doctype)
 */
    __pyx_v_c_doctype = NULL;
    goto __pyx_L17;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":474
 *         c_doctype = NULL
 *     else:
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         c_doctype = _xcstr(doctype)
 * 
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":475
 *     else:
 *         doctype = _utf8(doctype)
 *         c_doctype = _xcstr(doctype)             # <<<<<<<<<<<<<<
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer)
 */
    __pyx_v_c_doctype = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype);
  }
  __pyx_L17:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":477
 *         c_doctype = _xcstr(doctype)
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer)             # <<<<<<<<<<<<<<
 *     if writer is None:
 *         state = python.PyEval_SaveThread()
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_f, __pyx_v_c_enc, __pyx_v_compression, (&__pyx_v_c_buffer)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__FilelikeWriter))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_5));
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":478
 * 
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         state = python.PyEval_SaveThread()
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_writer) == Py_None);
  __pyx_t_15 = (__pyx_t_2 != 0);
  if (__pyx_t_15) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":479
 *     writer = _create_output_buffer(f, c_enc, compression, &c_buffer)
 *     if writer is None:
 *         state = python.PyEval_SaveThread()             # <<<<<<<<<<<<<<
 * 
 *     _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,
 */
    __pyx_v_state = PyEval_SaveThread();
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":481
 *         state = python.PyEval_SaveThread()
 * 
 *     _writeNodeToBuffer(c_buffer, element._c_node, c_enc, c_doctype, c_method,             # <<<<<<<<<<<<<<
 *                        write_xml_declaration, write_doctype,
 *                        pretty_print, with_tail, standalone)
 */
  __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_c_buffer, __pyx_v_element->_c_node, __pyx_v_c_enc, __pyx_v_c_doctype, __pyx_v_c_method, __pyx_v_write_xml_declaration, __pyx_v_write_doctype, __pyx_v_pretty_print, __pyx_v_with_tail, __pyx_v_standalone);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":484
 *                        write_xml_declaration, write_doctype,
 *                        pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error             # <<<<<<<<<<<<<<
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 */
  __pyx_t_1 = __pyx_v_c_buffer->error;
  __pyx_v_error_result = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":485
 *                        pretty_print, with_tail, standalone)
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result > 0:
 */
  __pyx_t_15 = ((__pyx_v_error_result == XML_ERR_OK) != 0);
  if (__pyx_t_15) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":486
 *     error_result = c_buffer.error
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *         if error_result > 0:
 *             error_result = xmlerror.XML_ERR_OK
 */
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_c_buffer);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":487
 *     if error_result == xmlerror.XML_ERR_OK:
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result > 0:             # <<<<<<<<<<<<<<
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 */
    __pyx_t_15 = ((__pyx_v_error_result > 0) != 0);
    if (__pyx_t_15) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":488
 *         error_result = tree.xmlOutputBufferClose(c_buffer)
 *         if error_result > 0:
 *             error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 */
      __pyx_v_error_result = XML_ERR_OK;
      goto __pyx_L20;
    }
    __pyx_L20:;
    goto __pyx_L19;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":490
 *             error_result = xmlerror.XML_ERR_OK
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *     if writer is None:
 *         python.PyEval_RestoreThread(state)
 */
    xmlOutputBufferClose(__pyx_v_c_buffer);
  }
  __pyx_L19:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":491
 *     else:
 *         tree.xmlOutputBufferClose(c_buffer)
 *     if writer is None:             # <<<<<<<<<<<<<<
 *         python.PyEval_RestoreThread(state)
 *     else:
 */
  __pyx_t_15 = (((PyObject *)__pyx_v_writer) == Py_None);
  __pyx_t_2 = (__pyx_t_15 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":492
 *         tree.xmlOutputBufferClose(c_buffer)
 *     if writer is None:
 *         python.PyEval_RestoreThread(state)             # <<<<<<<<<<<<<<
 *     else:
 *         writer._exc_context._raise_if_stored()
 */
    PyEval_RestoreThread(__pyx_v_state);
    goto __pyx_L21;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":494
 *         python.PyEval_RestoreThread(state)
 *     else:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_writer->_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L21:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":495
 *     else:
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *         _raiseSerialisationError(error_result)
 * 
 */
  __pyx_t_2 = ((__pyx_v_error_result != XML_ERR_OK) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":496
 *         writer._exc_context._raise_if_stored()
 *     if error_result != xmlerror.XML_ERR_OK:
 *         _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * cdef _create_output_buffer(f, const_char* c_enc, int compression,
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L22;
  }
  __pyx_L22:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":431
 *     return (<_FilelikeWriter>ctxt).close()
 * 
 * cdef _tofilelike(f, _Element element, encoding, doctype, method,             # <<<<<<<<<<<<<<
 *                  bint write_xml_declaration, bint write_doctype,
 *                  bint pretty_print, bint with_tail, int standalone,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._tofilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_bytes_out);
  __Pyx_XDECREF(__pyx_v_gzip_file);
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":498
 *         _raiseSerialisationError(error_result)
 * 
 * cdef _create_output_buffer(f, const_char* c_enc, int compression,             # <<<<<<<<<<<<<<
 *                            tree.xmlOutputBuffer** c_buffer_ret):
 *     cdef tree.xmlOutputBuffer* c_buffer
 */

static PyObject *__pyx_f_4lxml_5etree__create_output_buffer(PyObject *__pyx_v_f, const char *__pyx_v_c_enc, int __pyx_v_compression, xmlOutputBuffer **__pyx_v_c_buffer_ret) {
  xmlOutputBuffer *__pyx_v_c_buffer;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  xmlCharEncodingHandler *__pyx_v_enchandler;
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  xmlOutputBuffer *__pyx_t_9;
  const char *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_output_buffer", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":502
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef _FilelikeWriter writer
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)             # <<<<<<<<<<<<<<
 *     if enchandler is NULL:
 *         raise LookupError(u"unknown encoding: '%s'" %
 */
  __pyx_v_enchandler = xmlFindCharEncodingHandler(__pyx_v_c_enc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":503
 *     cdef _FilelikeWriter writer
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:             # <<<<<<<<<<<<<<
 *         raise LookupError(u"unknown encoding: '%s'" %
 *                           c_enc.decode(u'UTF-8') if c_enc is not NULL else u'')
 */
  __pyx_t_1 = ((__pyx_v_enchandler == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":505
 *     if enchandler is NULL:
 *         raise LookupError(u"unknown encoding: '%s'" %
 *                           c_enc.decode(u'UTF-8') if c_enc is not NULL else u'')             # <<<<<<<<<<<<<<
 *     try:
 *         if _isString(f):
 */
    if (((__pyx_v_c_enc != NULL) != 0)) {
      __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_c_enc, 0, strlen(__pyx_v_c_enc), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":504
 *     enchandler = tree.xmlFindCharEncodingHandler(c_enc)
 *     if enchandler is NULL:
 *         raise LookupError(u"unknown encoding: '%s'" %             # <<<<<<<<<<<<<<
 *                           c_enc.decode(u'UTF-8') if c_enc is not NULL else u'')
 *     try:
 */
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_unknown_encoding_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __Pyx_INCREF(__pyx_kp_u__15);
      __pyx_t_2 = __pyx_kp_u__15;
    }
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 504; __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 = __Pyx_PyObject_Call(__pyx_builtin_LookupError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":506
 *         raise LookupError(u"unknown encoding: '%s'" %
 *                           c_enc.decode(u'UTF-8') if c_enc is not NULL else u'')
 *     try:             # <<<<<<<<<<<<<<
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":507
 *                           c_enc.decode(u'UTF-8') if c_enc is not NULL else u'')
 *     try:
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 */
      __pyx_t_1 = (_isString(__pyx_v_f) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":508
 *     try:
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, compression)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_filename8 = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":509
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             c_buffer = tree.xmlOutputBufferCreateFilename(             # <<<<<<<<<<<<<<
 *                 _cstr(filename8), enchandler, compression)
 *             if c_buffer is NULL:
 */
        __pyx_v_c_buffer = xmlOutputBufferCreateFilename(PyBytes_AS_STRING(__pyx_v_filename8), __pyx_v_enchandler, __pyx_v_compression);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":511
 *             c_buffer = tree.xmlOutputBufferCreateFilename(
 *                 _cstr(filename8), enchandler, compression)
 *             if c_buffer is NULL:             # <<<<<<<<<<<<<<
 *                 return python.PyErr_SetFromErrno(IOError) # raises IOError
 *             writer = None
 */
        __pyx_t_1 = ((__pyx_v_c_buffer == NULL) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":512
 *                 _cstr(filename8), enchandler, compression)
 *             if c_buffer is NULL:
 *                 return python.PyErr_SetFromErrno(IOError) # raises IOError             # <<<<<<<<<<<<<<
 *             writer = None
 *         elif hasattr(f, 'write'):
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = PyErr_SetFromErrno(__pyx_builtin_IOError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L8_try_return;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":513
 *             if c_buffer is NULL:
 *                 return python.PyErr_SetFromErrno(IOError) # raises IOError
 *             writer = None             # <<<<<<<<<<<<<<
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=compression)
 */
        __Pyx_INCREF(Py_None);
        __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);
        goto __pyx_L12;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":514
 *                 return python.PyErr_SetFromErrno(IOError) # raises IOError
 *             writer = None
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(enchandler)
 */
      __pyx_t_1 = PyObject_HasAttr(__pyx_v_f, __pyx_n_s_write); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __pyx_t_8 = (__pyx_t_1 != 0);
      if (__pyx_t_8) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":515
 *             writer = None
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=compression)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
 */
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_f);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f);
        __Pyx_GIVEREF(__pyx_v_f);
        __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_compression, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FilelikeWriter)), __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":516
 *         elif hasattr(f, 'write'):
 *             writer = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(enchandler)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(
 */
        __pyx_t_9 = __pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(__pyx_v_writer, __pyx_v_enchandler); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __pyx_v_c_buffer = __pyx_t_9;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":520
 *             raise TypeError(
 *                 u"File or filename expected, got '%s'" %
 *                 python._fqtypename(f).decode('UTF-8'))             # <<<<<<<<<<<<<<
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)
 */
        __pyx_t_10 = _fqtypename(__pyx_v_f);
        __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_10, 0, strlen(__pyx_t_10), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":519
 *         else:
 *             raise TypeError(
 *                 u"File or filename expected, got '%s'" %             # <<<<<<<<<<<<<<
 *                 python._fqtypename(f).decode('UTF-8'))
 *     except:
 */
        __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_File_or_filename_expected_got_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":518
 *             c_buffer = writer._createOutputBuffer(enchandler)
 *         else:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 u"File or filename expected, got '%s'" %
 *                 python._fqtypename(f).decode('UTF-8'))
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L4_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 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      }
      __pyx_L12:;
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":521
 *                 u"File or filename expected, got '%s'" %
 *                 python._fqtypename(f).decode('UTF-8'))
 *     except:             # <<<<<<<<<<<<<<
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._create_output_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":522
 *                 python._fqtypename(f).decode('UTF-8'))
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)             # <<<<<<<<<<<<<<
 *         raise
 *     c_buffer_ret[0] = c_buffer
 */
      xmlCharEncCloseFunc(__pyx_v_enchandler);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":523
 *     except:
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise             # <<<<<<<<<<<<<<
 *     c_buffer_ret[0] = c_buffer
 *     return writer
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; 
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L6_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_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L11_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":524
 *         tree.xmlCharEncCloseFunc(enchandler)
 *         raise
 *     c_buffer_ret[0] = c_buffer             # <<<<<<<<<<<<<<
 *     return writer
 * 
 */
  (__pyx_v_c_buffer_ret[0]) = __pyx_v_c_buffer;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":525
 *         raise
 *     c_buffer_ret[0] = c_buffer
 *     return writer             # <<<<<<<<<<<<<<
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_writer));
  __pyx_r = ((PyObject *)__pyx_v_writer);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":498
 *         _raiseSerialisationError(error_result)
 * 
 * cdef _create_output_buffer(f, const_char* c_enc, int compression,             # <<<<<<<<<<<<<<
 *                            tree.xmlOutputBuffer** c_buffer_ret):
 *     cdef tree.xmlOutputBuffer* c_buffer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._create_output_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":527
 *     return writer
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:             # <<<<<<<<<<<<<<
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)
 *     # Need to allocate one extra memory block to handle last NULL entry
 */

static xmlChar **__pyx_f_4lxml_5etree__convert_ns_prefixes(xmlDict *__pyx_v_c_dict, PyObject *__pyx_v_ns_prefixes) {
  size_t __pyx_v_i;
  size_t __pyx_v_num_ns_prefixes;
  xmlChar **__pyx_v_c_ns_prefixes;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_prefix_utf = NULL;
  const xmlChar *__pyx_v_c_prefix;
  xmlChar **__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_ns_prefixes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":528
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)             # <<<<<<<<<<<<<<
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.PyMem_Malloc(sizeof(xmlChar*) * (num_ns_prefixes + 1))
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_ns_prefixes); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_num_ns_prefixes = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":530
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.PyMem_Malloc(sizeof(xmlChar*) * (num_ns_prefixes + 1))             # <<<<<<<<<<<<<<
 *     i = 0
 *     try:
 */
  __pyx_v_c_ns_prefixes = ((xmlChar **)PyMem_Malloc(((sizeof(xmlChar *)) * (__pyx_v_num_ns_prefixes + 1))));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":531
 *     # Need to allocate one extra memory block to handle last NULL entry
 *     c_ns_prefixes = <xmlChar **>python.PyMem_Malloc(sizeof(xmlChar*) * (num_ns_prefixes + 1))
 *     i = 0             # <<<<<<<<<<<<<<
 *     try:
 *         for prefix in ns_prefixes:
 */
  __pyx_v_i = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":532
 *     c_ns_prefixes = <xmlChar **>python.PyMem_Malloc(sizeof(xmlChar*) * (num_ns_prefixes + 1))
 *     i = 0
 *     try:             # <<<<<<<<<<<<<<
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":533
 *     i = 0
 *     try:
 *         for prefix in ns_prefixes:             # <<<<<<<<<<<<<<
 *              prefix_utf = _utf8(prefix)
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), len(prefix_utf))
 */
      if (PyList_CheckExact(__pyx_v_ns_prefixes) || PyTuple_CheckExact(__pyx_v_ns_prefixes)) {
        __pyx_t_5 = __pyx_v_ns_prefixes; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_ns_prefixes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      }
      for (;;) {
        if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_5)) {
          if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          #endif
        } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_5)) {
          if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          #endif
        } else {
          __pyx_t_7 = __pyx_t_6(__pyx_t_5);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":534
 *     try:
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)             # <<<<<<<<<<<<<<
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), len(prefix_utf))
 *              if c_prefix:
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":535
 *         for prefix in ns_prefixes:
 *              prefix_utf = _utf8(prefix)
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), len(prefix_utf))             # <<<<<<<<<<<<<<
 *              if c_prefix:
 *                  # unknown prefixes do not need to get serialised
 */
        if (unlikely(__pyx_v_prefix_utf == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_t_8 = PyBytes_GET_SIZE(__pyx_v_prefix_utf); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_v_c_prefix = xmlDictExists(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), __pyx_t_8);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":536
 *              prefix_utf = _utf8(prefix)
 *              c_prefix = tree.xmlDictExists(c_dict, _xcstr(prefix_utf), len(prefix_utf))
 *              if c_prefix:             # <<<<<<<<<<<<<<
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 */
        __pyx_t_9 = (__pyx_v_c_prefix != 0);
        if (__pyx_t_9) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":538
 *              if c_prefix:
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix             # <<<<<<<<<<<<<<
 *                  i += 1
 *     except:
 */
          (__pyx_v_c_ns_prefixes[__pyx_v_i]) = ((xmlChar *)__pyx_v_c_prefix);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":539
 *                  # unknown prefixes do not need to get serialised
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 *                  i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.PyMem_Free(c_ns_prefixes)
 */
          __pyx_v_i = (__pyx_v_i + 1);
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":540
 *                  c_ns_prefixes[i] = <xmlChar*>c_prefix
 *                  i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.PyMem_Free(c_ns_prefixes)
 *         raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._convert_ns_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":541
 *                  i += 1
 *     except:
 *         python.PyMem_Free(c_ns_prefixes)             # <<<<<<<<<<<<<<
 *         raise
 * 
 */
      PyMem_Free(__pyx_v_c_ns_prefixes);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":542
 *     except:
 *         python.PyMem_Free(c_ns_prefixes)
 *         raise             # <<<<<<<<<<<<<<
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_7, __pyx_t_10);
      __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_10 = 0; 
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":544
 *         raise
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker             # <<<<<<<<<<<<<<
 *     return c_ns_prefixes
 * 
 */
  (__pyx_v_c_ns_prefixes[__pyx_v_i]) = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":545
 * 
 *     c_ns_prefixes[i] = NULL  # append end marker
 *     return c_ns_prefixes             # <<<<<<<<<<<<<<
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,
 */
  __pyx_r = __pyx_v_c_ns_prefixes;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":527
 *     return writer
 * 
 * cdef xmlChar **_convert_ns_prefixes(tree.xmlDict* c_dict, ns_prefixes) except NULL:             # <<<<<<<<<<<<<<
 *     cdef size_t i, num_ns_prefixes = len(ns_prefixes)
 *     # Need to allocate one extra memory block to handle last NULL entry
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._convert_ns_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":547
 *     return c_ns_prefixes
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,             # <<<<<<<<<<<<<<
 *                      int compression, inclusive_ns_prefixes):
 *     cdef _FilelikeWriter writer = None
 */

static PyObject *__pyx_f_4lxml_5etree__tofilelikeC14N(PyObject *__pyx_v_f, struct LxmlElement *__pyx_v_element, int __pyx_v_exclusive, int __pyx_v_with_comments, int __pyx_v_compression, PyObject *__pyx_v_inclusive_ns_prefixes) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *__pyx_v_writer = 0;
  xmlOutputBuffer *__pyx_v_c_buffer;
  xmlChar **__pyx_v_c_inclusive_ns_prefixes;
  char *__pyx_v_c_filename;
  xmlDoc *__pyx_v_c_base_doc;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_bytes_count;
  int __pyx_v_error;
  PyObject *__pyx_v_filename8 = NULL;
  PyObject *__pyx_v_message = NULL;
  struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_errors = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDoc *__pyx_t_1;
  xmlChar **__pyx_t_2;
  int __pyx_t_3;
  xmlChar **__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  xmlOutputBuffer *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  const char *__pyx_t_15;
  int __pyx_t_16;
  char const *__pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_tofilelikeC14N", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":549
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,
 *                      int compression, inclusive_ns_prefixes):
 *     cdef _FilelikeWriter writer = None             # <<<<<<<<<<<<<<
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef xmlChar **c_inclusive_ns_prefixes = NULL
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":551
 *     cdef _FilelikeWriter writer = None
 *     cdef tree.xmlOutputBuffer* c_buffer
 *     cdef xmlChar **c_inclusive_ns_prefixes = NULL             # <<<<<<<<<<<<<<
 *     cdef char* c_filename
 *     cdef xmlDoc* c_base_doc
 */
  __pyx_v_c_inclusive_ns_prefixes = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":555
 *     cdef xmlDoc* c_base_doc
 *     cdef xmlDoc* c_doc
 *     cdef int bytes_count, error = 0             # <<<<<<<<<<<<<<
 * 
 *     c_base_doc = element._c_node.doc
 */
  __pyx_v_error = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":557
 *     cdef int bytes_count, error = 0
 * 
 *     c_base_doc = element._c_node.doc             # <<<<<<<<<<<<<<
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:
 */
  __pyx_t_1 = __pyx_v_element->_c_node->doc;
  __pyx_v_c_base_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":558
 * 
 *     c_base_doc = element._c_node.doc
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)             # <<<<<<<<<<<<<<
 *     try:
 *         c_inclusive_ns_prefixes = (
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_c_base_doc, __pyx_v_element->_c_node); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":559
 *     c_base_doc = element._c_node.doc
 *     c_doc = _fakeRootDoc(c_base_doc, element._c_node)
 *     try:             # <<<<<<<<<<<<<<
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":562
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 *             if inclusive_ns_prefixes else NULL)             # <<<<<<<<<<<<<<
 * 
 *         if _isString(f):
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":561
 *     try:
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 *             if inclusive_ns_prefixes else NULL)
 * 
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__convert_ns_prefixes(__pyx_v_c_doc->dict, __pyx_v_inclusive_ns_prefixes); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __pyx_t_2 = __pyx_t_4;
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":562
 *         c_inclusive_ns_prefixes = (
 *             _convert_ns_prefixes(c_doc.dict, inclusive_ns_prefixes)
 *             if inclusive_ns_prefixes else NULL)             # <<<<<<<<<<<<<<
 * 
 *         if _isString(f):
 */
      __pyx_t_2 = NULL;
    }
    __pyx_v_c_inclusive_ns_prefixes = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":564
 *             if inclusive_ns_prefixes else NULL)
 * 
 *         if _isString(f):             # <<<<<<<<<<<<<<
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 */
    __pyx_t_3 = (_isString(__pyx_v_f) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":565
 * 
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)             # <<<<<<<<<<<<<<
 *             c_filename = _cstr(filename8)
 *             with nogil:
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_filename8 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":566
 *         if _isString(f):
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 error = c14n.xmlC14NDocSave(
 */
      __pyx_v_c_filename = PyBytes_AS_STRING(__pyx_v_filename8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":567
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 error = c14n.xmlC14NDocSave(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":568
 *             c_filename = _cstr(filename8)
 *             with nogil:
 *                 error = c14n.xmlC14NDocSave(             # <<<<<<<<<<<<<<
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_filename, compression)
 */
            __pyx_v_error = xmlC14NDocSave(__pyx_v_c_doc, NULL, __pyx_v_exclusive, __pyx_v_c_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_c_filename, __pyx_v_compression);
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":567
 *             filename8 = _encodeFilename(f)
 *             c_filename = _cstr(filename8)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 error = c14n.xmlC14NDocSave(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L9;
            }
            __pyx_L9:;
          }
      }
      goto __pyx_L6;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":571
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_filename, compression)
 *         elif hasattr(f, 'write'):             # <<<<<<<<<<<<<<
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 */
    __pyx_t_3 = PyObject_HasAttr(__pyx_v_f, __pyx_n_s_write); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":572
 *                     with_comments, c_filename, compression)
 *         elif hasattr(f, 'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)             # <<<<<<<<<<<<<<
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             with writer.error_log:
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_f);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_f);
      __Pyx_GIVEREF(__pyx_v_f);
      __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_compression); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_compression, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FilelikeWriter)), __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_writer, ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":573
 *         elif hasattr(f, 'write'):
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)             # <<<<<<<<<<<<<<
 *             with writer.error_log:
 *                 bytes_count = c14n.xmlC14NDocSaveTo(
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer(__pyx_v_writer, NULL); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __pyx_v_c_buffer = __pyx_t_9;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":574
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             with writer.error_log:             # <<<<<<<<<<<<<<
 *                 bytes_count = c14n.xmlC14NDocSaveTo(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
      /*with:*/ {
        __pyx_t_10 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_writer->error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_writer->error_log); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
        /*try:*/ {
          {
            if (__pyx_t_12||__pyx_t_13||__pyx_t_14); else {/*mark used*/};
            /*try:*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":575
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             with writer.error_log:
 *                 bytes_count = c14n.xmlC14NDocSaveTo(             # <<<<<<<<<<<<<<
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_buffer)
 */
              __pyx_v_bytes_count = xmlC14NDocSaveTo(__pyx_v_c_doc, NULL, __pyx_v_exclusive, __pyx_v_c_inclusive_ns_prefixes, __pyx_v_with_comments, __pyx_v_c_buffer);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":578
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 *                     with_comments, c_buffer)
 *                 error = tree.xmlOutputBufferClose(c_buffer)             # <<<<<<<<<<<<<<
 *             if bytes_count < 0:
 *                 error = bytes_count
 */
              __pyx_v_error = xmlOutputBufferClose(__pyx_v_c_buffer);
            }
          }
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":574
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             with writer.error_log:             # <<<<<<<<<<<<<<
 *                 bytes_count = c14n.xmlC14NDocSaveTo(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_10) {
              __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__57, NULL);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            }
            goto __pyx_L13;
          }
          __pyx_L13:;
        }
        goto __pyx_L22;
        __pyx_L10_error:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L4_error;
        __pyx_L22:;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":579
 *                     with_comments, c_buffer)
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:             # <<<<<<<<<<<<<<
 *                 error = bytes_count
 *         else:
 */
      __pyx_t_6 = ((__pyx_v_bytes_count < 0) != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":580
 *                 error = tree.xmlOutputBufferClose(c_buffer)
 *             if bytes_count < 0:
 *                 error = bytes_count             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(u"File or filename expected, got '%s'" %
 */
        __pyx_v_error = __pyx_v_bytes_count;
        goto __pyx_L23;
      }
      __pyx_L23:;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":583
 *         else:
 *             raise TypeError(u"File or filename expected, got '%s'" %
 *                             python._fqtypename(f).decode('UTF-8'))             # <<<<<<<<<<<<<<
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 */
      __pyx_t_15 = _fqtypename(__pyx_v_f);
      __pyx_t_8 = __Pyx_decode_c_string(__pyx_t_15, 0, strlen(__pyx_t_15), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":582
 *                 error = bytes_count
 *         else:
 *             raise TypeError(u"File or filename expected, got '%s'" %             # <<<<<<<<<<<<<<
 *                             python._fqtypename(f).decode('UTF-8'))
 *     finally:
 */
      __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_File_or_filename_expected_got_s, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":585
 *                             python._fqtypename(f).decode('UTF-8'))
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":586
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 * 
 */
      __pyx_t_6 = ((__pyx_v_c_inclusive_ns_prefixes != NULL) != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":587
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.PyMem_Free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
 */
        PyMem_Free(__pyx_v_c_inclusive_ns_prefixes);
        goto __pyx_L24;
      }
      __pyx_L24:;
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_10 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_18, &__pyx_t_19);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_14, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_14, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __pyx_t_11 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
      {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":585
 *                             python._fqtypename(f).decode('UTF-8'))
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)             # <<<<<<<<<<<<<<
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 */
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_c_base_doc, __pyx_v_c_doc);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":586
 *     finally:
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:             # <<<<<<<<<<<<<<
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 * 
 */
        __pyx_t_6 = ((__pyx_v_c_inclusive_ns_prefixes != NULL) != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":587
 *         _destroyFakeDoc(c_base_doc, c_doc)
 *         if c_inclusive_ns_prefixes is not NULL:
 *             python.PyMem_Free(c_inclusive_ns_prefixes)             # <<<<<<<<<<<<<<
 * 
 *     if writer is not None:
 */
          PyMem_Free(__pyx_v_c_inclusive_ns_prefixes);
          goto __pyx_L27;
        }
        __pyx_L27:;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_18, __pyx_t_19);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_14, __pyx_t_13);
      __pyx_t_10 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":589
 *             python.PyMem_Free(c_inclusive_ns_prefixes)
 * 
 *     if writer is not None:             # <<<<<<<<<<<<<<
 *         writer._exc_context._raise_if_stored()
 * 
 */
  __pyx_t_6 = (((PyObject *)__pyx_v_writer) != Py_None);
  __pyx_t_3 = (__pyx_t_6 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":590
 * 
 *     if writer is not None:
 *         writer._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *     if error < 0:
 */
    __pyx_t_16 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_writer->_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_writer->_exc_context); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L28;
  }
  __pyx_L28:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":592
 *         writer._exc_context._raise_if_stored()
 * 
 *     if error < 0:             # <<<<<<<<<<<<<<
 *         message = u"C14N failed"
 *         if writer is not None:
 */
  __pyx_t_3 = ((__pyx_v_error < 0) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":593
 * 
 *     if error < 0:
 *         message = u"C14N failed"             # <<<<<<<<<<<<<<
 *         if writer is not None:
 *             errors = writer.error_log
 */
    __Pyx_INCREF(__pyx_kp_u_C14N_failed);
    __pyx_v_message = __pyx_kp_u_C14N_failed;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":594
 *     if error < 0:
 *         message = u"C14N failed"
 *         if writer is not None:             # <<<<<<<<<<<<<<
 *             errors = writer.error_log
 *             if len(errors):
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_writer) != Py_None);
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":595
 *         message = u"C14N failed"
 *         if writer is not None:
 *             errors = writer.error_log             # <<<<<<<<<<<<<<
 *             if len(errors):
 *                 message = errors[0].message
 */
      __pyx_t_7 = ((PyObject *)__pyx_v_writer->error_log);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_errors = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":596
 *         if writer is not None:
 *             errors = writer.error_log
 *             if len(errors):             # <<<<<<<<<<<<<<
 *                 message = errors[0].message
 *         raise C14NError(message)
 */
      __pyx_t_20 = PyObject_Length(((PyObject *)__pyx_v_errors)); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = (__pyx_t_20 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":597
 *             errors = writer.error_log
 *             if len(errors):
 *                 message = errors[0].message             # <<<<<<<<<<<<<<
 *         raise C14NError(message)
 * 
 */
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_errors), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_message); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_8);
        __pyx_t_8 = 0;
        goto __pyx_L31;
      }
      __pyx_L31:;
      goto __pyx_L30;
    }
    __pyx_L30:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":598
 *             if len(errors):
 *                 message = errors[0].message
 *         raise C14NError(message)             # <<<<<<<<<<<<<<
 * 
 * # incremental serialisation
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_C14NError); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_message);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_message);
    __Pyx_GIVEREF(__pyx_v_message);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":547
 *     return c_ns_prefixes
 * 
 * cdef _tofilelikeC14N(f, _Element element, bint exclusive, bint with_comments,             # <<<<<<<<<<<<<<
 *                      int compression, inclusive_ns_prefixes):
 *     cdef _FilelikeWriter writer = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._tofilelikeC14N", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF(__pyx_v_filename8);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF((PyObject *)__pyx_v_errors);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":628
 *     cdef _IncrementalFileWriter writer
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None):             # <<<<<<<<<<<<<<
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7xmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7xmlfile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_output_file = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_compression = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_file,&__pyx_n_s_encoding,&__pyx_n_s_compression,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output_file)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_output_file = values[0];
    __pyx_v_encoding = values[1];
    __pyx_v_compression = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.xmlfile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(((PyObject *)__pyx_v_output_file) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "output_file"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile___init__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self), __pyx_v_output_file, __pyx_v_encoding, __pyx_v_compression);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_7xmlfile___init__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":629
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None):
 *         self.output_file = output_file             # <<<<<<<<<<<<<<
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0
 */
  __Pyx_INCREF(__pyx_v_output_file);
  __Pyx_GIVEREF(__pyx_v_output_file);
  __Pyx_GOTREF(__pyx_v_self->output_file);
  __Pyx_DECREF(__pyx_v_self->output_file);
  __pyx_v_self->output_file = __pyx_v_output_file;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":630
 *     def __init__(self, output_file not None, encoding=None, compression=None):
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)             # <<<<<<<<<<<<<<
 *         self.compresslevel = compression or 0
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_encoding); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->encoding);
  __Pyx_DECREF(__pyx_v_self->encoding);
  __pyx_v_self->encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":631
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
 *         self.compresslevel = compression or 0             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_compression); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_2) {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_1 = __pyx_int_0;
  } else {
    __Pyx_INCREF(__pyx_v_compression);
    __pyx_t_1 = __pyx_v_compression;
  }
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->compresslevel = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":628
 *     cdef _IncrementalFileWriter writer
 * 
 *     def __init__(self, output_file not None, encoding=None, compression=None):             # <<<<<<<<<<<<<<
 *         self.output_file = output_file
 *         self.encoding = _utf8orNone(encoding)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":633
 *         self.compresslevel = compression or 0
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         cdef _IncrementalFileWriter writer = _IncrementalFileWriter(
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_2__enter__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_2__enter__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":634
 * 
 *     def __enter__(self):
 *         assert self.output_file is not None             # <<<<<<<<<<<<<<
 *         cdef _IncrementalFileWriter writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__pyx_v_self->output_file != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":636
 *         assert self.output_file is not None
 *         cdef _IncrementalFileWriter writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel)             # <<<<<<<<<<<<<<
 *         self.writer = writer
 *         return writer
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->compresslevel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":635
 *     def __enter__(self):
 *         assert self.output_file is not None
 *         cdef _IncrementalFileWriter writer = _IncrementalFileWriter(             # <<<<<<<<<<<<<<
 *             self.output_file, self.encoding, self.compresslevel)
 *         self.writer = writer
 */
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->output_file);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->output_file);
  __Pyx_GIVEREF(__pyx_v_self->output_file);
  __Pyx_INCREF(__pyx_v_self->encoding);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->encoding);
  __Pyx_GIVEREF(__pyx_v_self->encoding);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IncrementalFileWriter)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":637
 *         cdef _IncrementalFileWriter writer = _IncrementalFileWriter(
 *             self.output_file, self.encoding, self.compresslevel)
 *         self.writer = writer             # <<<<<<<<<<<<<<
 *         return writer
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_writer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_writer));
  __Pyx_GOTREF(__pyx_v_self->writer);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->writer));
  __pyx_v_self->writer = __pyx_v_writer;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":638
 *             self.output_file, self.encoding, self.compresslevel)
 *         self.writer = writer
 *         return writer             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_writer));
  __pyx_r = ((PyObject *)__pyx_v_writer);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":633
 *         self.compresslevel = compression or 0
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         assert self.output_file is not None
 *         cdef _IncrementalFileWriter writer = _IncrementalFileWriter(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":640
 *         return writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7xmlfile_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_tb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.xmlfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7xmlfile_4__exit__(((struct __pyx_obj_4lxml_5etree_xmlfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

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

static PyObject *__pyx_pf_4lxml_5etree_7xmlfile_4__exit__(struct __pyx_obj_4lxml_5etree_xmlfile *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_old_writer = NULL;
  PyObject *__pyx_v_raise_on_error = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":641
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self.writer is not None:             # <<<<<<<<<<<<<<
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->writer) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":642
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None             # <<<<<<<<<<<<<<
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->writer);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = Py_None;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_old_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->writer);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->writer));
    __pyx_v_self->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":643
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None             # <<<<<<<<<<<<<<
 *             old_writer._close(raise_on_error)
 * 
 */
    __pyx_t_2 = (__pyx_v_exc_type == Py_None);
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_raise_on_error = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":644
 *             old_writer, self.writer = self.writer, None
 *             raise_on_error = exc_type is None
 *             old_writer._close(raise_on_error)             # <<<<<<<<<<<<<<
 * 
 * cdef enum _IncrementalFileWriterStatus:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_raise_on_error); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(__pyx_v_old_writer, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":640
 *         return writer
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if self.writer is not None:
 *             old_writer, self.writer = self.writer, None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.xmlfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_old_writer);
  __Pyx_XDECREF(__pyx_v_raise_on_error);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":663
 *     cdef int _status
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel):             # <<<<<<<<<<<<<<
 *         self._status = WRITER_STARTING
 *         self._element_stack = []
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_outfile = 0;
  PyObject *__pyx_v_encoding = 0;
  int __pyx_v_compresslevel;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outfile,&__pyx_n_s_encoding,&__pyx_n_s_compresslevel,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_outfile)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compresslevel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_outfile = values[0];
    __pyx_v_encoding = ((PyObject*)values[1]);
    __pyx_v_compresslevel = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_compresslevel == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyBytes_Type), 1, "encoding", 1))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter___cinit__(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_outfile, __pyx_v_encoding, __pyx_v_compresslevel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22_IncrementalFileWriter___cinit__(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_outfile, PyObject *__pyx_v_encoding, int __pyx_v_compresslevel) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":664
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel):
 *         self._status = WRITER_STARTING             # <<<<<<<<<<<<<<
 *         self._element_stack = []
 *         if encoding is None:
 */
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_STARTING;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":665
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel):
 *         self._status = WRITER_STARTING
 *         self._element_stack = []             # <<<<<<<<<<<<<<
 *         if encoding is None:
 *             encoding = b'ASCII'
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_element_stack);
  __Pyx_DECREF(__pyx_v_self->_element_stack);
  __pyx_v_self->_element_stack = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":666
 *         self._status = WRITER_STARTING
 *         self._element_stack = []
 *         if encoding is None:             # <<<<<<<<<<<<<<
 *             encoding = b'ASCII'
 *         self._encoding = encoding
 */
  __pyx_t_2 = (__pyx_v_encoding == ((PyObject*)Py_None));
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":667
 *         self._element_stack = []
 *         if encoding is None:
 *             encoding = b'ASCII'             # <<<<<<<<<<<<<<
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL
 */
    __Pyx_INCREF(__pyx_n_b_ASCII);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_n_b_ASCII);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":668
 *         if encoding is None:
 *             encoding = b'ASCII'
 *         self._encoding = encoding             # <<<<<<<<<<<<<<
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL
 *         self._target = _create_output_buffer(
 */
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = __pyx_v_encoding;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":669
 *             encoding = b'ASCII'
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL             # <<<<<<<<<<<<<<
 *         self._target = _create_output_buffer(
 *             outfile, self._c_encoding, compresslevel, &self._c_out)
 */
  __pyx_t_3 = (__pyx_v_encoding != ((PyObject*)Py_None));
  if ((__pyx_t_3 != 0)) {
    __pyx_t_4 = PyBytes_AS_STRING(__pyx_v_encoding);
  } else {
    __pyx_t_4 = NULL;
  }
  __pyx_v_self->_c_encoding = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":670
 *         self._encoding = encoding
 *         self._c_encoding = _cstr(encoding) if encoding is not None else NULL
 *         self._target = _create_output_buffer(             # <<<<<<<<<<<<<<
 *             outfile, self._c_encoding, compresslevel, &self._c_out)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__create_output_buffer(__pyx_v_outfile, __pyx_v_self->_c_encoding, __pyx_v_compresslevel, (&__pyx_v_self->_c_out)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__FilelikeWriter))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_target);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
  __pyx_v_self->_target = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":663
 *     cdef int _status
 * 
 *     def __cinit__(self, outfile, bytes encoding, int compresslevel):             # <<<<<<<<<<<<<<
 *         self._status = WRITER_STARTING
 *         self._element_stack = []
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":673
 *             outfile, self._c_encoding, compresslevel, &self._c_out)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_2__dealloc__(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":674
 * 
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_c_out != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":675
 *     def __dealloc__(self):
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):
 */
    xmlOutputBufferClose(__pyx_v_self->_c_out);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":673
 *             outfile, self._c_encoding, compresslevel, &self._c_out)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_out is not NULL:
 *             tree.xmlOutputBufferClose(self._c_out)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":677
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration[] = "write_declaration(self, version=None, standalone=None, doctype=None)\n\n        Write an XML declaration and (optionally) a doctype into the file.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_version = 0;
  PyObject *__pyx_v_standalone = 0;
  PyObject *__pyx_v_doctype = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_declaration (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_version,&__pyx_n_s_standalone,&__pyx_n_s_doctype,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_version);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_standalone);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_doctype);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_declaration") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_version = values[0];
    __pyx_v_standalone = values[1];
    __pyx_v_doctype = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_declaration", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_4write_declaration(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_version, __pyx_v_standalone, __pyx_v_doctype);

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

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_4write_declaration(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_version, PyObject *__pyx_v_standalone, PyObject *__pyx_v_doctype) {
  const xmlChar *__pyx_v_c_version;
  int __pyx_v_c_standalone;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  const xmlChar *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_declaration", 0);
  __Pyx_INCREF(__pyx_v_version);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":682
 *         Write an XML declaration and (optionally) a doctype into the file.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_out != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":685
 *         cdef const_xmlChar* c_version
 *         cdef int c_standalone
 *         if self._status >= WRITER_DECL_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)
 */
  __pyx_t_1 = ((__pyx_v_self->_status >= __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":686
 *         cdef int c_standalone
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")             # <<<<<<<<<<<<<<
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":687
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)             # <<<<<<<<<<<<<<
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_version); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_version, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":688
 *             raise LxmlSyntaxError("XML declaration already written")
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL             # <<<<<<<<<<<<<<
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:
 */
  __pyx_t_1 = (__pyx_v_version != Py_None);
  if ((__pyx_t_1 != 0)) {
    __pyx_t_4 = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_version);
  } else {
    __pyx_t_4 = NULL;
  }
  __pyx_v_c_version = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":689
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)             # <<<<<<<<<<<<<<
 *         if standalone is None:
 *             c_standalone = -1
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8orNone(__pyx_v_doctype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":690
 *         c_version = _xcstr(version) if version is not None else NULL
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:             # <<<<<<<<<<<<<<
 *             c_standalone = -1
 *         else:
 */
  __pyx_t_1 = (__pyx_v_standalone == Py_None);
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":691
 *         doctype = _utf8orNone(doctype)
 *         if standalone is None:
 *             c_standalone = -1             # <<<<<<<<<<<<<<
 *         else:
 *             c_standalone = 1 if standalone else 0
 */
    __pyx_v_c_standalone = -1;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":693
 *             c_standalone = -1
 *         else:
 *             c_standalone = 1 if standalone else 0             # <<<<<<<<<<<<<<
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_standalone); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {
      __pyx_t_6 = 1;
    } else {
      __pyx_t_6 = 0;
    }
    __pyx_v_c_standalone = __pyx_t_6;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":694
 *         else:
 *             c_standalone = 1 if standalone else 0
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)             # <<<<<<<<<<<<<<
 *         if doctype is not None:
 *             _writeDoctype(self._c_out, _xcstr(doctype))
 */
  __pyx_f_4lxml_5etree__writeDeclarationToBuffer(__pyx_v_self->_c_out, __pyx_v_c_version, __pyx_v_self->_c_encoding, __pyx_v_c_standalone);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":695
 *             c_standalone = 1 if standalone else 0
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:             # <<<<<<<<<<<<<<
 *             _writeDoctype(self._c_out, _xcstr(doctype))
 *             self._status = WRITER_DTD_WRITTEN
 */
  __pyx_t_5 = (__pyx_v_doctype != Py_None);
  __pyx_t_1 = (__pyx_t_5 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":696
 *         _writeDeclarationToBuffer(self._c_out, c_version, self._c_encoding, c_standalone)
 *         if doctype is not None:
 *             _writeDoctype(self._c_out, _xcstr(doctype))             # <<<<<<<<<<<<<<
 *             self._status = WRITER_DTD_WRITTEN
 *         else:
 */
    __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":697
 *         if doctype is not None:
 *             _writeDoctype(self._c_out, _xcstr(doctype))
 *             self._status = WRITER_DTD_WRITTEN             # <<<<<<<<<<<<<<
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
 */
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":699
 *             self._status = WRITER_DTD_WRITTEN
 *         else:
 *             self._status = WRITER_DECL_WRITTEN             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DECL_WRITTEN;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":700
 *         else:
 *             self._status = WRITER_DECL_WRITTEN
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def write_doctype(self, doctype):
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":677
 *             tree.xmlOutputBufferClose(self._c_out)
 * 
 *     def write_declaration(self, version=None, standalone=None, doctype=None):             # <<<<<<<<<<<<<<
 *         """write_declaration(self, version=None, standalone=None, doctype=None)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_declaration", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_version);
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":702
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype(PyObject *__pyx_v_self, PyObject *__pyx_v_doctype); /*proto*/
static char __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype[] = "write_doctype(self, doctype)\n\n        Writes the given doctype declaration verbatimly into the file.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype(PyObject *__pyx_v_self, PyObject *__pyx_v_doctype) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_doctype (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), ((PyObject *)__pyx_v_doctype));

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

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_6write_doctype(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_doctype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_doctype", 0);
  __Pyx_INCREF(__pyx_v_doctype);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":707
 *         Writes the given doctype declaration verbatimly into the file.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         if doctype is None:
 *             return
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_out != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":708
 *         """
 *         assert self._c_out is not NULL
 *         if doctype is None:             # <<<<<<<<<<<<<<
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
 */
  __pyx_t_1 = (__pyx_v_doctype == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":709
 *         assert self._c_out is not NULL
 *         if doctype is None:
 *             return             # <<<<<<<<<<<<<<
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":710
 *         if doctype is None:
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
 */
  __pyx_t_2 = ((__pyx_v_self->_status >= __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":711
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")             # <<<<<<<<<<<<<<
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":712
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)             # <<<<<<<<<<<<<<
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_v_doctype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_doctype, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":713
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))             # <<<<<<<<<<<<<<
 *         self._status = WRITER_DTD_WRITTEN
 *         self._handle_error(self._c_out.error)
 */
  __pyx_f_4lxml_5etree__writeDoctype(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_doctype));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":714
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_DTD_WRITTEN;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":715
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 *         self._status = WRITER_DTD_WRITTEN
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     def element(self, tag, attrib=None, nsmap=None, **_extra):
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":702
 *         self._handle_error(self._c_out.error)
 * 
 *     def write_doctype(self, doctype):             # <<<<<<<<<<<<<<
 *         """write_doctype(self, doctype)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write_doctype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_doctype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":717
 *         self._handle_error(self._c_out.error)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9element(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8element[] = "element(self, tag, attrib=None, nsmap=None, **_extra)\n\n        Returns a context manager that writes an opening and closing tag.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9element(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attrib = 0;
  PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("element (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrib);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, pos_args, "element") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("element", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8element(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

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

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_8element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_reversed_nsmap = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("element", 0);
  __Pyx_INCREF(__pyx_v_attrib);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":722
 *         Returns a context manager that writes an opening and closing tag.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         attributes = []
 *         if attrib is not None:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_out != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":723
 *         """
 *         assert self._c_out is not NULL
 *         attributes = []             # <<<<<<<<<<<<<<
 *         if attrib is not None:
 *             if isinstance(attrib, (dict, _Attrib)):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_attributes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":724
 *         assert self._c_out is not NULL
 *         attributes = []
 *         if attrib is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(attrib, (dict, _Attrib)):
 *                 attrib = attrib.items()
 */
  __pyx_t_2 = (__pyx_v_attrib != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":725
 *         attributes = []
 *         if attrib is not None:
 *             if isinstance(attrib, (dict, _Attrib)):             # <<<<<<<<<<<<<<
 *                 attrib = attrib.items()
 *             for name, value in attrib:
 */
    __pyx_t_3 = PyDict_Check(__pyx_v_attrib); 
    if (!__pyx_t_3) {
      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_attrib, ((PyObject*)__pyx_ptype_4lxml_5etree__Attrib)); 
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_3;
    }
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":726
 *         if attrib is not None:
 *             if isinstance(attrib, (dict, _Attrib)):
 *                 attrib = attrib.items()             # <<<<<<<<<<<<<<
 *             for name, value in attrib:
 *                 if name not in _extra:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_attrib, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_attrib, __pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":727
 *             if isinstance(attrib, (dict, _Attrib)):
 *                 attrib = attrib.items()
 *             for name, value in attrib:             # <<<<<<<<<<<<<<
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
 */
    if (PyList_CheckExact(__pyx_v_attrib) || PyTuple_CheckExact(__pyx_v_attrib)) {
      __pyx_t_5 = __pyx_v_attrib; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_attrib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_1 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L8_unpacking_done;
        __pyx_L7_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L8_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":728
 *                 attrib = attrib.items()
 *             for name, value in attrib:
 *                 if name not in _extra:             # <<<<<<<<<<<<<<
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 */
      __pyx_t_3 = (__Pyx_PyDict_Contains(__pyx_v_name, __pyx_v__extra, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = (__pyx_t_3 != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":729
 *             for name, value in attrib:
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)             # <<<<<<<<<<<<<<
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (likely(__pyx_t_1 != Py_None)) {
          PyObject* sequence = __pyx_t_1;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[7]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_8);
          #else
          __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_9);
        __pyx_t_9 = 0;
        __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":730
 *                 if name not in _extra:
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))             # <<<<<<<<<<<<<<
 *         if _extra:
 *             for name, value in _extra.iteritems():
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_ns);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ns);
        __Pyx_GIVEREF(__pyx_v_ns);
        __Pyx_INCREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_attributes, __pyx_t_8); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":731
 *                     ns, name = _getNsTag(name)
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:             # <<<<<<<<<<<<<<
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v__extra); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":732
 *                     attributes.append((ns, name, _utf8(value)))
 *         if _extra:
 *             for name, value in _extra.iteritems():             # <<<<<<<<<<<<<<
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))
 */
    __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_dict_iterator(__pyx_v__extra, 1, __pyx_n_s_iteritems, (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5);
    __pyx_t_5 = __pyx_t_8;
    __pyx_t_8 = 0;
    while (1) {
      __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_13, &__pyx_t_6, &__pyx_t_8, &__pyx_t_1, NULL, __pyx_t_14);
      if (unlikely(__pyx_t_15 == 0)) break;
      if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":733
 *         if _extra:
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)             # <<<<<<<<<<<<<<
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(__pyx_t_1 != Py_None)) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":734
 *             for name, value in _extra.iteritems():
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))             # <<<<<<<<<<<<<<
 *         reversed_nsmap = {}
 *         if nsmap:
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __Pyx_INCREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_attributes, __pyx_t_9); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":735
 *                 ns, name = _getNsTag(name)
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}             # <<<<<<<<<<<<<<
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_reversed_nsmap = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":736
 *                 attributes.append((ns, name, _utf8(value)))
 *         reversed_nsmap = {}
 *         if nsmap:             # <<<<<<<<<<<<<<
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":737
 *         reversed_nsmap = {}
 *         if nsmap:
 *             for prefix, ns in nsmap.items():             # <<<<<<<<<<<<<<
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_nsmap, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
      __pyx_t_5 = __pyx_t_9; __Pyx_INCREF(__pyx_t_5); __pyx_t_13 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    for (;;) {
      if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_5, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_5, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_9 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
        PyObject* sequence = __pyx_t_9;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L16_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L16_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L17_unpacking_done;
        __pyx_L16_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L17_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":738
 *         if nsmap:
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:             # <<<<<<<<<<<<<<
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
 */
      __pyx_t_4 = (__pyx_v_prefix != Py_None);
      __pyx_t_3 = (__pyx_t_4 != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":739
 *             for prefix, ns in nsmap.items():
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)             # <<<<<<<<<<<<<<
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix
 */
        __pyx_t_9 = __pyx_f_4lxml_5etree__utf8(__pyx_v_prefix); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":740
 *                 if prefix is not None:
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)             # <<<<<<<<<<<<<<
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)
 */
        __pyx_t_14 = __pyx_f_4lxml_5etree__prefixValidOrRaise(__pyx_v_prefix); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":741
 *                     prefix = _utf8(prefix)
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix             # <<<<<<<<<<<<<<
 *         ns, name = _getNsTag(tag)
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap))
 */
      __pyx_t_9 = __pyx_f_4lxml_5etree__utf8(__pyx_v_ns); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (unlikely(PyDict_SetItem(__pyx_v_reversed_nsmap, __pyx_t_9, __pyx_v_prefix) < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":742
 *                     _prefixValidOrRaise(prefix)
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)             # <<<<<<<<<<<<<<
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap))
 * 
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (likely(__pyx_t_5 != Py_None)) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_9);
  __pyx_t_9 = 0;
  __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8);
  __pyx_t_8 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":743
 *                 reversed_nsmap[_utf8(ns)] = prefix
 *         ns, name = _getNsTag(tag)
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap))             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_ns);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_attributes);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_attributes);
  __Pyx_GIVEREF(__pyx_v_attributes);
  __Pyx_INCREF(__pyx_v_reversed_nsmap);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_reversed_nsmap);
  __Pyx_GIVEREF(__pyx_v_reversed_nsmap);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileWriterElement)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":717
 *         self._handle_error(self._c_out.error)
 * 
 *     def element(self, tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         """element(self, tag, attrib=None, nsmap=None, **_extra)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_reversed_nsmap);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":745
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap))
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):             # <<<<<<<<<<<<<<
 *         if prefix is not None:
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_prefix) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_qname", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":746
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix is not None:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 */
  __pyx_t_1 = (__pyx_v_prefix != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":747
 *     cdef _write_qname(self, bytes name, bytes prefix):
 *         if prefix is not None:
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 */
    if (unlikely(__pyx_v_prefix == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_prefix); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_3, PyBytes_AS_STRING(__pyx_v_prefix));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":748
 *         if prefix is not None:
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
 */
    xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__60);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":749
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ':')
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_start_element(self, element_config):
 */
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_name); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  xmlOutputBufferWrite(__pyx_v_self->_c_out, __pyx_t_3, PyBytes_AS_STRING(__pyx_v_name));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":745
 *         return _FileWriterElement(self, (ns, name, attributes, reversed_nsmap))
 * 
 *     cdef _write_qname(self, bytes name, bytes prefix):             # <<<<<<<<<<<<<<
 *         if prefix is not None:
 *             tree.xmlOutputBufferWrite(self._c_out, len(prefix), _cstr(prefix))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":751
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
 *     cdef _write_start_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_element_config) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_nsmap = NULL;
  PyObject *__pyx_v_flat_namespace_map = NULL;
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_start_element", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":752
 * 
 *     cdef _write_start_element(self, element_config):
 *         if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config
 */
  __pyx_t_1 = ((__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":753
 *     cdef _write_start_element(self, element_config):
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")             # <<<<<<<<<<<<<<
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":754
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config             # <<<<<<<<<<<<<<
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_element_config))) || (PyList_CheckExact(__pyx_v_element_config))) {
    PyObject* sequence = __pyx_v_element_config;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_v_element_config); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_ns = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_name = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_attributes = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_nsmap = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":755
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)             # <<<<<<<<<<<<<<
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_nsmap))||((__pyx_v_nsmap) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_nsmap)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(__pyx_v_self, ((PyObject*)__pyx_v_nsmap)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_unpacking_done:;
  }
  __pyx_v_flat_namespace_map = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_new_namespaces = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":756
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
 *         self._write_qname(name, prefix)
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_ns))||((__pyx_v_ns) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_ns)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_v_flat_namespace_map))||((__pyx_v_flat_namespace_map) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_flat_namespace_map)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyList_CheckExact(__pyx_v_new_namespaces))||((__pyx_v_new_namespaces) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_new_namespaces)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(__pyx_v_self, ((PyObject*)__pyx_v_ns), ((PyObject*)__pyx_v_flat_namespace_map), ((PyObject*)__pyx_v_new_namespaces)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_prefix = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":757
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')             # <<<<<<<<<<<<<<
 *         self._write_qname(name, prefix)
 *         self._write_attributes_and_namespaces(
 */
  xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__62);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":758
 *         prefix = self._find_prefix(ns, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
 *         self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 *         self._write_attributes_and_namespaces(
 *             attributes, flat_namespace_map, new_namespaces)
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_name)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyBytes_CheckExact(__pyx_v_prefix))||((__pyx_v_prefix) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_prefix)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_prefix)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":760
 *         self._write_qname(name, prefix)
 *         self._write_attributes_and_namespaces(
 *             attributes, flat_namespace_map, new_namespaces)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         self._handle_error(self._c_out.error)
 */
  if (!(likely(PyList_CheckExact(__pyx_v_attributes))||((__pyx_v_attributes) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_attributes)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_v_flat_namespace_map))||((__pyx_v_flat_namespace_map) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_flat_namespace_map)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyList_CheckExact(__pyx_v_new_namespaces))||((__pyx_v_new_namespaces) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_new_namespaces)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":759
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '<')
 *         self._write_qname(name, prefix)
 *         self._write_attributes_and_namespaces(             # <<<<<<<<<<<<<<
 *             attributes, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(__pyx_v_self, ((PyObject*)__pyx_v_attributes), ((PyObject*)__pyx_v_flat_namespace_map), ((PyObject*)__pyx_v_new_namespaces)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":761
 *         self._write_attributes_and_namespaces(
 *             attributes, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
  xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__63);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":762
 *             attributes, flat_namespace_map, new_namespaces)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":764
 *         self._handle_error(self._c_out.error)
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))             # <<<<<<<<<<<<<<
 *         self._status = WRITER_IN_ELEMENT
 * 
 */
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_ns);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ns);
  __Pyx_GIVEREF(__pyx_v_ns);
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_prefix);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_prefix);
  __Pyx_GIVEREF(__pyx_v_prefix);
  __Pyx_INCREF(__pyx_v_flat_namespace_map);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_flat_namespace_map);
  __Pyx_GIVEREF(__pyx_v_flat_namespace_map);
  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->_element_stack, __pyx_t_5); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":765
 * 
 *         self._element_stack.append((ns, name, prefix, flat_namespace_map))
 *         self._status = WRITER_IN_ELEMENT             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_attributes_and_namespaces(self, list attributes,
 */
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":751
 *         tree.xmlOutputBufferWrite(self._c_out, len(name), _cstr(name))
 * 
 *     cdef _write_start_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_start_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_nsmap);
  __Pyx_XDECREF(__pyx_v_flat_namespace_map);
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":767
 *         self._status = WRITER_IN_ELEMENT
 * 
 *     cdef _write_attributes_and_namespaces(self, list attributes,             # <<<<<<<<<<<<<<
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes, PyObject *__pyx_v_flat_namespace_map, PyObject *__pyx_v_new_namespaces) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_attributes_and_namespaces", 0);
  __Pyx_INCREF(__pyx_v_attributes);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":770
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
 *         if attributes:             # <<<<<<<<<<<<<<
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [
 */
  __pyx_t_1 = (__pyx_v_attributes != Py_None) && (PyList_GET_SIZE(__pyx_v_attributes) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":772
 *         if attributes:
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [             # <<<<<<<<<<<<<<
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":774
 *             attributes = [
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]             # <<<<<<<<<<<<<<
 *         if new_namespaces:
 *             new_namespaces.sort()
 */
    if (unlikely(__pyx_v_attributes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":773
 *             # _find_prefix() may append to new_namespaces => build them first
 *             attributes = [
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)             # <<<<<<<<<<<<<<
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:
 */
      if (!(likely(PyBytes_CheckExact(__pyx_v_ns))||((__pyx_v_ns) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_ns)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(__pyx_v_self, ((PyObject*)__pyx_v_ns), __pyx_v_flat_namespace_map, __pyx_v_new_namespaces); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      __Pyx_INCREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_attributes, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":775
 *                 (self._find_prefix(ns, flat_namespace_map, new_namespaces), name, value)
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:             # <<<<<<<<<<<<<<
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
 */
  __pyx_t_1 = (__pyx_v_new_namespaces != Py_None) && (PyList_GET_SIZE(__pyx_v_new_namespaces) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":776
 *                 for ns, name, value in attributes ]
 *         if new_namespaces:
 *             new_namespaces.sort()             # <<<<<<<<<<<<<<
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:
 */
    if (unlikely(__pyx_v_new_namespaces == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "sort");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_11 = PyList_Sort(__pyx_v_new_namespaces); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":777
 *         if new_namespaces:
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)             # <<<<<<<<<<<<<<
 *         if attributes:
 *             self._write_attributes_list(attributes)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(__pyx_v_self, __pyx_v_new_namespaces); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":778
 *             new_namespaces.sort()
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:             # <<<<<<<<<<<<<<
 *             self._write_attributes_list(attributes)
 * 
 */
  __pyx_t_1 = (__pyx_v_attributes != Py_None) && (PyList_GET_SIZE(__pyx_v_attributes) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":779
 *             self._write_attributes_list(new_namespaces)
 *         if attributes:
 *             self._write_attributes_list(attributes)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_attributes_list(self, list attributes):
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(__pyx_v_self, __pyx_v_attributes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":767
 *         self._status = WRITER_IN_ELEMENT
 * 
 *     cdef _write_attributes_and_namespaces(self, list attributes,             # <<<<<<<<<<<<<<
 *                                           dict flat_namespace_map,
 *                                           list new_namespaces):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_attributes_and_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":781
 *             self._write_attributes_list(attributes)
 * 
 *     cdef _write_attributes_list(self, list attributes):             # <<<<<<<<<<<<<<
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_attributes) {
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_attributes_list", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":782
 * 
 *     cdef _write_attributes_list(self, list attributes):
 *         for prefix, name, value in attributes:             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
 */
  if (unlikely(__pyx_v_attributes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":783
 *     cdef _write_attributes_list(self, list attributes):
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')             # <<<<<<<<<<<<<<
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 */
    xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__14);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":784
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(value), NULL)
 */
    if (!(likely(PyBytes_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_name)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!(likely(PyBytes_CheckExact(__pyx_v_prefix))||((__pyx_v_prefix) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_prefix)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_prefix)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":785
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(value), NULL)
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 */
    xmlOutputBufferWrite(__pyx_v_self->_c_out, 2, __pyx_k__64);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":786
 *             self._write_qname(name, prefix)
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(value), NULL)             # <<<<<<<<<<<<<<
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 * 
 */
    xmlOutputBufferWriteEscape(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value), NULL);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":787
 *             tree.xmlOutputBufferWrite(self._c_out, 2, '="')
 *             tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(value), NULL)
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_end_element(self, element_config):
 */
    xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__53);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":781
 *             self._write_attributes_list(attributes)
 * 
 *     cdef _write_attributes_list(self, list attributes):             # <<<<<<<<<<<<<<
 *         for prefix, name, value in attributes:
 *             tree.xmlOutputBufferWrite(self._c_out, 1, ' ')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_attributes_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":789
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 * 
 *     cdef _write_end_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_element_config) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_end_element", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":790
 * 
 *     cdef _write_end_element(self, element_config):
 *         if self._status != WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 */
  __pyx_t_1 = ((__pyx_v_self->_status != __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":791
 *     cdef _write_end_element(self, element_config):
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":792
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  __pyx_t_4 = (!__pyx_t_1);
  if (!__pyx_t_4) {
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 2, NULL, NULL, &__pyx_slice__66, 0, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_element_config, 0, 2, NULL, NULL, &__pyx_slice__67, 0, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __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;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __pyx_t_1;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":793
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")             # <<<<<<<<<<<<<<
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 793; __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, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":795
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
 *         name, prefix = self._element_stack.pop()[1:3]             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *         self._write_qname(name, prefix)
 */
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __Pyx_PyList_Pop(__pyx_v_self->_element_stack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_3, 1, 3, NULL, NULL, &__pyx_slice__69, 1, 1, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_prefix = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":796
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 *         tree.xmlOutputBufferWrite(self._c_out, 2, '</')             # <<<<<<<<<<<<<<
 *         self._write_qname(name, prefix)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 */
  xmlOutputBufferWrite(__pyx_v_self->_c_out, 2, __pyx_k__70);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":797
 *         name, prefix = self._element_stack.pop()[1:3]
 *         tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *         self._write_qname(name, prefix)             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_name)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyBytes_CheckExact(__pyx_v_prefix))||((__pyx_v_prefix) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_prefix)->tp_name), 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_prefix)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":798
 *         tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *         self._write_qname(name, prefix)
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')             # <<<<<<<<<<<<<<
 * 
 *         if not self._element_stack:
 */
  xmlOutputBufferWrite(__pyx_v_self->_c_out, 1, __pyx_k__63);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":800
 *         tree.xmlOutputBufferWrite(self._c_out, 1, '>')
 * 
 *         if not self._element_stack:             # <<<<<<<<<<<<<<
 *             self._status = WRITER_FINISHED
 *         self._handle_error(self._c_out.error)
 */
  __pyx_t_6 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  __pyx_t_4 = ((!__pyx_t_6) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":801
 * 
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 *         self._handle_error(self._c_out.error)
 * 
 */
    __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":802
 *         if not self._element_stack:
 *             self._status = WRITER_FINISHED
 *         self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":789
 *             tree.xmlOutputBufferWrite(self._c_out, 1, '"')
 * 
 *     cdef _write_end_element(self, element_config):             # <<<<<<<<<<<<<<
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._write_end_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":804
 *         self._handle_error(self._c_out.error)
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):             # <<<<<<<<<<<<<<
 *         if href is None:
 *             return None
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_href, PyObject *__pyx_v_flat_namespaces_map, PyObject *__pyx_v_new_namespaces) {
  PyObject *__pyx_v_prefixes = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_prefix", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":805
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 *         if href is None:             # <<<<<<<<<<<<<<
 *             return None
 *         if href in flat_namespaces_map:
 */
  __pyx_t_1 = (__pyx_v_href == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":806
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):
 *         if href is None:
 *             return None             # <<<<<<<<<<<<<<
 *         if href in flat_namespaces_map:
 *             return flat_namespaces_map[href]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":807
 *         if href is None:
 *             return None
 *         if href in flat_namespaces_map:             # <<<<<<<<<<<<<<
 *             return flat_namespaces_map[href]
 *         # need to create a new prefix
 */
  if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = (__Pyx_PyDict_Contains(__pyx_v_href, __pyx_v_flat_namespaces_map, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":808
 *             return None
 *         if href in flat_namespaces_map:
 *             return flat_namespaces_map[href]             # <<<<<<<<<<<<<<
 *         # need to create a new prefix
 *         prefixes = flat_namespaces_map.values()
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_flat_namespaces_map, __pyx_v_href); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":810
 *             return flat_namespaces_map[href]
 *         # need to create a new prefix
 *         prefixes = flat_namespaces_map.values()             # <<<<<<<<<<<<<<
 *         i = 0
 *         while True:
 */
  if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "values");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __Pyx_PyDict_Values(__pyx_v_flat_namespaces_map); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_prefixes = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":811
 *         # need to create a new prefix
 *         prefixes = flat_namespaces_map.values()
 *         i = 0             # <<<<<<<<<<<<<<
 *         while True:
 *             prefix = _utf8('ns%d' % i)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_i = __pyx_int_0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":812
 *         prefixes = flat_namespaces_map.values()
 *         i = 0
 *         while True:             # <<<<<<<<<<<<<<
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:
 */
  while (1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":813
 *         i = 0
 *         while True:
 *             prefix = _utf8('ns%d' % i)             # <<<<<<<<<<<<<<
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))
 */
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_ns_d, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_4lxml_5etree__utf8(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":814
 *         while True:
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:             # <<<<<<<<<<<<<<
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix
 */
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_prefix, __pyx_v_prefixes, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":815
 *             prefix = _utf8('ns%d' % i)
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))             # <<<<<<<<<<<<<<
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix
 */
      if (unlikely(__pyx_v_new_namespaces == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_n_b_xmlns);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_b_xmlns);
      __Pyx_GIVEREF(__pyx_n_b_xmlns);
      __Pyx_INCREF(__pyx_v_prefix);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      __Pyx_INCREF(__pyx_v_href);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_href);
      __Pyx_GIVEREF(__pyx_v_href);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":816
 *             if prefix not in prefixes:
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix             # <<<<<<<<<<<<<<
 *                 return prefix
 *             i += 1
 */
      if (unlikely(__pyx_v_flat_namespaces_map == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (unlikely(PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_href, __pyx_v_prefix) < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":817
 *                 new_namespaces.append((b'xmlns', prefix, href))
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_prefix);
      __pyx_r = __pyx_v_prefix;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":818
 *                 flat_namespaces_map[href] = prefix
 *                 return prefix
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *     cdef _collect_namespaces(self, dict nsmap):
 */
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":804
 *         self._handle_error(self._c_out.error)
 * 
 *     cdef _find_prefix(self, bytes href, dict flat_namespaces_map, list new_namespaces):             # <<<<<<<<<<<<<<
 *         if href is None:
 *             return None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._find_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefixes);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":820
 *             i += 1
 * 
 *     cdef _collect_namespaces(self, dict nsmap):             # <<<<<<<<<<<<<<
 *         new_namespaces = []
 *         flat_namespaces_map = {}
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, PyObject *__pyx_v_nsmap) {
  PyObject *__pyx_v_new_namespaces = NULL;
  PyObject *__pyx_v_flat_namespaces_map = NULL;
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collect_namespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":821
 * 
 *     cdef _collect_namespaces(self, dict nsmap):
 *         new_namespaces = []             # <<<<<<<<<<<<<<
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":822
 *     cdef _collect_namespaces(self, dict nsmap):
 *         new_namespaces = []
 *         flat_namespaces_map = {}             # <<<<<<<<<<<<<<
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_flat_namespaces_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":823
 *         new_namespaces = []
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():             # <<<<<<<<<<<<<<
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_nsmap == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_nsmap, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":824
 *         flat_namespaces_map = {}
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix             # <<<<<<<<<<<<<<
 *             if prefix is None:
 *                 new_namespaces.append((None, b'xmlns', ns))
 */
    if (unlikely(PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_ns, __pyx_v_prefix) < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":825
 *         for ns, prefix in nsmap.iteritems():
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:             # <<<<<<<<<<<<<<
 *                 new_namespaces.append((None, b'xmlns', ns))
 *             else:
 */
    __pyx_t_8 = (__pyx_v_prefix == Py_None);
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":826
 *             flat_namespaces_map[ns] = prefix
 *             if prefix is None:
 *                 new_namespaces.append((None, b'xmlns', ns))             # <<<<<<<<<<<<<<
 *             else:
 *                 new_namespaces.append((b'xmlns', prefix, ns))
 */
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_6, 0, Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_INCREF(__pyx_n_b_xmlns);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_b_xmlns);
      __Pyx_GIVEREF(__pyx_n_b_xmlns);
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":828
 *                 new_namespaces.append((None, b'xmlns', ns))
 *             else:
 *                 new_namespaces.append((b'xmlns', prefix, ns))             # <<<<<<<<<<<<<<
 *         # merge in flat namespace map of parent
 *         if self._element_stack:
 */
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_n_b_xmlns);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_b_xmlns);
      __Pyx_GIVEREF(__pyx_n_b_xmlns);
      __Pyx_INCREF(__pyx_v_prefix);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_prefix);
      __Pyx_GIVEREF(__pyx_v_prefix);
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_new_namespaces, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":830
 *                 new_namespaces.append((b'xmlns', prefix, ns))
 *         # merge in flat namespace map of parent
 *         if self._element_stack:             # <<<<<<<<<<<<<<
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():
 *                 if flat_namespaces_map.get(ns) is None:
 */
  __pyx_t_9 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
  if (__pyx_t_9) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":831
 *         # merge in flat namespace map of parent
 *         if self._element_stack:
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():             # <<<<<<<<<<<<<<
 *                 if flat_namespaces_map.get(ns) is None:
 *                     # unknown or empty prefix => prefer a 'real' prefix
 */
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_self->_element_stack, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_t_5 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = __Pyx_dict_iterator(((PyObject*)__pyx_t_5), 1, __pyx_n_s_iteritems, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_ns, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":832
 *         if self._element_stack:
 *             for ns, prefix in (<dict>self._element_stack[-1][-1]).iteritems():
 *                 if flat_namespaces_map.get(ns) is None:             # <<<<<<<<<<<<<<
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix
 */
      __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_flat_namespaces_map, __pyx_v_ns, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = (__pyx_t_5 == Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = (__pyx_t_9 != 0);
      if (__pyx_t_8) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":834
 *                 if flat_namespaces_map.get(ns) is None:
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix             # <<<<<<<<<<<<<<
 *         return flat_namespaces_map, new_namespaces
 * 
 */
        if (unlikely(PyDict_SetItem(__pyx_v_flat_namespaces_map, __pyx_v_ns, __pyx_v_prefix) < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":835
 *                     # unknown or empty prefix => prefer a 'real' prefix
 *                     flat_namespaces_map[ns] = prefix
 *         return flat_namespaces_map, new_namespaces             # <<<<<<<<<<<<<<
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_flat_namespaces_map);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flat_namespaces_map);
  __Pyx_GIVEREF(__pyx_v_flat_namespaces_map);
  __Pyx_INCREF(__pyx_v_new_namespaces);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_new_namespaces);
  __Pyx_GIVEREF(__pyx_v_new_namespaces);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":820
 *             i += 1
 * 
 *     cdef _collect_namespaces(self, dict nsmap):             # <<<<<<<<<<<<<<
 *         new_namespaces = []
 *         flat_namespaces_map = {}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._collect_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_namespaces);
  __Pyx_XDECREF(__pyx_v_flat_namespaces_map);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":837
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10write[] = "write(self, *args, with_tail=True, pretty_print=False)\n\n        Write subtrees or strings into the file.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_with_tail;
  int __pyx_v_pretty_print;
  PyObject *__pyx_v_args = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 0) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 0, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_with_tail,&__pyx_n_s_pretty_print,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 0; index < 2 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "write") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    if (values[0]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_with_tail = ((int)1);
    }
    if (values[1]) {
      __pyx_v_pretty_print = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_pretty_print == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_pretty_print = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10write(((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)__pyx_v_self), __pyx_v_with_tail, __pyx_v_pretty_print, __pyx_v_args);

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

static PyObject *__pyx_pf_4lxml_5etree_22_IncrementalFileWriter_10write(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_with_tail, int __pyx_v_pretty_print, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_content = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":842
 *         Write subtrees or strings into the file.
 *         """
 *         assert self._c_out is not NULL             # <<<<<<<<<<<<<<
 *         for content in args:
 *             if _isString(content):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_out != NULL) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":843
 *         """
 *         assert self._c_out is not NULL
 *         for content in args:             # <<<<<<<<<<<<<<
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 */
  __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_content, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":844
 *         assert self._c_out is not NULL
 *         for content in args:
 *             if _isString(content):             # <<<<<<<<<<<<<<
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 */
    __pyx_t_4 = (_isString(__pyx_v_content) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":845
 *         for content in args:
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")
 */
      __pyx_t_4 = ((__pyx_v_self->_status != __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":846
 *             if _isString(content):
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():             # <<<<<<<<<<<<<<
 *                         raise LxmlSyntaxError("not in an element")
 *                 content = _utf8(content)
 */
        __pyx_t_4 = (__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT);
        if (!__pyx_t_4) {
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_content, __pyx_n_s_strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_7 = __pyx_t_6;
        } else {
          __pyx_t_7 = __pyx_t_4;
        }
        if (__pyx_t_7) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":847
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *                 content = _utf8(content)
 *                 tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
 */
          __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 847; __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, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[7]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":848
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")
 *                 content = _utf8(content)             # <<<<<<<<<<<<<<
 *                 tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
 *             elif iselement(content):
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_content, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":849
 *                         raise LxmlSyntaxError("not in an element")
 *                 content = _utf8(content)
 *                 tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)             # <<<<<<<<<<<<<<
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:
 */
      xmlOutputBufferWriteEscape(__pyx_v_self->_c_out, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_content), NULL);
      goto __pyx_L5;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":850
 *                 content = _utf8(content)
 *                 tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
 *             elif iselement(content):             # <<<<<<<<<<<<<<
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_iselement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 850; __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[7]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_content);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_content);
    __Pyx_GIVEREF(__pyx_v_content);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":851
 *                 tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,
 */
      __pyx_t_7 = ((__pyx_v_self->_status > __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT) != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":852
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")             # <<<<<<<<<<<<<<
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,
 *                                    self._c_encoding, NULL, OUTPUT_METHOD_XML,
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":853
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,             # <<<<<<<<<<<<<<
 *                                    self._c_encoding, NULL, OUTPUT_METHOD_XML,
 *                                    False, False, pretty_print, with_tail, False)
 */
      __pyx_f_4lxml_5etree__writeNodeToBuffer(__pyx_v_self->_c_out, ((struct LxmlElement *)__pyx_v_content)->_c_node, __pyx_v_self->_c_encoding, NULL, __pyx_e_4lxml_5etree_OUTPUT_METHOD_XML, 0, 0, __pyx_v_pretty_print, __pyx_v_with_tail, 0);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":856
 *                                    self._c_encoding, NULL, OUTPUT_METHOD_XML,
 *                                    False, False, pretty_print, with_tail, False)
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if not self._element_stack:
 *                         self._status = WRITER_FINISHED
 */
      __pyx_t_7 = ((((struct LxmlElement *)__pyx_v_content)->_c_node->type == XML_ELEMENT_NODE) != 0);
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":857
 *                                    False, False, pretty_print, with_tail, False)
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:
 *                     if not self._element_stack:             # <<<<<<<<<<<<<<
 *                         self._status = WRITER_FINISHED
 *             else:
 */
        __pyx_t_7 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
        __pyx_t_4 = ((!__pyx_t_7) != 0);
        if (__pyx_t_4) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":858
 *                 if (<_Element>content)._c_node.type == tree.XML_ELEMENT_NODE:
 *                     if not self._element_stack:
 *                         self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError("got invalid input value of type %s, expected string or Element" % type(content))
 */
          __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;
          goto __pyx_L10;
        }
        __pyx_L10:;
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":860
 *                         self._status = WRITER_FINISHED
 *             else:
 *                 raise TypeError("got invalid input value of type %s, expected string or Element" % type(content))             # <<<<<<<<<<<<<<
 *             self._handle_error(self._c_out.error)
 * 
 */
      __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_got_invalid_input_value_of_type, ((PyObject *)Py_TYPE(__pyx_v_content))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":861
 *             else:
 *                 raise TypeError("got invalid input value of type %s, expected string or Element" % type(content))
 *             self._handle_error(self._c_out.error)             # <<<<<<<<<<<<<<
 * 
 *     cdef _close(self, bint raise_on_error):
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 861; __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_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":837
 *         return flat_namespaces_map, new_namespaces
 * 
 *     def write(self, *args, bint with_tail=True, bint pretty_print=False):             # <<<<<<<<<<<<<<
 *         """write(self, *args, with_tail=True, pretty_print=False)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_content);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":863
 *             self._handle_error(self._c_out.error)
 * 
 *     cdef _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_raise_on_error) {
  int __pyx_v_error_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":864
 * 
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
 */
  __pyx_t_1 = (__pyx_v_raise_on_error != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":865
 *     cdef _close(self, bint raise_on_error):
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:             # <<<<<<<<<<<<<<
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:
 */
    __pyx_t_1 = ((__pyx_v_self->_status < __pyx_e_4lxml_5etree_WRITER_IN_ELEMENT) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":866
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":867
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:             # <<<<<<<<<<<<<<
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error
 */
    __pyx_t_1 = (__pyx_v_self->_element_stack != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_element_stack) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":868
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")             # <<<<<<<<<<<<<<
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 868; __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, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":869
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error             # <<<<<<<<<<<<<<
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 */
  __pyx_t_4 = __pyx_v_self->_c_out->error;
  __pyx_v_error_result = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":870
 *                 raise LxmlSyntaxError("pending open tags on close")
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result > 0:
 */
  __pyx_t_1 = ((__pyx_v_error_result == XML_ERR_OK) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":871
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 *             if error_result > 0:
 *                 error_result = xmlerror.XML_ERR_OK
 */
    __pyx_v_error_result = xmlOutputBufferClose(__pyx_v_self->_c_out);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":872
 *         if error_result == xmlerror.XML_ERR_OK:
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result > 0:             # <<<<<<<<<<<<<<
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_error_result > 0) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":873
 *             error_result = tree.xmlOutputBufferClose(self._c_out)
 *             if error_result > 0:
 *                 error_result = xmlerror.XML_ERR_OK             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)
 */
      __pyx_v_error_result = XML_ERR_OK;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":875
 *                 error_result = xmlerror.XML_ERR_OK
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)             # <<<<<<<<<<<<<<
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL
 */
    xmlOutputBufferClose(__pyx_v_self->_c_out);
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":876
 *         else:
 *             tree.xmlOutputBufferClose(self._c_out)
 *         self._status = WRITER_FINISHED             # <<<<<<<<<<<<<<
 *         self._c_out = NULL
 *         del self._element_stack[:]
 */
  __pyx_v_self->_status = __pyx_e_4lxml_5etree_WRITER_FINISHED;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":877
 *             tree.xmlOutputBufferClose(self._c_out)
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL             # <<<<<<<<<<<<<<
 *         del self._element_stack[:]
 *         if raise_on_error:
 */
  __pyx_v_self->_c_out = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":878
 *         self._status = WRITER_FINISHED
 *         self._c_out = NULL
 *         del self._element_stack[:]             # <<<<<<<<<<<<<<
 *         if raise_on_error:
 *             self._handle_error(error_result)
 */
  if (unlikely(__pyx_v_self->_element_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__Pyx_PyObject_DelSlice(__pyx_v_self->_element_stack, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":879
 *         self._c_out = NULL
 *         del self._element_stack[:]
 *         if raise_on_error:             # <<<<<<<<<<<<<<
 *             self._handle_error(error_result)
 * 
 */
  __pyx_t_1 = (__pyx_v_raise_on_error != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":880
 *         del self._element_stack[:]
 *         if raise_on_error:
 *             self._handle_error(error_result)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handle_error(self, int error_result):
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_error_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":863
 *             self._handle_error(self._c_out.error)
 * 
 *     cdef _close(self, bint raise_on_error):             # <<<<<<<<<<<<<<
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":882
 *             self._handle_error(error_result)
 * 
 *     cdef _handle_error(self, int error_result):             # <<<<<<<<<<<<<<
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:
 */

static PyObject *__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_self, int __pyx_v_error_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_error", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":883
 * 
 *     cdef _handle_error(self, int error_result):
 *         if error_result != xmlerror.XML_ERR_OK:             # <<<<<<<<<<<<<<
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()
 */
  __pyx_t_1 = ((__pyx_v_error_result != XML_ERR_OK) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":884
 *     cdef _handle_error(self, int error_result):
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:             # <<<<<<<<<<<<<<
 *                 self._target._exc_context._raise_if_stored()
 *             _raiseSerialisationError(error_result)
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_target) != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":885
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *             _raiseSerialisationError(error_result)
 * 
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_target->_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_self->_target->_exc_context); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":886
 *             if self._target is not None:
 *                 self._target._exc_context._raise_if_stored()
 *             _raiseSerialisationError(error_result)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__raiseSerialisationError(__pyx_v_error_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":882
 *             self._handle_error(error_result)
 * 
 *     cdef _handle_error(self, int error_result):             # <<<<<<<<<<<<<<
 *         if error_result != xmlerror.XML_ERR_OK:
 *             if self._target is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IncrementalFileWriter._handle_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":895
 *     cdef _IncrementalFileWriter _writer
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._element = element_config
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer = 0;
  PyObject *__pyx_v_element_config = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_writer,&__pyx_n_s_element_config,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_writer)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element_config)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)values[0]);
    __pyx_v_element_config = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_writer), __pyx_ptype_4lxml_5etree__IncrementalFileWriter, 0, "writer", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileWriterElement___cinit__(((struct __pyx_obj_4lxml_5etree__FileWriterElement *)__pyx_v_self), __pyx_v_writer, __pyx_v_element_config);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_18_FileWriterElement___cinit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *__pyx_v_writer, PyObject *__pyx_v_element_config) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":896
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config):
 *         self._writer = writer             # <<<<<<<<<<<<<<
 *         self._element = element_config
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_writer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_writer));
  __Pyx_GOTREF(__pyx_v_self->_writer);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_writer));
  __pyx_v_self->_writer = __pyx_v_writer;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":897
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config):
 *         self._writer = writer
 *         self._element = element_config             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_INCREF(__pyx_v_element_config);
  __Pyx_GIVEREF(__pyx_v_element_config);
  __Pyx_GOTREF(__pyx_v_self->_element);
  __Pyx_DECREF(__pyx_v_self->_element);
  __pyx_v_self->_element = __pyx_v_element_config;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":895
 *     cdef _IncrementalFileWriter _writer
 * 
 *     def __cinit__(self, _IncrementalFileWriter writer not None, element_config):             # <<<<<<<<<<<<<<
 *         self._writer = writer
 *         self._element = element_config
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":899
 *         self._element = element_config
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._write_start_element(self._element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileWriterElement_2__enter__(((struct __pyx_obj_4lxml_5etree__FileWriterElement *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_2__enter__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":900
 * 
 *     def __enter__(self):
 *         self._writer._write_start_element(self._element)             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 */
  __pyx_t_1 = __pyx_v_self->_element;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element(__pyx_v_self->_writer, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 900; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":899
 *         self._element = element_config
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self._writer._write_start_element(self._element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":902
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc_tb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__(((struct __pyx_obj_4lxml_5etree__FileWriterElement *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

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

static PyObject *__pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__(struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":903
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self._writer._write_end_element(self._element)             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __pyx_v_self->_element;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element(__pyx_v_self->_writer, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 903; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":902
 *         self._writer._write_start_element(self._element)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self._writer._write_end_element(self._element)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._FileWriterElement.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":66
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9iterparse_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9iterparse_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  PyObject *__pyx_v_dtd_validation = 0;
  PyObject *__pyx_v_load_dtd = 0;
  PyObject *__pyx_v_no_network = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  PyObject *__pyx_v_compact = 0;
  PyObject *__pyx_v_resolve_entities = 0;
  PyObject *__pyx_v_remove_comments = 0;
  PyObject *__pyx_v_remove_pis = 0;
  PyObject *__pyx_v_strip_cdata = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_html = 0;
  PyObject *__pyx_v_recover = 0;
  PyObject *__pyx_v_huge_tree = 0;
  struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_events,&__pyx_n_s_tag,&__pyx_n_s_attribute_defaults,&__pyx_n_s_dtd_validation,&__pyx_n_s_load_dtd,&__pyx_n_s_no_network,&__pyx_n_s_remove_blank_text,&__pyx_n_s_compact,&__pyx_n_s_resolve_entities,&__pyx_n_s_remove_comments,&__pyx_n_s_remove_pis,&__pyx_n_s_strip_cdata,&__pyx_n_s_encoding,&__pyx_n_s_html,&__pyx_n_s_recover,&__pyx_n_s_huge_tree,&__pyx_n_s_schema,0};
    PyObject* values[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_tuple__75);
    values[2] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":67
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,             # <<<<<<<<<<<<<<
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 */
    values[3] = ((PyObject *)Py_False);
    values[4] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":68
 *     def __init__(self, source, events=(u"end",), *, tag=None,
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,             # <<<<<<<<<<<<<<
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 */
    values[5] = ((PyObject *)Py_False);
    values[6] = ((PyObject *)Py_True);
    values[7] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":69
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,             # <<<<<<<<<<<<<<
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False,
 */
    values[8] = ((PyObject *)Py_True);
    values[9] = ((PyObject *)Py_True);
    values[10] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":70
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,             # <<<<<<<<<<<<<<
 *                  html=False, recover=None, huge_tree=False,
 *                  XMLSchema schema=None):
 */
    values[11] = ((PyObject *)Py_False);
    values[12] = ((PyObject *)Py_True);
    values[13] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":71
 *                  compact=True, resolve_entities=True, remove_comments=False,
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False,             # <<<<<<<<<<<<<<
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
 */
    values[14] = ((PyObject *)Py_False);
    values[15] = ((PyObject *)Py_None);
    values[16] = ((PyObject *)Py_False);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":72
 *                  remove_pis=False, strip_cdata=True, encoding=None,
 *                  html=False, recover=None, huge_tree=False,
 *                  XMLSchema schema=None):             # <<<<<<<<<<<<<<
 *         if not hasattr(source, 'read'):
 *             self._filename = source
 */
    values[17] = (PyObject *)((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_events);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && likely(kw_args <= 16)) {
        Py_ssize_t index;
        for (index = 2; index < 18 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_events = values[1];
    __pyx_v_tag = values[2];
    __pyx_v_attribute_defaults = values[3];
    __pyx_v_dtd_validation = values[4];
    __pyx_v_load_dtd = values[5];
    __pyx_v_no_network = values[6];
    __pyx_v_remove_blank_text = values[7];
    __pyx_v_compact = values[8];
    __pyx_v_resolve_entities = values[9];
    __pyx_v_remove_comments = values[10];
    __pyx_v_remove_pis = values[11];
    __pyx_v_strip_cdata = values[12];
    __pyx_v_encoding = values[13];
    __pyx_v_html = values[14];
    __pyx_v_recover = values[15];
    __pyx_v_huge_tree = values[16];
    __pyx_v_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)values[17]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.iterparse.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_4lxml_5etree_XMLSchema, 1, "schema", 0))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse___init__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v_source, __pyx_v_events, __pyx_v_tag, __pyx_v_attribute_defaults, __pyx_v_dtd_validation, __pyx_v_load_dtd, __pyx_v_no_network, __pyx_v_remove_blank_text, __pyx_v_compact, __pyx_v_resolve_entities, __pyx_v_remove_comments, __pyx_v_remove_pis, __pyx_v_strip_cdata, __pyx_v_encoding, __pyx_v_html, __pyx_v_recover, __pyx_v_huge_tree, __pyx_v_schema);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":66
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_9iterparse___init__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_events, PyObject *__pyx_v_tag, PyObject *__pyx_v_attribute_defaults, PyObject *__pyx_v_dtd_validation, PyObject *__pyx_v_load_dtd, PyObject *__pyx_v_no_network, PyObject *__pyx_v_remove_blank_text, PyObject *__pyx_v_compact, PyObject *__pyx_v_resolve_entities, PyObject *__pyx_v_remove_comments, PyObject *__pyx_v_remove_pis, PyObject *__pyx_v_strip_cdata, PyObject *__pyx_v_encoding, PyObject *__pyx_v_html, PyObject *__pyx_v_recover, PyObject *__pyx_v_huge_tree, struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_schema) {
  struct __pyx_obj_4lxml_5etree__FeedParser *__pyx_v_parser = NULL;
  PyObject *__pyx_v_event = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_INCREF(__pyx_v_events);
  __Pyx_INCREF(__pyx_v_recover);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":73
 *                  html=False, recover=None, huge_tree=False,
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):             # <<<<<<<<<<<<<<
 *             self._filename = source
 *             if not python.IS_PYTHON3:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_source, __pyx_n_s_read); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":74
 *                  XMLSchema schema=None):
 *         if not hasattr(source, 'read'):
 *             self._filename = source             # <<<<<<<<<<<<<<
 *             if not python.IS_PYTHON3:
 *                 source = _encodeFilename(source)
 */
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_v_source;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":75
 *         if not hasattr(source, 'read'):
 *             self._filename = source
 *             if not python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *                 source = _encodeFilename(source)
 *             source = open(source, 'rb')
 */
    __pyx_t_2 = ((!(IS_PYTHON3 != 0)) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":76
 *             self._filename = source
 *             if not python.IS_PYTHON3:
 *                 source = _encodeFilename(source)             # <<<<<<<<<<<<<<
 *             source = open(source, 'rb')
 *             self._close_source_after_read = True
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":77
 *             if not python.IS_PYTHON3:
 *                 source = _encodeFilename(source)
 *             source = open(source, 'rb')             # <<<<<<<<<<<<<<
 *             self._close_source_after_read = True
 *         else:
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_INCREF(__pyx_n_s_rb);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_rb);
    __Pyx_GIVEREF(__pyx_n_s_rb);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":78
 *                 source = _encodeFilename(source)
 *             source = open(source, 'rb')
 *             self._close_source_after_read = True             # <<<<<<<<<<<<<<
 *         else:
 *             self._filename = _getFilenameForFile(source)
 */
    __pyx_v_self->_close_source_after_read = 1;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":80
 *             self._close_source_after_read = True
 *         else:
 *             self._filename = _getFilenameForFile(source)             # <<<<<<<<<<<<<<
 *             self._close_source_after_read = False
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_source); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_filename);
    __Pyx_DECREF(__pyx_v_self->_filename);
    __pyx_v_self->_filename = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":81
 *         else:
 *             self._filename = _getFilenameForFile(source)
 *             self._close_source_after_read = False             # <<<<<<<<<<<<<<
 * 
 *         if recover is None:
 */
    __pyx_v_self->_close_source_after_read = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":83
 *             self._close_source_after_read = False
 * 
 *         if recover is None:             # <<<<<<<<<<<<<<
 *             recover = html
 * 
 */
  __pyx_t_2 = (__pyx_v_recover == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":84
 * 
 *         if recover is None:
 *             recover = html             # <<<<<<<<<<<<<<
 * 
 *         if html:
 */
    __Pyx_INCREF(__pyx_v_html);
    __Pyx_DECREF_SET(__pyx_v_recover, __pyx_v_html);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":86
 *             recover = html
 * 
 *         if html:             # <<<<<<<<<<<<<<
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_html); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":88
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events             # <<<<<<<<<<<<<<
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":89
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]             # <<<<<<<<<<<<<<
 *             parser = HTMLPullParser(
 *                 events,
 */
    if (PyList_CheckExact(__pyx_v_events) || PyTuple_CheckExact(__pyx_v_events)) {
      __pyx_t_3 = __pyx_v_events; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_events); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    for (;;) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":88
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events             # <<<<<<<<<<<<<<
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(
 */
      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_3);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":89
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]             # <<<<<<<<<<<<<<
 *             parser = HTMLPullParser(
 *                 events,
 */
      __Pyx_INCREF(__pyx_v_event);
      __pyx_t_7 = __pyx_v_event;
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_kp_s_start_ns, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_1) {
        __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_kp_s_end_ns, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_8 = __pyx_t_2;
      } else {
        __pyx_t_8 = __pyx_t_1;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_1 = (__pyx_t_8 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":88
 *         if html:
 *             # make sure we're not looking for namespaces
 *             events = [event for event in events             # <<<<<<<<<<<<<<
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(
 */
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_event))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_events, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":90
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_events);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_events);
    __Pyx_GIVEREF(__pyx_v_events);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":92
 *             parser = HTMLPullParser(
 *                 events,
 *                 tag=tag,             # <<<<<<<<<<<<<<
 *                 recover=recover,
 *                 base_url=self._filename,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":93
 *                 events,
 *                 tag=tag,
 *                 recover=recover,             # <<<<<<<<<<<<<<
 *                 base_url=self._filename,
 *                 encoding=encoding,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_recover, __pyx_v_recover) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":94
 *                 tag=tag,
 *                 recover=recover,
 *                 base_url=self._filename,             # <<<<<<<<<<<<<<
 *                 encoding=encoding,
 *                 remove_blank_text=remove_blank_text,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_base_url, __pyx_v_self->_filename) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":95
 *                 recover=recover,
 *                 base_url=self._filename,
 *                 encoding=encoding,             # <<<<<<<<<<<<<<
 *                 remove_blank_text=remove_blank_text,
 *                 remove_comments=remove_comments,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":96
 *                 base_url=self._filename,
 *                 encoding=encoding,
 *                 remove_blank_text=remove_blank_text,             # <<<<<<<<<<<<<<
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_blank_text, __pyx_v_remove_blank_text) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":97
 *                 encoding=encoding,
 *                 remove_blank_text=remove_blank_text,
 *                 remove_comments=remove_comments,             # <<<<<<<<<<<<<<
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_comments, __pyx_v_remove_comments) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":98
 *                 remove_blank_text=remove_blank_text,
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,             # <<<<<<<<<<<<<<
 *                 strip_cdata=strip_cdata,
 *                 no_network=no_network,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_pis, __pyx_v_remove_pis) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":99
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,             # <<<<<<<<<<<<<<
 *                 no_network=no_network,
 *                 target=None,  # TODO
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_strip_cdata, __pyx_v_strip_cdata) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":100
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,
 *                 no_network=no_network,             # <<<<<<<<<<<<<<
 *                 target=None,  # TODO
 *                 schema=schema,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_no_network, __pyx_v_no_network) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":101
 *                 strip_cdata=strip_cdata,
 *                 no_network=no_network,
 *                 target=None,  # TODO             # <<<<<<<<<<<<<<
 *                 schema=schema,
 *                 compact=compact)
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, Py_None) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":102
 *                 no_network=no_network,
 *                 target=None,  # TODO
 *                 schema=schema,             # <<<<<<<<<<<<<<
 *                 compact=compact)
 *         else:
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema, ((PyObject *)__pyx_v_schema)) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":103
 *                 target=None,  # TODO
 *                 schema=schema,
 *                 compact=compact)             # <<<<<<<<<<<<<<
 *         else:
 *             parser = XMLPullParser(
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compact, __pyx_v_compact) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":90
 *             events = [event for event in events
 *                       if event not in ('start-ns', 'end-ns')]
 *             parser = HTMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
 */
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLPullParser)), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_t_7);
    __pyx_t_7 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":105
 *                 compact=compact)
 *         else:
 *             parser = XMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_events);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_events);
    __Pyx_GIVEREF(__pyx_v_events);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":107
 *             parser = XMLPullParser(
 *                 events,
 *                 tag=tag,             # <<<<<<<<<<<<<<
 *                 recover=recover,
 *                 base_url=self._filename,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tag, __pyx_v_tag) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":108
 *                 events,
 *                 tag=tag,
 *                 recover=recover,             # <<<<<<<<<<<<<<
 *                 base_url=self._filename,
 *                 encoding=encoding,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_recover, __pyx_v_recover) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":109
 *                 tag=tag,
 *                 recover=recover,
 *                 base_url=self._filename,             # <<<<<<<<<<<<<<
 *                 encoding=encoding,
 *                 attribute_defaults=attribute_defaults,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_base_url, __pyx_v_self->_filename) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":110
 *                 recover=recover,
 *                 base_url=self._filename,
 *                 encoding=encoding,             # <<<<<<<<<<<<<<
 *                 attribute_defaults=attribute_defaults,
 *                 dtd_validation=dtd_validation,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":111
 *                 base_url=self._filename,
 *                 encoding=encoding,
 *                 attribute_defaults=attribute_defaults,             # <<<<<<<<<<<<<<
 *                 dtd_validation=dtd_validation,
 *                 load_dtd=load_dtd,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_attribute_defaults, __pyx_v_attribute_defaults) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":112
 *                 encoding=encoding,
 *                 attribute_defaults=attribute_defaults,
 *                 dtd_validation=dtd_validation,             # <<<<<<<<<<<<<<
 *                 load_dtd=load_dtd,
 *                 no_network=no_network,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtd_validation, __pyx_v_dtd_validation) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":113
 *                 attribute_defaults=attribute_defaults,
 *                 dtd_validation=dtd_validation,
 *                 load_dtd=load_dtd,             # <<<<<<<<<<<<<<
 *                 no_network=no_network,
 *                 schema=schema,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_load_dtd, __pyx_v_load_dtd) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":114
 *                 dtd_validation=dtd_validation,
 *                 load_dtd=load_dtd,
 *                 no_network=no_network,             # <<<<<<<<<<<<<<
 *                 schema=schema,
 *                 huge_tree=huge_tree,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_no_network, __pyx_v_no_network) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":115
 *                 load_dtd=load_dtd,
 *                 no_network=no_network,
 *                 schema=schema,             # <<<<<<<<<<<<<<
 *                 huge_tree=huge_tree,
 *                 remove_blank_text=remove_blank_text,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema, ((PyObject *)__pyx_v_schema)) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":116
 *                 no_network=no_network,
 *                 schema=schema,
 *                 huge_tree=huge_tree,             # <<<<<<<<<<<<<<
 *                 remove_blank_text=remove_blank_text,
 *                 resolve_entities=resolve_entities,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_huge_tree, __pyx_v_huge_tree) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":117
 *                 schema=schema,
 *                 huge_tree=huge_tree,
 *                 remove_blank_text=remove_blank_text,             # <<<<<<<<<<<<<<
 *                 resolve_entities=resolve_entities,
 *                 remove_comments=remove_comments,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_blank_text, __pyx_v_remove_blank_text) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":118
 *                 huge_tree=huge_tree,
 *                 remove_blank_text=remove_blank_text,
 *                 resolve_entities=resolve_entities,             # <<<<<<<<<<<<<<
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_resolve_entities, __pyx_v_resolve_entities) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":119
 *                 remove_blank_text=remove_blank_text,
 *                 resolve_entities=resolve_entities,
 *                 remove_comments=remove_comments,             # <<<<<<<<<<<<<<
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_comments, __pyx_v_remove_comments) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":120
 *                 resolve_entities=resolve_entities,
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,             # <<<<<<<<<<<<<<
 *                 strip_cdata=strip_cdata,
 *                 target=None,  # TODO
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_remove_pis, __pyx_v_remove_pis) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":121
 *                 remove_comments=remove_comments,
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,             # <<<<<<<<<<<<<<
 *                 target=None,  # TODO
 *                 compact=compact)
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_strip_cdata, __pyx_v_strip_cdata) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":122
 *                 remove_pis=remove_pis,
 *                 strip_cdata=strip_cdata,
 *                 target=None,  # TODO             # <<<<<<<<<<<<<<
 *                 compact=compact)
 * 
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, Py_None) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":123
 *                 strip_cdata=strip_cdata,
 *                 target=None,  # TODO
 *                 compact=compact)             # <<<<<<<<<<<<<<
 * 
 *         self._events = parser.read_events()
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_compact, __pyx_v_compact) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":105
 *                 compact=compact)
 *         else:
 *             parser = XMLPullParser(             # <<<<<<<<<<<<<<
 *                 events,
 *                 tag=tag,
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLPullParser)), __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":125
 *                 compact=compact)
 * 
 *         self._events = parser.read_events()             # <<<<<<<<<<<<<<
 *         self._parser = parser
 *         self._source = source
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_read_events); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":126
 * 
 *         self._events = parser.read_events()
 *         self._parser = parser             # <<<<<<<<<<<<<<
 *         self._source = source
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_self->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parser));
  __pyx_v_self->_parser = __pyx_v_parser;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":127
 *         self._events = parser.read_events()
 *         self._parser = parser
 *         self._source = source             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __Pyx_INCREF(__pyx_v_source);
  __Pyx_GIVEREF(__pyx_v_source);
  __Pyx_GOTREF(__pyx_v_self->_source);
  __Pyx_DECREF(__pyx_v_self->_source);
  __pyx_v_self->_source = __pyx_v_source;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":66
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.iterparse.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parser);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XDECREF(__pyx_v_source);
  __Pyx_XDECREF(__pyx_v_events);
  __Pyx_XDECREF(__pyx_v_recover);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":132
 *         u"""The error log of the last (or current) parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parser.feed_error_log
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9error_log___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":133
 *         """
 *         def __get__(self):
 *             return self._parser.feed_error_log             # <<<<<<<<<<<<<<
 * 
 *     property resolvers:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_n_s_feed_error_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":132
 *         u"""The error log of the last (or current) parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parser.feed_error_log
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterparse.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":138
 *         u"""The custom resolver registry of the last (or current) parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parser.resolvers
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9resolvers_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9resolvers_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_9resolvers___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_9resolvers___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":139
 *         """
 *         def __get__(self):
 *             return self._parser.resolvers             # <<<<<<<<<<<<<<
 * 
 *     property version:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_n_s_resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":138
 *         u"""The custom resolver registry of the last (or current) parser run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parser.resolvers
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterparse.resolvers.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":143
 *     property version:
 *         u"""The version of the underlying XML parser."""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parser.version
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7version_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_7version___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_7version___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":144
 *         u"""The version of the underlying XML parser."""
 *         def __get__(self):
 *             return self._parser.version             # <<<<<<<<<<<<<<
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_n_s_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":143
 *     property version:
 *         u"""The version of the underlying XML parser."""
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parser.version
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.iterparse.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":146
 *             return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u"""set_element_class_lookup(self, lookup = None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup[] = "set_element_class_lookup(self, lookup = None)\n\n        Set a lookup scheme for element classes generated from this parser.\n\n        Reset it by passing None or nothing.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementClassLookup *__pyx_v_lookup = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_element_class_lookup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lookup,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct LxmlElementClassLookup *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lookup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_element_class_lookup") < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lookup = ((struct LxmlElementClassLookup *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_element_class_lookup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.iterparse.set_element_class_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), __pyx_ptype_4lxml_5etree_ElementClassLookup, 1, "lookup", 0))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_2set_element_class_lookup(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v_lookup);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_2set_element_class_lookup(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, struct LxmlElementClassLookup *__pyx_v_lookup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_element_class_lookup", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":153
 *         Reset it by passing None or nothing.
 *         """
 *         self._parser.set_element_class_lookup(lookup)             # <<<<<<<<<<<<<<
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_n_s_set_element_class_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 153; __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[14]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_lookup));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lookup));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 153; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":146
 *             return self._parser.version
 * 
 *     def set_element_class_lookup(self, ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *         u"""set_element_class_lookup(self, lookup = None)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":155
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_5makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9iterparse_4makeelement[] = "makeelement(self, _tag, attrib=None, nsmap=None, **_extra)\n\n        Creates a new element associated with this parser.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_5makeelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__tag = 0;
  CYTHON_UNUSED PyObject *__pyx_v_attrib = 0;
  CYTHON_UNUSED PyObject *__pyx_v_nsmap = 0;
  PyObject *__pyx_v__extra = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeelement (wrapper)", 0);
  __pyx_v__extra = PyDict_New(); if (unlikely(!__pyx_v__extra)) return NULL;
  __Pyx_GOTREF(__pyx_v__extra);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag_2,&__pyx_n_s_attrib,&__pyx_n_s_nsmap,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_attrib);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsmap);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__extra, values, pos_args, "makeelement") < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v__tag = values[0];
    __pyx_v_attrib = values[1];
    __pyx_v_nsmap = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeelement", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__extra); __pyx_v__extra = 0;
  __Pyx_AddTraceback("lxml.etree.iterparse.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_4makeelement(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self), __pyx_v__tag, __pyx_v_attrib, __pyx_v_nsmap, __pyx_v__extra);

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4makeelement(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, PyObject *__pyx_v__tag, CYTHON_UNUSED PyObject *__pyx_v_attrib, CYTHON_UNUSED PyObject *__pyx_v_nsmap, PyObject *__pyx_v__extra) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeelement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":160
 *         Creates a new element associated with this parser.
 *         """
 *         self._parser.makeelement(             # <<<<<<<<<<<<<<
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parser), __pyx_n_s_makeelement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":161
 *         """
 *         self._parser.makeelement(
 *             _tag, attrib=None, nsmap=None, **_extra)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v__tag);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__tag);
  __Pyx_GIVEREF(__pyx_v__tag);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":160
 *         Creates a new element associated with this parser.
 *         """
 *         self._parser.makeelement(             # <<<<<<<<<<<<<<
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_3 = PyDict_Copy(__pyx_v__extra); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":161
 *         """
 *         self._parser.makeelement(
 *             _tag, attrib=None, nsmap=None, **_extra)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  if (unlikely(PyDict_GetItem(__pyx_t_3, __pyx_n_s_attrib))) {
    __Pyx_RaiseDoubleKeywordsError("function", __pyx_n_s_attrib); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_attrib, Py_None) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(PyDict_GetItem(__pyx_t_3, __pyx_n_s_nsmap))) {
    __Pyx_RaiseDoubleKeywordsError("function", __pyx_n_s_nsmap); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nsmap, Py_None) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":160
 *         Creates a new element associated with this parser.
 *         """
 *         self._parser.makeelement(             # <<<<<<<<<<<<<<
 *             _tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":155
 *         self._parser.set_element_class_lookup(lookup)
 * 
 *     def makeelement(self, _tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *         u"""makeelement(self, _tag, attrib=None, nsmap=None, **_extra)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iterparse.makeelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":164
 * 
 *     @cython.final
 *     cdef _close_source(self):             # <<<<<<<<<<<<<<
 *         if self._source is None:
 *             return
 */

static PyObject *__pyx_f_4lxml_5etree_9iterparse__close_source(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_v_close = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close_source", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":165
 *     @cython.final
 *     cdef _close_source(self):
 *         if self._source is None:             # <<<<<<<<<<<<<<
 *             return
 *         if not self._close_source_after_read:
 */
  __pyx_t_1 = (__pyx_v_self->_source == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":166
 *     cdef _close_source(self):
 *         if self._source is None:
 *             return             # <<<<<<<<<<<<<<
 *         if not self._close_source_after_read:
 *             self._source = None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":167
 *         if self._source is None:
 *             return
 *         if not self._close_source_after_read:             # <<<<<<<<<<<<<<
 *             self._source = None
 *             return
 */
  __pyx_t_2 = ((!(__pyx_v_self->_close_source_after_read != 0)) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":168
 *             return
 *         if not self._close_source_after_read:
 *             self._source = None             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_source);
    __Pyx_DECREF(__pyx_v_self->_source);
    __pyx_v_self->_source = Py_None;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":169
 *         if not self._close_source_after_read:
 *             self._source = None
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             close = self._source.close
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":170
 *             self._source = None
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             close = self._source.close
 *         except AttributeError:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":171
 *             return
 *         try:
 *             close = self._source.close             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             close = None
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_source, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_v_close = __pyx_t_6;
        __pyx_t_6 = 0;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L15_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":172
 *         try:
 *             close = self._source.close
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             close = None
 *         finally:
 */
      __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("lxml.etree.iterparse._close_source", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":173
 *             close = self._source.close
 *         except AttributeError:
 *             close = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self._source = None
 */
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_close, Py_None);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_exception_handled;
      }
      goto __pyx_L10_except_error;
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L6_error;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L15_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":175
 *             close = None
 *         finally:
 *             self._source = None             # <<<<<<<<<<<<<<
 *         if close is not None:
 *             close()
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_source);
      __Pyx_DECREF(__pyx_v_self->_source);
      __pyx_v_self->_source = Py_None;
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_7 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_source);
        __Pyx_DECREF(__pyx_v_self->_source);
        __pyx_v_self->_source = Py_None;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":176
 *         finally:
 *             self._source = None
 *         if close is not None:             # <<<<<<<<<<<<<<
 *             close()
 * 
 */
  __pyx_t_2 = (__pyx_v_close != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":177
 *             self._source = None
 *         if close is not None:
 *             close()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_close, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":164
 * 
 *     @cython.final
 *     cdef _close_source(self):             # <<<<<<<<<<<<<<
 *         if self._source is None:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.iterparse._close_source", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_close);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":179
 *             close()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_7__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_6__iter__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_6__iter__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":180
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":179
 *             close()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":182
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self._events)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_9__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_8__next__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_8__next__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context = NULL;
  int __pyx_v_done;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_error = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":183
 * 
 *     def __next__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self._events)
 *         except StopIteration:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":184
 *     def __next__(self):
 *         try:
 *             return next(self._events)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             pass
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_v_self->_events;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":185
 *         try:
 *             return next(self._events)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_6) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":187
 *         except StopIteration:
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()             # <<<<<<<<<<<<<<
 *         if self._source is not None:
 *             done = False
 */
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->__pyx_base._getPushParserContext(((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_self->_parser))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":188
 *             pass
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:             # <<<<<<<<<<<<<<
 *             done = False
 *             while not done:
 */
  __pyx_t_7 = (__pyx_v_self->_source != Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":189
 *         context = <_SaxParserContext>self._parser._getPushParserContext()
 *         if self._source is not None:
 *             done = False             # <<<<<<<<<<<<<<
 *             while not done:
 *                 try:
 */
    __pyx_v_done = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":190
 *         if self._source is not None:
 *             done = False
 *             while not done:             # <<<<<<<<<<<<<<
 *                 try:
 *                     done = self._read_more_events(context)
 */
    while (1) {
      __pyx_t_8 = ((!(__pyx_v_done != 0)) != 0);
      if (!__pyx_t_8) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":191
 *             done = False
 *             while not done:
 *                 try:             # <<<<<<<<<<<<<<
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":192
 *             while not done:
 *                 try:
 *                     done = self._read_more_events(context)             # <<<<<<<<<<<<<<
 *                     return next(self._events)
 *                 except StopIteration:
 */
          __pyx_t_8 = __pyx_f_4lxml_5etree_9iterparse__read_more_events(__pyx_v_self, __pyx_v_context); if (unlikely(__pyx_t_8 == -123)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
          __pyx_v_done = __pyx_t_8;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":193
 *                 try:
 *                     done = self._read_more_events(context)
 *                     return next(self._events)             # <<<<<<<<<<<<<<
 *                 except StopIteration:
 *                     pass  # no events yet
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_4 = __pyx_v_self->_events;
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_5 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L14_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_L18_try_return;
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L21_try_end;
        __pyx_L14_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":194
 *                     done = self._read_more_events(context)
 *                     return next(self._events)
 *                 except StopIteration:             # <<<<<<<<<<<<<<
 *                     pass  # no events yet
 *                 except Exception, e:
 */
        __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
        if (__pyx_t_6) {
          PyErr_Restore(0,0,0);
          goto __pyx_L15_exception_handled;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":196
 *                 except StopIteration:
 *                     pass  # no events yet
 *                 except Exception, e:             # <<<<<<<<<<<<<<
 *                     self._error = e
 *                     self._close_source()
 */
        __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_6) {
          __Pyx_AddTraceback("lxml.etree.iterparse.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_v_e = __pyx_t_4;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":197
 *                     pass  # no events yet
 *                 except Exception, e:
 *                     self._error = e             # <<<<<<<<<<<<<<
 *                     self._close_source()
 *                     try:
 */
          __Pyx_INCREF(__pyx_v_e);
          __Pyx_GIVEREF(__pyx_v_e);
          __Pyx_GOTREF(__pyx_v_self->_error);
          __Pyx_DECREF(__pyx_v_self->_error);
          __pyx_v_self->_error = __pyx_v_e;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":198
 *                 except Exception, e:
 *                     self._error = e
 *                     self._close_source()             # <<<<<<<<<<<<<<
 *                     try:
 *                         return next(self._events)
 */
          __pyx_t_10 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":199
 *                     self._error = e
 *                     self._close_source()
 *                     try:             # <<<<<<<<<<<<<<
 *                         return next(self._events)
 *                     except StopIteration:
 */
          {
            __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_13);
            /*try:*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":200
 *                     self._close_source()
 *                     try:
 *                         return next(self._events)             # <<<<<<<<<<<<<<
 *                     except StopIteration:
 *                         break
 */
              __Pyx_XDECREF(__pyx_r);
              __pyx_t_10 = __pyx_v_self->_events;
              __Pyx_INCREF(__pyx_t_10);
              __pyx_t_14 = __Pyx_PyIter_Next(__pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_r = __pyx_t_14;
              __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              goto __pyx_L28_try_return;
            }
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            goto __pyx_L31_try_end;
            __pyx_L24_error:;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":201
 *                     try:
 *                         return next(self._events)
 *                     except StopIteration:             # <<<<<<<<<<<<<<
 *                         break
 *         # nothing left to read or return
 */
            __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
            if (__pyx_t_6) {
              __Pyx_AddTraceback("lxml.etree.iterparse.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_10, &__pyx_t_15) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GOTREF(__pyx_t_15);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":202
 *                         return next(self._events)
 *                     except StopIteration:
 *                         break             # <<<<<<<<<<<<<<
 *         # nothing left to read or return
 *         if self._error is not None:
 */
              goto __pyx_L32_except_break;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              goto __pyx_L25_exception_handled;
              __pyx_L32_except_break:;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              goto __pyx_L29_try_break;
            }
            goto __pyx_L26_except_error;
            __pyx_L26_except_error:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            goto __pyx_L16_except_error;
            __pyx_L29_try_break:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            goto __pyx_L22_except_break;
            __pyx_L28_try_return:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            goto __pyx_L17_except_return;
            __pyx_L25_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            __pyx_L31_try_end:;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L15_exception_handled;
          __pyx_L22_except_break:;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L19_try_break;
        }
        goto __pyx_L16_except_error;
        __pyx_L16_except_error:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L1_error;
        __pyx_L19_try_break:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L13_break;
        __pyx_L18_try_return:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L0;
        __pyx_L17_except_return:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L0;
        __pyx_L15_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        __pyx_L21_try_end:;
      }
    }
    __pyx_L13_break:;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":204
 *                         break
 *         # nothing left to read or return
 *         if self._error is not None:             # <<<<<<<<<<<<<<
 *             error = self._error
 *             self._error = None
 */
  __pyx_t_8 = (__pyx_v_self->_error != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":205
 *         # nothing left to read or return
 *         if self._error is not None:
 *             error = self._error             # <<<<<<<<<<<<<<
 *             self._error = None
 *             raise error
 */
    __pyx_t_9 = __pyx_v_self->_error;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_v_error = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":206
 *         if self._error is not None:
 *             error = self._error
 *             self._error = None             # <<<<<<<<<<<<<<
 *             raise error
 *         if (context._validator is not None
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_error);
    __Pyx_DECREF(__pyx_v_self->_error);
    __pyx_v_self->_error = Py_None;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":207
 *             error = self._error
 *             self._error = None
 *             raise error             # <<<<<<<<<<<<<<
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):
 */
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    {__pyx_filename = __pyx_f[14]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":208
 *             self._error = None
 *             raise error
 *         if (context._validator is not None             # <<<<<<<<<<<<<<
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
 */
  __pyx_t_7 = (((PyObject *)__pyx_v_context->__pyx_base._validator) != Py_None);
  if ((__pyx_t_7 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":209
 *             raise error
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):             # <<<<<<<<<<<<<<
 *             _raiseParseError(context._c_ctxt, self._filename,
 *                              context._error_log)
 */
    __pyx_t_8 = ((!(__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(__pyx_v_context->__pyx_base._validator) != 0)) != 0);
    __pyx_t_16 = __pyx_t_8;
  } else {
    __pyx_t_16 = (__pyx_t_7 != 0);
  }
  if (__pyx_t_16) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":210
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,             # <<<<<<<<<<<<<<
 *                              context._error_log)
 *         # no errors => all done
 */
    __pyx_t_9 = __pyx_v_self->_filename;
    __Pyx_INCREF(__pyx_t_9);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":211
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,
 *                              context._error_log)             # <<<<<<<<<<<<<<
 *         # no errors => all done
 *         raise StopIteration
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_context->__pyx_base._error_log);
    __Pyx_INCREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":210
 *         if (context._validator is not None
 *                 and not context._validator.isvalid()):
 *             _raiseParseError(context._c_ctxt, self._filename,             # <<<<<<<<<<<<<<
 *                              context._error_log)
 *         # no errors => all done
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__raiseParseError(__pyx_v_context->__pyx_base._c_ctxt, __pyx_t_9, ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_4)); if (unlikely(__pyx_t_6 == 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L35;
  }
  __pyx_L35:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":213
 *                              context._error_log)
 *         # no errors => all done
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
  {__pyx_filename = __pyx_f[14]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":182
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self._events)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("lxml.etree.iterparse.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":216
 * 
 *     @cython.final
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:             # <<<<<<<<<<<<<<
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):
 */

static int __pyx_f_4lxml_5etree_9iterparse__read_more_events(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__SaxParserContext *__pyx_v_context) {
  PyObject *__pyx_v_data = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  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;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_read_more_events", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":217
 *     @cython.final
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)             # <<<<<<<<<<<<<<
 *         if not isinstance(data, bytes):
 *             self._close_source()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_source, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__76, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_data = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":218
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):             # <<<<<<<<<<<<<<
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
 */
  __pyx_t_3 = PyBytes_Check(__pyx_v_data); 
  __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":219
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):
 *             self._close_source()             # <<<<<<<<<<<<<<
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":220
 *         if not isinstance(data, bytes):
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")             # <<<<<<<<<<<<<<
 *         if not data:
 *             try:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[14]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":221
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.root = self._parser.close()
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((!__pyx_t_4) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":222
 *             raise TypeError("reading file objects must return bytes objects")
 *         if not data:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.root = self._parser.close()
 *             finally:
 */
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":223
 *         if not data:
 *             try:
 *                 self.root = self._parser.close()             # <<<<<<<<<<<<<<
 *             finally:
 *                 self._close_source()
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->close(__pyx_v_self->_parser, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->root);
      __Pyx_DECREF(__pyx_v_self->root);
      __pyx_v_self->root = __pyx_t_2;
      __pyx_t_2 = 0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":225
 *                 self.root = self._parser.close()
 *             finally:
 *                 self._close_source()             # <<<<<<<<<<<<<<
 *             return True
 *         self._parser.feed(data)
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_2 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L7;
      }
      /*exception exit:*/{
        __pyx_L6_error:;
        __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
        {
          __pyx_t_2 = __pyx_f_4lxml_5etree_9iterparse__close_source(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
        __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
        goto __pyx_L1_error;
        __pyx_L9_error:;
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L7:;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":226
 *             finally:
 *                 self._close_source()
 *             return True             # <<<<<<<<<<<<<<
 *         self._parser.feed(data)
 *         return False
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":227
 *                 self._close_source()
 *             return True
 *         self._parser.feed(data)             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__FeedParser *)__pyx_v_self->_parser->__pyx_base.__pyx_vtab)->feed(__pyx_v_self->_parser, __pyx_v_data, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":228
 *             return True
 *         self._parser.feed(data)
 *         return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":216
 * 
 *     @cython.final
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:             # <<<<<<<<<<<<<<
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)
 *         if not isinstance(data, bytes):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterparse._read_more_events", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -123;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":60
 *     cdef object _tag
 *     cdef object _events
 *     cdef readonly object root             # <<<<<<<<<<<<<<
 *     cdef object _source
 *     cdef object _filename
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_4root_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_9iterparse_4root_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9iterparse_4root___get__(((struct __pyx_obj_4lxml_5etree_iterparse *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_9iterparse_4root___get__(struct __pyx_obj_4lxml_5etree_iterparse *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->root);
  __pyx_r = __pyx_v_self->root;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":244
 *     cdef int    _event_filter
 * 
 *     def __init__(self, element_or_tree, events=(u"end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8iterwalk_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_8iterwalk_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_element_or_tree = 0;
  PyObject *__pyx_v_events = 0;
  PyObject *__pyx_v_tag = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_events,&__pyx_n_s_tag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_tuple__78);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_events);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_element_or_tree = values[0];
    __pyx_v_events = values[1];
    __pyx_v_tag = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[14]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.iterwalk.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk___init__(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self), __pyx_v_element_or_tree, __pyx_v_events, __pyx_v_tag);

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

static int __pyx_pf_4lxml_5etree_8iterwalk___init__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_events, PyObject *__pyx_v_tag) {
  struct LxmlElement *__pyx_v_root = 0;
  int __pyx_v_ns_count;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":247
 *         cdef _Element root
 *         cdef int ns_count
 *         root = _rootNodeOrRaise(element_or_tree)             # <<<<<<<<<<<<<<
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_element_or_tree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":248
 *         cdef int ns_count
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)             # <<<<<<<<<<<<<<
 *         if tag is None or tag == '*':
 *             self._matcher = None
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__buildParseEventFilter(__pyx_v_events); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_event_filter = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":249
 *         root = _rootNodeOrRaise(element_or_tree)
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':             # <<<<<<<<<<<<<<
 *             self._matcher = None
 *         else:
 */
  __pyx_t_3 = (__pyx_v_tag == Py_None);
  if (!__pyx_t_3) {
    __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_tag, __pyx_kp_s__34, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":250
 *         self._event_filter = _buildParseEventFilter(events)
 *         if tag is None or tag == '*':
 *             self._matcher = None             # <<<<<<<<<<<<<<
 *         else:
 *             self._matcher = _MultiTagMatcher(tag)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_matcher);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_matcher));
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":252
 *             self._matcher = None
 *         else:
 *             self._matcher = _MultiTagMatcher(tag)             # <<<<<<<<<<<<<<
 *         self._node_stack  = []
 *         self._events = []
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_tag);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
    __Pyx_GIVEREF(__pyx_v_tag);
    __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->_matcher);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_matcher));
    __pyx_v_self->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_6);
    __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":253
 *         else:
 *             self._matcher = _MultiTagMatcher(tag)
 *         self._node_stack  = []             # <<<<<<<<<<<<<<
 *         self._events = []
 *         self._pop_event = self._events.pop
 */
  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_node_stack);
  __Pyx_DECREF(__pyx_v_self->_node_stack);
  __pyx_v_self->_node_stack = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":254
 *             self._matcher = _MultiTagMatcher(tag)
 *         self._node_stack  = []
 *         self._events = []             # <<<<<<<<<<<<<<
 *         self._pop_event = self._events.pop
 * 
 */
  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_events);
  __Pyx_DECREF(__pyx_v_self->_events);
  __pyx_v_self->_events = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":255
 *         self._node_stack  = []
 *         self._events = []
 *         self._pop_event = self._events.pop             # <<<<<<<<<<<<<<
 * 
 *         if self._event_filter:
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_events, __pyx_n_s_pop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_pop_event);
  __Pyx_DECREF(__pyx_v_self->_pop_event);
  __pyx_v_self->_pop_event = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":257
 *         self._pop_event = self._events.pop
 * 
 *         if self._event_filter:             # <<<<<<<<<<<<<<
 *             self._index = 0
 *             ns_count = self._start_node(root)
 */
  __pyx_t_5 = (__pyx_v_self->_event_filter != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":258
 * 
 *         if self._event_filter:
 *             self._index = 0             # <<<<<<<<<<<<<<
 *             ns_count = self._start_node(root)
 *             self._node_stack.append( (root, ns_count) )
 */
    __pyx_v_self->_index = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":259
 *         if self._event_filter:
 *             self._index = 0
 *             ns_count = self._start_node(root)             # <<<<<<<<<<<<<<
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)__pyx_v_self->__pyx_vtab)->_start_node(__pyx_v_self, __pyx_v_root); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ns_count = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":260
 *             self._index = 0
 *             ns_count = self._start_node(root)
 *             self._node_stack.append( (root, ns_count) )             # <<<<<<<<<<<<<<
 *         else:
 *             self._index = -1
 */
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_ns_count); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->_node_stack, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":262
 *             self._node_stack.append( (root, ns_count) )
 *         else:
 *             self._index = -1             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_v_self->_index = -1;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":244
 *     cdef int    _event_filter
 * 
 *     def __init__(self, element_or_tree, events=(u"end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.iterwalk.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":264
 *             self._index = -1
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk_2__iter__(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_2__iter__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":265
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":264
 *             self._index = -1
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":267
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_child
 *         cdef _Element node
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8iterwalk_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8iterwalk_4__next__(((struct __pyx_obj_4lxml_5etree_iterwalk *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8iterwalk_4__next__(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  xmlNode *__pyx_v_c_child;
  struct LxmlElement *__pyx_v_node = 0;
  struct LxmlElement *__pyx_v_next_node = 0;
  int __pyx_v_ns_count;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":271
 *         cdef _Element node
 *         cdef _Element next_node
 *         cdef int ns_count = 0             # <<<<<<<<<<<<<<
 *         if self._events:
 *             return self._pop_event(0)
 */
  __pyx_v_ns_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":272
 *         cdef _Element next_node
 *         cdef int ns_count = 0
 *         if self._events:             # <<<<<<<<<<<<<<
 *             return self._pop_event(0)
 *         if self._matcher is not None and self._index >= 0:
 */
  __pyx_t_1 = (__pyx_v_self->_events != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_events) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":273
 *         cdef int ns_count = 0
 *         if self._events:
 *             return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_self->_pop_event, __pyx_tuple__79, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":274
 *         if self._events:
 *             return self._pop_event(0)
 *         if self._matcher is not None and self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_matcher) != Py_None);
  if ((__pyx_t_1 != 0)) {
    __pyx_t_3 = ((__pyx_v_self->_index >= 0) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":275
 *             return self._pop_event(0)
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]             # <<<<<<<<<<<<<<
 *             self._matcher.cacheTags(node._doc)
 * 
 */
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_self->_node_stack, __pyx_v_self->_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_node = ((struct LxmlElement *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":276
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]
 *             self._matcher.cacheTags(node._doc)             # <<<<<<<<<<<<<<
 * 
 *         # find next node
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_node->_doc);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_self->_matcher, ((struct LxmlDocument *)__pyx_t_5), NULL); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":279
 * 
 *         # find next node
 *         while self._index >= 0:             # <<<<<<<<<<<<<<
 *             node = self._node_stack[self._index][0]
 * 
 */
  while (1) {
    __pyx_t_4 = ((__pyx_v_self->_index >= 0) != 0);
    if (!__pyx_t_4) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":280
 *         # find next node
 *         while self._index >= 0:
 *             node = self._node_stack[self._index][0]             # <<<<<<<<<<<<<<
 * 
 *             c_child = _findChildForwards(node._c_node, 0)
 */
    if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_self->_node_stack, __pyx_v_self->_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":282
 *             node = self._node_stack[self._index][0]
 * 
 *             c_child = _findChildForwards(node._c_node, 0)             # <<<<<<<<<<<<<<
 *             if c_child is not NULL:
 *                 # try children
 */
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_node->_c_node, 0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":283
 * 
 *             c_child = _findChildForwards(node._c_node, 0)
 *             if c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 # try children
 *                 next_node = _elementFactory(node._doc, c_child)
 */
    __pyx_t_4 = ((__pyx_v_c_child != NULL) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":285
 *             if c_child is not NULL:
 *                 # try children
 *                 next_node = _elementFactory(node._doc, c_child)             # <<<<<<<<<<<<<<
 *             else:
 *                 # back off
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_node->_doc);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_child)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_next_node, ((struct LxmlElement *)__pyx_t_5));
      __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":288
 *             else:
 *                 # back off
 *                 next_node = None             # <<<<<<<<<<<<<<
 *                 while next_node is None:
 *                     # back off through parents
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_next_node, ((struct LxmlElement *)Py_None));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":289
 *                 # back off
 *                 next_node = None
 *                 while next_node is None:             # <<<<<<<<<<<<<<
 *                     # back off through parents
 *                     self._index -= 1
 */
      while (1) {
        __pyx_t_4 = (((PyObject *)__pyx_v_next_node) == Py_None);
        __pyx_t_1 = (__pyx_t_4 != 0);
        if (!__pyx_t_1) break;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":291
 *                 while next_node is None:
 *                     # back off through parents
 *                     self._index -= 1             # <<<<<<<<<<<<<<
 *                     node = self._end_node()
 *                     if self._index < 0:
 */
        __pyx_v_self->_index = (__pyx_v_self->_index - 1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":292
 *                     # back off through parents
 *                     self._index -= 1
 *                     node = self._end_node()             # <<<<<<<<<<<<<<
 *                     if self._index < 0:
 *                         break
 */
        __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)__pyx_v_self->__pyx_vtab)->_end_node(__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_node, ((struct LxmlElement *)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":293
 *                     self._index -= 1
 *                     node = self._end_node()
 *                     if self._index < 0:             # <<<<<<<<<<<<<<
 *                         break
 *                     next_node = node.getnext()
 */
        __pyx_t_1 = ((__pyx_v_self->_index < 0) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":294
 *                     node = self._end_node()
 *                     if self._index < 0:
 *                         break             # <<<<<<<<<<<<<<
 *                     next_node = node.getnext()
 *             if next_node is not None:
 */
          goto __pyx_L9_break;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":295
 *                     if self._index < 0:
 *                         break
 *                     next_node = node.getnext()             # <<<<<<<<<<<<<<
 *             if next_node is not None:
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_node), __pyx_n_s_getnext); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_next_node, ((struct LxmlElement *)__pyx_t_2));
        __pyx_t_2 = 0;
      }
      __pyx_L9_break:;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":296
 *                         break
 *                     next_node = node.getnext()
 *             if next_node is not None:             # <<<<<<<<<<<<<<
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                          PARSE_EVENT_FILTER_START_NS):
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_next_node) != Py_None);
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":297
 *                     next_node = node.getnext()
 *             if next_node is not None:
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |             # <<<<<<<<<<<<<<
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 */
      __pyx_t_4 = ((__pyx_v_self->_event_filter & (__pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START | __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS)) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":299
 *                 if self._event_filter & (PARSE_EVENT_FILTER_START |
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)             # <<<<<<<<<<<<<<
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_4lxml_5etree_iterwalk *)__pyx_v_self->__pyx_vtab)->_start_node(__pyx_v_self, __pyx_v_next_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_ns_count = __pyx_t_6;
        goto __pyx_L12;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":300
 *                                          PARSE_EVENT_FILTER_START_NS):
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
 */
      __pyx_t_4 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
      if (__pyx_t_4) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":301
 *                     ns_count = self._start_node(next_node)
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)             # <<<<<<<<<<<<<<
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 */
        __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_next_node->_c_node);
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":302
 *                 elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )             # <<<<<<<<<<<<<<
 *                 self._index += 1
 *             if self._events:
 */
      if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[14]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ns_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_next_node));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_next_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_next_node));
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->_node_stack, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":303
 *                     ns_count = _countNsDefs(next_node._c_node)
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1             # <<<<<<<<<<<<<<
 *             if self._events:
 *                 return self._pop_event(0)
 */
      __pyx_v_self->_index = (__pyx_v_self->_index + 1);
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":304
 *                 self._node_stack.append( (next_node, ns_count) )
 *                 self._index += 1
 *             if self._events:             # <<<<<<<<<<<<<<
 *                 return self._pop_event(0)
 *         raise StopIteration
 */
    __pyx_t_4 = (__pyx_v_self->_events != Py_None) && (PyList_GET_SIZE(__pyx_v_self->_events) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":305
 *                 self._index += 1
 *             if self._events:
 *                 return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_self->_pop_event, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":306
 *             if self._events:
 *                 return self._pop_event(0)
 *         raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     cdef int _start_node(self, _Element node) except -1:
 */
  __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
  {__pyx_filename = __pyx_f[14]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":267
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_child
 *         cdef _Element node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.iterwalk.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_next_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":308
 *         raise StopIteration
 * 
 *     cdef int _start_node(self, _Element node) except -1:             # <<<<<<<<<<<<<<
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 */

static int __pyx_f_4lxml_5etree_8iterwalk__start_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  int __pyx_v_ns_count;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_node", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":310
 *     cdef int _start_node(self, _Element node) except -1:
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 */
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START_NS) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":311
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)             # <<<<<<<<<<<<<<
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)
 */
    __pyx_t_2 = __pyx_v_self->_events;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_4lxml_5etree__appendStartNsEvents(__pyx_v_node->_c_node, ((PyObject*)__pyx_t_2)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_ns_count = __pyx_t_3;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":312
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":313
 *             ns_count = _appendStartNsEvents(node._c_node, self._events)
 *         elif self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             ns_count = _countNsDefs(node._c_node)             # <<<<<<<<<<<<<<
 *         else:
 *             ns_count = 0
 */
    __pyx_v_ns_count = __pyx_f_4lxml_5etree__countNsDefs(__pyx_v_node->_c_node);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":315
 *             ns_count = _countNsDefs(node._c_node)
 *         else:
 *             ns_count = 0             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 */
    __pyx_v_ns_count = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":316
 *         else:
 *             ns_count = 0
 *         if self._event_filter & PARSE_EVENT_FILTER_START:             # <<<<<<<<<<<<<<
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( (u"start", node) )
 */
  __pyx_t_1 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_START) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":317
 *             ns_count = 0
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *                 self._events.append( (u"start", node) )
 *         return ns_count
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_matcher) == Py_None);
    if (!(__pyx_t_1 != 0)) {
      __pyx_t_4 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node) != 0);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":318
 *         if self._event_filter & PARSE_EVENT_FILTER_START:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( (u"start", node) )             # <<<<<<<<<<<<<<
 *         return ns_count
 * 
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[14]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_u_start);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_start);
      __Pyx_GIVEREF(__pyx_n_u_start);
      __Pyx_INCREF(((PyObject *)__pyx_v_node));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":319
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( (u"start", node) )
 *         return ns_count             # <<<<<<<<<<<<<<
 * 
 *     cdef _Element _end_node(self):
 */
  __pyx_r = __pyx_v_ns_count;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":308
 *         raise StopIteration
 * 
 *     cdef int _start_node(self, _Element node) except -1:             # <<<<<<<<<<<<<<
 *         cdef int ns_count
 *         if self._event_filter & PARSE_EVENT_FILTER_START_NS:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterwalk._start_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":321
 *         return ns_count
 * 
 *     cdef _Element _end_node(self):             # <<<<<<<<<<<<<<
 *         cdef _Element node
 *         cdef int i, ns_count
 */

static struct LxmlElement *__pyx_f_4lxml_5etree_8iterwalk__end_node(struct __pyx_obj_4lxml_5etree_iterwalk *__pyx_v_self) {
  struct LxmlElement *__pyx_v_node = 0;
  CYTHON_UNUSED int __pyx_v_i;
  int __pyx_v_ns_count;
  PyObject *__pyx_v_event = NULL;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_end_node", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":324
 *         cdef _Element node
 *         cdef int i, ns_count
 *         node, ns_count = self._node_stack.pop()             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 */
  if (unlikely(__pyx_v_self->_node_stack == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "pop");
    {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyList_Pop(__pyx_v_self->_node_stack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_node = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_ns_count = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":325
 *         cdef int i, ns_count
 *         node, ns_count = self._node_stack.pop()
 *         if self._event_filter & PARSE_EVENT_FILTER_END:             # <<<<<<<<<<<<<<
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( (u"end", node) )
 */
  __pyx_t_7 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END) != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":326
 *         node, ns_count = self._node_stack.pop()
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):             # <<<<<<<<<<<<<<
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS:
 */
    __pyx_t_7 = (((PyObject *)__pyx_v_self->_matcher) == Py_None);
    if (!(__pyx_t_7 != 0)) {
      __pyx_t_8 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_self->_matcher, __pyx_v_node->_c_node) != 0);
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = (__pyx_t_7 != 0);
    }
    if (__pyx_t_9) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":327
 *         if self._event_filter & PARSE_EVENT_FILTER_END:
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( (u"end", node) )             # <<<<<<<<<<<<<<
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             event = (u"end-ns", None)
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[14]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_u_end);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_end);
      __Pyx_GIVEREF(__pyx_n_u_end);
      __Pyx_INCREF(((PyObject *)__pyx_v_node));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":328
 *             if self._matcher is None or self._matcher.matches(node._c_node):
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS:             # <<<<<<<<<<<<<<
 *             event = (u"end-ns", None)
 *             for i from 0 <= i < ns_count:
 */
  __pyx_t_9 = ((__pyx_v_self->_event_filter & __pyx_e_4lxml_5etree_PARSE_EVENT_FILTER_END_NS) != 0);
  if (__pyx_t_9) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":329
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             event = (u"end-ns", None)             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)
 */
    __Pyx_INCREF(__pyx_tuple__81);
    __pyx_v_event = __pyx_tuple__81;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":330
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             event = (u"end-ns", None)
 *             for i from 0 <= i < ns_count:             # <<<<<<<<<<<<<<
 *                 self._events.append(event)
 *         return node
 */
    __pyx_t_6 = __pyx_v_ns_count;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":331
 *             event = (u"end-ns", None)
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)             # <<<<<<<<<<<<<<
 *         return node
 * 
 */
      if (unlikely(__pyx_v_self->_events == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[14]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_self->_events, __pyx_v_event); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":332
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)
 *         return node             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_node));
  __pyx_r = __pyx_v_node;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":321
 *         return ns_count
 * 
 *     cdef _Element _end_node(self):             # <<<<<<<<<<<<<<
 *         cdef _Element node
 *         cdef int i, ns_count
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.iterwalk._end_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XDECREF(__pyx_v_event);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":335
 * 
 * 
 * cdef int _countNsDefs(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

static int __pyx_f_4lxml_5etree__countNsDefs(xmlNode *__pyx_v_c_node) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_count;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNs *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_countNsDefs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":338
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 */
  __pyx_v_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":339
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         count += 1
 */
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":340
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         count += 1
 *         c_ns = c_ns.next
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_ns != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":341
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         count += 1             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
 */
    __pyx_v_count = (__pyx_v_count + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":342
 *     while c_ns is not NULL:
 *         count += 1
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
 * 
 */
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":343
 *         count += 1
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":335
 * 
 * 
 * cdef int _countNsDefs(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":346
 * 
 * 
 * cdef int _appendStartNsEvents(xmlNode* c_node, list event_list) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

static int __pyx_f_4lxml_5etree__appendStartNsEvents(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_event_list) {
  xmlNs *__pyx_v_c_ns;
  int __pyx_v_count;
  PyObject *__pyx_v_ns_tuple = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  xmlNs *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_appendStartNsEvents", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":349
 *     cdef xmlNs* c_ns
 *     cdef int count
 *     count = 0             # <<<<<<<<<<<<<<
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 */
  __pyx_v_count = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":350
 *     cdef int count
 *     count = 0
 *     c_ns = c_node.nsDef             # <<<<<<<<<<<<<<
 *     while c_ns is not NULL:
 *         ns_tuple = (funicode(c_ns.prefix) if c_ns.prefix is not NULL else '',
 */
  __pyx_t_1 = __pyx_v_c_node->nsDef;
  __pyx_v_c_ns = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":351
 *     count = 0
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:             # <<<<<<<<<<<<<<
 *         ns_tuple = (funicode(c_ns.prefix) if c_ns.prefix is not NULL else '',
 *                     funicode(c_ns.href))
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_c_ns != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":352
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         ns_tuple = (funicode(c_ns.prefix) if c_ns.prefix is not NULL else '',             # <<<<<<<<<<<<<<
 *                     funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )
 */
    if (((__pyx_v_c_ns->prefix != NULL) != 0)) {
      __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->prefix); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __Pyx_INCREF(__pyx_kp_s__15);
      __pyx_t_3 = __pyx_kp_s__15;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":353
 *     while c_ns is not NULL:
 *         ns_tuple = (funicode(c_ns.prefix) if c_ns.prefix is not NULL else '',
 *                     funicode(c_ns.href))             # <<<<<<<<<<<<<<
 *         event_list.append( (u"start-ns", ns_tuple) )
 *         count += 1
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_ns->href); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":352
 *     c_ns = c_node.nsDef
 *     while c_ns is not NULL:
 *         ns_tuple = (funicode(c_ns.prefix) if c_ns.prefix is not NULL else '',             # <<<<<<<<<<<<<<
 *                     funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 352; __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);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ns_tuple, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":354
 *         ns_tuple = (funicode(c_ns.prefix) if c_ns.prefix is not NULL else '',
 *                     funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )             # <<<<<<<<<<<<<<
 *         count += 1
 *         c_ns = c_ns.next
 */
    if (unlikely(__pyx_v_event_list == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[14]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_kp_u_start_ns);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_start_ns);
    __Pyx_GIVEREF(__pyx_kp_u_start_ns);
    __Pyx_INCREF(__pyx_v_ns_tuple);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ns_tuple);
    __Pyx_GIVEREF(__pyx_v_ns_tuple);
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_event_list, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":355
 *                     funicode(c_ns.href))
 *         event_list.append( (u"start-ns", ns_tuple) )
 *         count += 1             # <<<<<<<<<<<<<<
 *         c_ns = c_ns.next
 *     return count
 */
    __pyx_v_count = (__pyx_v_count + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":356
 *         event_list.append( (u"start-ns", ns_tuple) )
 *         count += 1
 *         c_ns = c_ns.next             # <<<<<<<<<<<<<<
 *     return count
 */
    __pyx_t_1 = __pyx_v_c_ns->next;
    __pyx_v_c_ns = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":357
 *         count += 1
 *         c_ns = c_ns.next
 *     return count             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_count;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":346
 * 
 * 
 * cdef int _appendStartNsEvents(xmlNode* c_node, list event_list) except -1:             # <<<<<<<<<<<<<<
 *     cdef xmlNs* c_ns
 *     cdef int count
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._appendStartNsEvents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_tuple);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLID(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_47XMLID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_46XMLID[] = "XMLID(text, parser=None, base_url=None)\n\n    Parse the text and return a tuple (root node, ID dictionary).  The root\n    node is the same as returned by the XML() function.  The dictionary\n    contains string-element pairs.  The dictionary keys are the values of 'id'\n    attributes.  The elements referenced by the ID are stored as dictionary\n    values.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_47XMLID = {__Pyx_NAMESTR("XMLID"), (PyCFunction)__pyx_pw_4lxml_5etree_47XMLID, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_46XMLID)};
static PyObject *__pyx_pw_4lxml_5etree_47XMLID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XMLID (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "XMLID") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLID", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_46XMLID(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

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

static PyObject *__pyx_pf_4lxml_5etree_46XMLID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  PyObject *__pyx_v_dic = 0;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XMLID", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":14
 *     cdef dict dic
 *     global _find_id_attributes
 *     if _find_id_attributes is None:             # <<<<<<<<<<<<<<
 *         _find_id_attributes = XPath(u'//[inserted by cython to avoid comment start]*[string(@id)]')
 * 
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__find_id_attributes == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath(u'//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_id_attributes);
    __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_id_attributes, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":18
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 *     root = XML(text, parser, base_url=base_url)             # <<<<<<<<<<<<<<
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_XML); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __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[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_text);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  __Pyx_INCREF(__pyx_v_parser);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_base_url, __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 18; __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_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_root = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":19
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}             # <<<<<<<<<<<<<<
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem
 */
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_dic = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":20
 *     root = XML(text, parser, base_url=base_url)
 *     dic = {}
 *     for elem in _find_id_attributes(root):             # <<<<<<<<<<<<<<
 *         dic[elem.get(u'id')] = elem
 *     return (root, dic)
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_root);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__find_id_attributes, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_8(__pyx_t_6);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[15]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":21
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem             # <<<<<<<<<<<<<<
 *     return (root, dic)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_dic, __pyx_t_4, __pyx_v_elem) < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":22
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem
 *     return (root, dic)             # <<<<<<<<<<<<<<
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_root);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __Pyx_INCREF(__pyx_v_dic);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_dic);
  __Pyx_GIVEREF(__pyx_v_dic);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLID(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.XMLID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dic);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":24
 *     return (root, dic)
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLDTDID(text, parser=None, base_url=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_49XMLDTDID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_48XMLDTDID[] = "XMLDTDID(text, parser=None, base_url=None)\n\n    Parse the text and return a tuple (root node, ID dictionary).  The root\n    node is the same as returned by the XML() function.  The dictionary\n    contains string-element pairs.  The dictionary keys are the values of ID\n    attributes as defined by the DTD.  The elements referenced by the ID are\n    stored as dictionary values.\n\n    Note that you must not modify the XML tree if you use the ID dictionary.\n    The results are undefined.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_49XMLDTDID = {__Pyx_NAMESTR("XMLDTDID"), (PyCFunction)__pyx_pw_4lxml_5etree_49XMLDTDID, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_48XMLDTDID)};
static PyObject *__pyx_pw_4lxml_5etree_49XMLDTDID(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XMLDTDID (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "XMLDTDID") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XMLDTDID", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLDTDID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_48XMLDTDID(__pyx_self, __pyx_v_text, __pyx_v_parser, __pyx_v_base_url);

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

static PyObject *__pyx_pf_4lxml_5etree_48XMLDTDID(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlElement *__pyx_v_root = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XMLDTDID", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":37
 *     """
 *     cdef _Element root
 *     root = XML(text, parser, base_url=base_url)             # <<<<<<<<<<<<<<
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XML); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __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[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_text);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  __Pyx_INCREF(__pyx_v_parser);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_parser);
  __Pyx_GIVEREF(__pyx_v_parser);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_base_url, __pyx_v_base_url) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_root = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":39
 *     root = XML(text, parser, base_url=base_url)
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *         return (root, {})
 *     else:
 */
  __pyx_t_5 = ((__pyx_v_root->_doc->_c_doc->ids == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":40
 *     # xml:id spec compatible implementation: use DTD ID attributes from libxml2
 *     if root._doc._c_doc.ids is NULL:
 *         return (root, {})             # <<<<<<<<<<<<<<
 *     else:
 *         return (root, _IDDict(root))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":42
 *         return (root, {})
 *     else:
 *         return (root, _IDDict(root))             # <<<<<<<<<<<<<<
 * 
 * def parseid(source, parser=None, *, base_url=None):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 42; __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[15]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_root));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_root));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":24
 *     return (root, dic)
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLDTDID(text, parser=None, base_url=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XMLDTDID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":44
 *         return (root, _IDDict(root))
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parseid(source, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_51parseid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_50parseid[] = "parseid(source, parser=None)\n\n    Parses the source into a tuple containing an ElementTree object and an\n    ID dictionary.  If no parser is provided as second argument, the default\n    parser is used.\n\n    Note that you must not modify the XML tree if you use the ID dictionary.\n    The results are undefined.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_51parseid = {__Pyx_NAMESTR("parseid"), (PyCFunction)__pyx_pw_4lxml_5etree_51parseid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_50parseid)};
static PyObject *__pyx_pw_4lxml_5etree_51parseid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_parser = 0;
  PyObject *__pyx_v_base_url = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parseid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,&__pyx_n_s_base_url,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parseid") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_parser = values[1];
    __pyx_v_base_url = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseid", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.parseid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_50parseid(__pyx_self, __pyx_v_source, __pyx_v_parser, __pyx_v_base_url);

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

static PyObject *__pyx_pf_4lxml_5etree_50parseid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, PyObject *__pyx_v_parser, PyObject *__pyx_v_base_url) {
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parseid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":55
 *     """
 *     cdef _Document doc
 *     doc = _parseDocument(source, parser, base_url)             # <<<<<<<<<<<<<<
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))
 * 
 */
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_source, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_base_url)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":56
 *     cdef _Document doc
 *     doc = _parseDocument(source, parser, base_url)
 *     return (_elementTreeFactory(doc, None), _IDDict(doc))             # <<<<<<<<<<<<<<
 * 
 * cdef class _IDDict:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __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[15]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 56; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":44
 *         return (root, _IDDict(root))
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parseid(source, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.parseid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":69
 *     cdef object _keys
 *     cdef object _items
 *     def __cinit__(self, etree):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_IDDict_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7_IDDict_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._IDDict.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict___cinit__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), __pyx_v_etree);

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

static int __pyx_pf_4lxml_5etree_7_IDDict___cinit__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":71
 *     def __cinit__(self, etree):
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, u"No ID dictionary available."
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":72
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"No ID dictionary available."
 *         self._doc = doc
 */
  __pyx_t_2 = ((__pyx_v_doc->_c_doc->ids == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":73
 *         doc = _documentOrRaise(etree)
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, u"No ID dictionary available."             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self._keys  = None
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_No_ID_dictionary_available, 0, 0);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":74
 *         if doc._c_doc.ids is NULL:
 *             raise ValueError, u"No ID dictionary available."
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self._keys  = None
 *         self._items = None
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":75
 *             raise ValueError, u"No ID dictionary available."
 *         self._doc = doc
 *         self._keys  = None             # <<<<<<<<<<<<<<
 *         self._items = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_keys);
  __Pyx_DECREF(__pyx_v_self->_keys);
  __pyx_v_self->_keys = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":76
 *         self._doc = doc
 *         self._keys  = None
 *         self._items = None             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_items);
  __Pyx_DECREF(__pyx_v_self->_items);
  __pyx_v_self->_items = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":69
 *     cdef object _keys
 *     cdef object _items
 *     def __cinit__(self, etree):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         doc = _documentOrRaise(etree)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_2copy(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_2copy(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":79
 * 
 *     def copy(self):
 *         return _IDDict(self._doc)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_doc));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__IDDict)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 79; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":78
 *         self._items = None
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return _IDDict(self._doc)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":81
 *         return _IDDict(self._doc)
 * 
 *     def __getitem__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlHashTable* c_ids
 *         cdef tree.xmlID* c_id
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_4__getitem__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), ((PyObject *)__pyx_v_id_name));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_4__getitem__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  xmlHashTable *__pyx_v_c_ids;
  xmlID *__pyx_v_c_id;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_id_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlHashTable *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  xmlAttr *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":85
 *         cdef tree.xmlID* c_id
 *         cdef xmlAttr* c_attr
 *         c_ids = self._doc._c_doc.ids             # <<<<<<<<<<<<<<
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 */
  __pyx_t_1 = __pyx_v_self->_doc->_c_doc->ids;
  __pyx_v_c_ids = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":86
 *         cdef xmlAttr* c_attr
 *         c_ids = self._doc._c_doc.ids
 *         id_utf = _utf8(id_name)             # <<<<<<<<<<<<<<
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__utf8(__pyx_v_id_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_id_utf = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":87
 *         c_ids = self._doc._c_doc.ids
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))             # <<<<<<<<<<<<<<
 *         if c_id is NULL:
 *             raise KeyError, u"key not found."
 */
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(__pyx_v_c_ids, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_id_utf)));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":88
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"key not found."
 *         c_attr = c_id.attr
 */
  __pyx_t_3 = ((__pyx_v_c_id == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":89
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(c_ids, _xcstr(id_utf))
 *         if c_id is NULL:
 *             raise KeyError, u"key not found."             # <<<<<<<<<<<<<<
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_kp_u_key_not_found, 0, 0);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":90
 *         if c_id is NULL:
 *             raise KeyError, u"key not found."
 *         c_attr = c_id.attr             # <<<<<<<<<<<<<<
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, u"ID attribute not found."
 */
  __pyx_t_4 = __pyx_v_c_id->attr;
  __pyx_v_c_attr = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":91
 *             raise KeyError, u"key not found."
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:             # <<<<<<<<<<<<<<
 *             raise KeyError, u"ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)
 */
  __pyx_t_3 = ((__pyx_v_c_attr == NULL) != 0);
  if (!__pyx_t_3) {
    __pyx_t_5 = ((__pyx_v_c_attr->parent == NULL) != 0);
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":92
 *         c_attr = c_id.attr
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, u"ID attribute not found."             # <<<<<<<<<<<<<<
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 */
    __Pyx_Raise(__pyx_builtin_KeyError, __pyx_kp_u_ID_attribute_not_found, 0, 0);
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":93
 *         if c_attr is NULL or c_attr.parent is NULL:
 *             raise KeyError, u"ID attribute not found."
 *         return _elementFactory(self._doc, c_attr.parent)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":81
 *         return _IDDict(self._doc)
 * 
 *     def __getitem__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlHashTable* c_ids
 *         cdef tree.xmlID* c_id
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._IDDict.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_7get(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_7get(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_6get(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), ((PyObject *)__pyx_v_id_name));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_6get(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":96
 * 
 *     def get(self, id_name):
 *         return self[id_name]             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, id_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_id_name); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":95
 *         return _elementFactory(self._doc, c_attr.parent)
 * 
 *     def get(self, id_name):             # <<<<<<<<<<<<<<
 *         return self[id_name]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":98
 *         return self[id_name]
 * 
 *     def __contains__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7_IDDict_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static int __pyx_pw_4lxml_5etree_7_IDDict_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_8__contains__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), ((PyObject *)__pyx_v_id_name));

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

static int __pyx_pf_4lxml_5etree_7_IDDict_8__contains__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_id_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":100
 *     def __contains__(self, id_name):
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)             # <<<<<<<<<<<<<<
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _xcstr(id_utf))
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_id_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_id_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":101
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(             # <<<<<<<<<<<<<<
 *             self._doc._c_doc.ids, _xcstr(id_utf))
 *         return c_id is not NULL
 */
  __pyx_v_c_id = ((xmlID *)xmlHashLookup(__pyx_v_self->_doc->_c_doc->ids, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_id_utf)));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":103
 *         c_id = <tree.xmlID*>tree.xmlHashLookup(
 *             self._doc._c_doc.ids, _xcstr(id_utf))
 *         return c_id is not NULL             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, id_name):
 */
  __pyx_r = (__pyx_v_c_id != NULL);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":98
 *         return self[id_name]
 * 
 *     def __contains__(self, id_name):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlID* c_id
 *         id_utf = _utf8(id_name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_11has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_11has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_10has_key(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self), ((PyObject *)__pyx_v_id_name));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_10has_key(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self, PyObject *__pyx_v_id_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":106
 * 
 *     def has_key(self, id_name):
 *         return id_name in self             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_id_name, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":105
 *         return c_id is not NULL
 * 
 *     def has_key(self, id_name):             # <<<<<<<<<<<<<<
 *         return id_name in self
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":108
 *         return id_name in self
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(dict(self))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_13__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_12__repr__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_12__repr__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":109
 * 
 *     def __repr__(self):
 *         return repr(dict(self))             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 109; __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_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":108
 *         return id_name in self
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return repr(dict(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_15keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_15keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_14keys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_14keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":112
 * 
 *     def keys(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return self._keys[:]
 */
  __pyx_t_1 = (__pyx_v_self->_keys == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":113
 *     def keys(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return self._keys[:]
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":114
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return self._keys[:]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_self->_keys, 0, 0, NULL, NULL, &__pyx_slice__84, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":111
 *         return repr(dict(self))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":116
 *         return self._keys[:]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_17__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_17__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_16__iter__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_16__iter__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":117
 * 
 *     def __iter__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return iter(self._keys)
 */
  __pyx_t_1 = (__pyx_v_self->_keys == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":118
 *     def __iter__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return iter(self._keys)
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":119
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return iter(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_v_self->_keys;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":116
 *         return self._keys[:]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IDDict.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_18iterkeys(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_18iterkeys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":122
 * 
 *     def iterkeys(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":121
 *         return iter(self._keys)
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":124
 *         return self
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_4lxml_5etree_7_IDDict_21__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4lxml_5etree_7_IDDict_21__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_20__len__(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_4lxml_5etree_7_IDDict_20__len__(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":125
 * 
 *     def __len__(self):
 *         if self._keys is None:             # <<<<<<<<<<<<<<
 *             self._keys = self._build_keys()
 *         return len(self._keys)
 */
  __pyx_t_1 = (__pyx_v_self->_keys == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":126
 *     def __len__(self):
 *         if self._keys is None:
 *             self._keys = self._build_keys()             # <<<<<<<<<<<<<<
 *         return len(self._keys)
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_keys(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_keys);
    __Pyx_DECREF(__pyx_v_self->_keys);
    __pyx_v_self->_keys = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":127
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return len(self._keys)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
  __pyx_t_3 = __pyx_v_self->_keys;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":124
 *         return self
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_23items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_23items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_22items(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_22items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":130
 * 
 *     def items(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return self._items[:]
 */
  __pyx_t_1 = (__pyx_v_self->_items == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":131
 *     def items(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return self._items[:]
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":132
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return self._items[:]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_self->_items, 0, 0, NULL, NULL, &__pyx_slice__85, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":129
 *         return len(self._keys)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._IDDict.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_25iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_25iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_24iteritems(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_24iteritems(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":135
 * 
 *     def iteritems(self):
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         return iter(self._items)
 */
  __pyx_t_1 = (__pyx_v_self->_items == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":136
 *     def iteritems(self):
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         return iter(self._items)
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":137
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return iter(self._items)             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_v_self->_items;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":134
 *         return self._items[:]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._IDDict.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_27values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_27values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_26values(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_26values(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":140
 * 
 *     def values(self):
 *         cdef list values = []             # <<<<<<<<<<<<<<
 *         if self._items is None:
 *             self._items = self._build_items()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_values = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":141
 *     def values(self):
 *         cdef list values = []
 *         if self._items is None:             # <<<<<<<<<<<<<<
 *             self._items = self._build_items()
 *         for item in self._items:
 */
  __pyx_t_2 = (__pyx_v_self->_items == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":142
 *         cdef list values = []
 *         if self._items is None:
 *             self._items = self._build_items()             # <<<<<<<<<<<<<<
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__IDDict *)__pyx_v_self->__pyx_vtab)->_build_items(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_items);
    __Pyx_DECREF(__pyx_v_self->_items);
    __pyx_v_self->_items = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":143
 *         if self._items is None:
 *             self._items = self._build_items()
 *         for item in self._items:             # <<<<<<<<<<<<<<
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
 */
  if (PyList_CheckExact(__pyx_v_self->_items) || PyTuple_CheckExact(__pyx_v_self->_items)) {
    __pyx_t_1 = __pyx_v_self->_items; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[15]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":144
 *             self._items = self._build_items()
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)             # <<<<<<<<<<<<<<
 *             python.Py_INCREF(value)
 *             values.append(value)
 */
    __pyx_t_6 = PyTuple_GET_ITEM(__pyx_v_item, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":145
 *         for item in self._items:
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)             # <<<<<<<<<<<<<<
 *             values.append(value)
 *         return values
 */
    Py_INCREF(__pyx_v_value);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":146
 *             value = python.PyTuple_GET_ITEM(item, 1)
 *             python.Py_INCREF(value)
 *             values.append(value)             # <<<<<<<<<<<<<<
 *         return values
 * 
 */
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_values, __pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":147
 *             python.Py_INCREF(value)
 *             values.append(value)
 *         return values             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_values);
  __pyx_r = __pyx_v_values;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":139
 *         return iter(self._items)
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         cdef list values = []
 *         if self._items is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._IDDict.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_29itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_7_IDDict_29itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_7_IDDict_28itervalues(((struct __pyx_obj_4lxml_5etree__IDDict *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_7_IDDict_28itervalues(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":150
 * 
 *     def itervalues(self):
 *         return iter(self.values())             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 150; __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_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":149
 *         return values
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         return iter(self.values())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._IDDict.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":152
 *         return iter(self.values())
 * 
 *     cdef object _build_keys(self):             # <<<<<<<<<<<<<<
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 */

static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_keys(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_keys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":153
 * 
 *     cdef object _build_keys(self):
 *         keys = []             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashKeys, <python.PyObject*>keys)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_keys = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":154
 *     cdef object _build_keys(self):
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,             # <<<<<<<<<<<<<<
 *                          <tree.xmlHashScanner>_collectIdHashKeys, <python.PyObject*>keys)
 *         return keys
 */
  xmlHashScan(((xmlHashTable *)__pyx_v_self->_doc->_c_doc->ids), ((xmlHashScanner)__pyx_f_4lxml_5etree__collectIdHashKeys), ((PyObject *)__pyx_v_keys));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":156
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashKeys, <python.PyObject*>keys)
 *         return keys             # <<<<<<<<<<<<<<
 * 
 *     cdef object _build_items(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_keys);
  __pyx_r = __pyx_v_keys;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":152
 *         return iter(self.values())
 * 
 *     cdef object _build_keys(self):             # <<<<<<<<<<<<<<
 *         keys = []
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict._build_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":158
 *         return keys
 * 
 *     cdef object _build_items(self):             # <<<<<<<<<<<<<<
 *         items = []
 *         context = (items, self._doc)
 */

static PyObject *__pyx_f_4lxml_5etree_7_IDDict__build_items(struct __pyx_obj_4lxml_5etree__IDDict *__pyx_v_self) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_context = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_items", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":159
 * 
 *     cdef object _build_items(self):
 *         items = []             # <<<<<<<<<<<<<<
 *         context = (items, self._doc)
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":160
 *     cdef object _build_items(self):
 *         items = []
 *         context = (items, self._doc)             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_items);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_items);
  __Pyx_GIVEREF(__pyx_v_items);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_doc));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_context = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":161
 *         items = []
 *         context = (items, self._doc)
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,             # <<<<<<<<<<<<<<
 *                          <tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
 *         return items
 */
  xmlHashScan(((xmlHashTable *)__pyx_v_self->_doc->_c_doc->ids), ((xmlHashScanner)__pyx_f_4lxml_5etree__collectIdHashItemList), ((PyObject *)__pyx_v_context));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":163
 *         tree.xmlHashScan(<tree.xmlHashTable*>self._doc._c_doc.ids,
 *                          <tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
 *         return items             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_items);
  __pyx_r = __pyx_v_items;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":158
 *         return keys
 * 
 *     cdef object _build_items(self):             # <<<<<<<<<<<<<<
 *         items = []
 *         context = (items, self._doc)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._IDDict._build_items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_context);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name):             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef list lst
 */

static void __pyx_f_4lxml_5etree__collectIdHashItemList(void *__pyx_v_payload, void *__pyx_v_context, xmlChar *__pyx_v_name) {
  PyObject *__pyx_v_lst = 0;
  xmlID *__pyx_v_c_id;
  PyObject *__pyx_v_doc = NULL;
  struct LxmlElement *__pyx_v_element = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectIdHashItemList", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":168
 *     # collect elements from ID attribute hash table
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 */
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":169
 *     cdef list lst
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     lst, doc = <tuple>context
 */
  __pyx_t_1 = ((__pyx_v_c_id == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_id->attr == NULL) != 0);
    if (!__pyx_t_2) {
      __pyx_t_3 = ((__pyx_v_c_id->attr->parent == NULL) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":170
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":171
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     lst, doc = <tuple>context             # <<<<<<<<<<<<<<
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     lst.append( (funicode(name), element) )
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_context);
  __Pyx_INCREF(__pyx_t_5);
  if (likely(__pyx_t_5 != Py_None)) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[15]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[15]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_lst = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_v_doc = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":172
 *         return
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)             # <<<<<<<<<<<<<<
 *     lst.append( (funicode(name), element) )
 * 
 */
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_id->attr->parent)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":173
 *     lst, doc = <tuple>context
 *     element = _elementFactory(doc, c_id.attr.parent)
 *     lst.append( (funicode(name), element) )             # <<<<<<<<<<<<<<
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name):
 */
  if (unlikely(__pyx_v_lst == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __pyx_t_5 = 0;
  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_lst, __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":165
 *         return items
 * 
 * cdef void _collectIdHashItemList(void* payload, void* context, xmlChar* name):             # <<<<<<<<<<<<<<
 *     # collect elements from ID attribute hash table
 *     cdef list lst
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashItemList", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lst);
  __Pyx_XDECREF(__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":175
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name):             # <<<<<<<<<<<<<<
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 */

static void __pyx_f_4lxml_5etree__collectIdHashKeys(void *__pyx_v_payload, void *__pyx_v_collect_list, xmlChar *__pyx_v_name) {
  xmlID *__pyx_v_c_id;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectIdHashKeys", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":176
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name):
 *     c_id = <tree.xmlID*>payload             # <<<<<<<<<<<<<<
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 */
  __pyx_v_c_id = ((xmlID *)__pyx_v_payload);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":177
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name):
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:             # <<<<<<<<<<<<<<
 *         return
 *     (<list>collect_list).append(funicode(name))
 */
  __pyx_t_1 = ((__pyx_v_c_id == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_id->attr == NULL) != 0);
    if (!__pyx_t_2) {
      __pyx_t_3 = ((__pyx_v_c_id->attr->parent == NULL) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":178
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return             # <<<<<<<<<<<<<<
 *     (<list>collect_list).append(funicode(name))
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":179
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 *         return
 *     (<list>collect_list).append(funicode(name))             # <<<<<<<<<<<<<<
 */
  if (unlikely(((PyObject *)__pyx_v_collect_list) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[15]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __pyx_f_4lxml_5etree_funicode(__pyx_v_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyList_Append(((PyObject*)__pyx_v_collect_list), __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":175
 *     lst.append( (funicode(name), element) )
 * 
 * cdef void _collectIdHashKeys(void* payload, void* collect_list, xmlChar* name):             # <<<<<<<<<<<<<<
 *     c_id = <tree.xmlID*>payload
 *     if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("lxml.etree._collectIdHashKeys", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":18
 *     """
 *     cdef _ErrorLog _error_log
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_8XInclude_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_8XInclude_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_4lxml_5etree_8XInclude___init__(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_8XInclude___init__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":19
 *     cdef _ErrorLog _error_log
 *     def __init__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":18
 *     """
 *     cdef _ErrorLog _error_log
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XInclude.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":22
 * 
 *     property error_log:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XInclude instance not initialised"
 *             return self._error_log.copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_9error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_8XInclude_9error_log___get__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":23
 *     property error_log:
 *         def __get__(self):
 *             assert self._error_log is not None, "XInclude instance not initialised"             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XInclude_instance_not_initialise);
      {__pyx_filename = __pyx_f[16]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":24
 *         def __get__(self):
 *             assert self._error_log is not None, "XInclude instance not initialised"
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _Element node not None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":22
 * 
 *     property error_log:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XInclude instance not initialised"
 *             return self._error_log.copy()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XInclude.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":26
 *             return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         u"__call__(self, node)"
 *         # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_8XInclude_2__call__[] = "__call__(self, node)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_8XInclude_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_node = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_node = ((struct LxmlElement *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[16]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XInclude.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_4lxml_5etree__Element, 0, "node", 0))) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_8XInclude_2__call__(((struct __pyx_obj_4lxml_5etree_XInclude *)__pyx_v_self), __pyx_v_node);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_8XInclude_2__call__(struct __pyx_obj_4lxml_5etree_XInclude *__pyx_v_self, struct LxmlElement *__pyx_v_node) {
  int __pyx_v_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":36
 *         # i.e. as a sibling, which does not conflict with traversal.
 *         cdef int result
 *         _assertValidNode(node)             # <<<<<<<<<<<<<<
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         self._error_log.connect()
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":37
 *         cdef int result
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *         self._error_log.connect()
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!(__pyx_t_2 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_evaluator_not_initialised);
      {__pyx_filename = __pyx_f[16]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":38
 *         _assertValidNode(node)
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         self._error_log.connect()             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_connect(__pyx_v_self->_error_log); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":40
 *         self._error_log.connect()
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             if node._doc._parser is not None:
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_node->_doc->_parser);
  __Pyx_INCREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":39
 *         assert self._error_log is not None, "XPath evaluator not initialised"
 *         self._error_log.connect()
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(             # <<<<<<<<<<<<<<
 *             node._doc._parser)
 *         with nogil:
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_3));
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":41
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if node._doc._parser is not None:
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":42
 *             node._doc._parser)
 *         with nogil:
 *             if node._doc._parser is not None:             # <<<<<<<<<<<<<<
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 *                     node._c_node, node._doc._parser._parse_options)
 */
        __pyx_t_2 = (((PyObject *)__pyx_v_node->_doc->_parser) != Py_None);
        __pyx_t_4 = (__pyx_t_2 != 0);
        if (__pyx_t_4) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":43
 *         with nogil:
 *             if node._doc._parser is not None:
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(             # <<<<<<<<<<<<<<
 *                     node._c_node, node._doc._parser._parse_options)
 *             else:
 */
          __pyx_v_result = xmlXIncludeProcessTreeFlags(__pyx_v_node->_c_node, __pyx_v_node->_doc->_parser->_parse_options);
          goto __pyx_L6;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":46
 *                     node._c_node, node._doc._parser._parse_options)
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()
 */
          __pyx_v_result = xmlXIncludeProcessTree(__pyx_v_node->_c_node);
        }
        __pyx_L6:;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":41
 *         __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(
 *             node._doc._parser)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             if node._doc._parser is not None:
 *                 result = xinclude.xmlXIncludeProcessTreeFlags(
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":47
 *             else:
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *         __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 *         self._error_log.disconnect()
 * 
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":48
 *                 result = xinclude.xmlXIncludeProcessTree(node._c_node)
 *         __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 *         self._error_log.disconnect()             # <<<<<<<<<<<<<<
 * 
 *         if result == -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_9_ErrorLog_disconnect(__pyx_v_self->_error_log); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":50
 *         self._error_log.disconnect()
 * 
 *         if result == -1:             # <<<<<<<<<<<<<<
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(
 */
  __pyx_t_4 = ((__pyx_v_result == -1) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":51
 * 
 *         if result == -1:
 *             raise XIncludeError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"XInclude processing failed"),
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_XIncludeError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":52
 *         if result == -1:
 *             raise XIncludeError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"XInclude processing failed"),
 *                 self._error_log)
 */
    __pyx_t_5 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_kp_u_XInclude_processing_failed); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":51
 * 
 *         if result == -1:
 *             raise XIncludeError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"XInclude processing failed"),
 */
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __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);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
    PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_self->_error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[16]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":26
 *             return self._error_log.copy()
 * 
 *     def __call__(self, _Element node not None):             # <<<<<<<<<<<<<<
 *         u"__call__(self, node)"
 *         # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element):             # <<<<<<<<<<<<<<
 *     u"""cleanup_namespaces(tree_or_element)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_53cleanup_namespaces(PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element); /*proto*/
static char __pyx_doc_4lxml_5etree_52cleanup_namespaces[] = "cleanup_namespaces(tree_or_element)\n\n    Remove all namespace declarations from a subtree that are not used\n    by any of the elements or attributes in that tree.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_53cleanup_namespaces = {__Pyx_NAMESTR("cleanup_namespaces"), (PyCFunction)__pyx_pw_4lxml_5etree_53cleanup_namespaces, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_52cleanup_namespaces)};
static PyObject *__pyx_pw_4lxml_5etree_53cleanup_namespaces(PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cleanup_namespaces (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_52cleanup_namespaces(__pyx_self, ((PyObject *)__pyx_v_tree_or_element));

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

static PyObject *__pyx_pf_4lxml_5etree_52cleanup_namespaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cleanup_namespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":10
 *     """
 *     cdef _Element element
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":11
 *     cdef _Element element
 *     element = _rootNodeOrRaise(tree_or_element)
 *     _removeUnusedNamespaceDeclarations(element._c_node)             # <<<<<<<<<<<<<<
 * 
 * def strip_attributes(tree_or_element, *attribute_names):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__removeUnusedNamespaceDeclarations(__pyx_v_element->_c_node); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element):             # <<<<<<<<<<<<<<
 *     u"""cleanup_namespaces(tree_or_element)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.cleanup_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":13
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     u"""strip_attributes(tree_or_element, *attribute_names)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_55strip_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_54strip_attributes[] = "strip_attributes(tree_or_element, *attribute_names)\n\n    Delete all attributes with the provided attribute names from an\n    Element (or ElementTree) and its descendants.\n\n    Attribute names can contain wildcards as in `_Element.iter`.\n\n    Example usage::\n\n        strip_attributes(root_element,\n                         'simpleattr',\n                         '{http://some/ns}attrname',\n                         '{http://other/ns}*')\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_55strip_attributes = {__Pyx_NAMESTR("strip_attributes"), (PyCFunction)__pyx_pw_4lxml_5etree_55strip_attributes, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_54strip_attributes)};
static PyObject *__pyx_pw_4lxml_5etree_55strip_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_attribute_names = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_attributes (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_attribute_names = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_attribute_names)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_attribute_names);
  } else {
    __pyx_v_attribute_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree_or_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "strip_attributes") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_tree_or_element = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_attributes", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_attribute_names); __pyx_v_attribute_names = 0;
  __Pyx_AddTraceback("lxml.etree.strip_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_54strip_attributes(__pyx_self, __pyx_v_tree_or_element, __pyx_v_attribute_names);

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

static PyObject *__pyx_pf_4lxml_5etree_54strip_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_attribute_names) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher = 0;
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_attributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":31
 *     cdef _Element element
 * 
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not attribute_names:
 *         return
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":32
 * 
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (__pyx_v_attribute_names != Py_None) && (PyTuple_GET_SIZE(__pyx_v_attribute_names) != 0);
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":33
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not attribute_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher(attribute_names)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":35
 *         return
 * 
 *     matcher = _MultiTagMatcher(attribute_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_attribute_names);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_attribute_names);
  __Pyx_GIVEREF(__pyx_v_attribute_names);
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":36
 * 
 *     matcher = _MultiTagMatcher(attribute_names)
 *     matcher.cacheTags(element._doc)             # <<<<<<<<<<<<<<
 *     if matcher.rejectsAllAttributes():
 *         return
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_matcher, ((struct LxmlDocument *)__pyx_t_4), NULL); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":37
 *     matcher = _MultiTagMatcher(attribute_names)
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():             # <<<<<<<<<<<<<<
 *         return
 *     _strip_attributes(element._c_node, matcher)
 */
  __pyx_t_3 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes(__pyx_v_matcher) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":38
 *     matcher.cacheTags(element._doc)
 *     if matcher.rejectsAllAttributes():
 *         return             # <<<<<<<<<<<<<<
 *     _strip_attributes(element._c_node, matcher)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":39
 *     if matcher.rejectsAllAttributes():
 *         return
 *     _strip_attributes(element._c_node, matcher)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_attributes(xmlNode* c_node, _MultiTagMatcher matcher):
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_attributes(__pyx_v_element->_c_node, __pyx_v_matcher); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":13
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     u"""strip_attributes(tree_or_element, *attribute_names)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.strip_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matcher);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":41
 *     _strip_attributes(element._c_node, matcher)
 * 
 * cdef _strip_attributes(xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlAttr* c_attr
 *     cdef xmlAttr* c_next_attr
 */

static PyObject *__pyx_f_4lxml_5etree__strip_attributes(xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher) {
  xmlAttr *__pyx_v_c_attr;
  xmlAttr *__pyx_v_c_next_attr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttr *__pyx_t_2;
  __Pyx_RefNannySetupContext("_strip_attributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":44
 *     cdef xmlAttr* c_attr
 *     cdef xmlAttr* c_next_attr
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = c_node.properties
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":45
 *     cdef xmlAttr* c_next_attr
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":46
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = c_node.properties             # <<<<<<<<<<<<<<
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next
 */
    __pyx_t_2 = __pyx_v_c_node->properties;
    __pyx_v_c_attr = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":47
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:             # <<<<<<<<<<<<<<
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_attr != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":48
 *         c_attr = c_node.properties
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next             # <<<<<<<<<<<<<<
 *             if matcher.matchesAttribute(c_attr):
 *                 tree.xmlRemoveProp(c_attr)
 */
      __pyx_t_2 = __pyx_v_c_attr->next;
      __pyx_v_c_next_attr = __pyx_t_2;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":49
 *         while c_attr is not NULL:
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):             # <<<<<<<<<<<<<<
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr
 */
      __pyx_t_1 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute(__pyx_v_matcher, __pyx_v_c_attr) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":50
 *             c_next_attr = c_attr.next
 *             if matcher.matchesAttribute(c_attr):
 *                 tree.xmlRemoveProp(c_attr)             # <<<<<<<<<<<<<<
 *             c_attr = c_next_attr
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
        xmlRemoveProp(__pyx_v_c_attr);
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":51
 *             if matcher.matchesAttribute(c_attr):
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 */
      __pyx_v_c_attr = __pyx_v_c_next_attr;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":52
 *                 tree.xmlRemoveProp(c_attr)
 *             c_attr = c_next_attr
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":41
 *     _strip_attributes(element._c_node, matcher)
 * 
 * cdef _strip_attributes(xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlAttr* c_attr
 *     cdef xmlAttr* c_next_attr
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":54
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_57strip_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_56strip_elements[] = "strip_elements(tree_or_element, *tag_names, with_tail=True)\n\n    Delete all elements with the provided tag names from a tree or\n    subtree.  This will remove the elements and their entire subtree,\n    including all their attributes, text content and descendants.  It\n    will also remove the tail text of the element unless you\n    explicitly set the ``with_tail`` keyword argument option to False.\n\n    Tag names can contain wildcards as in `_Element.iter`.\n\n    Note that this will not delete the element (or ElementTree root\n    element) that you passed even if it matches.  It will only treat\n    its descendants.  If you want to include the root element, check\n    its tag name directly before even calling this function.\n\n    Example usage::\n\n        strip_elements(some_element,\n            'simpletagname',             # non-namespaced tag\n            '{http://some/ns}tagname',   # namespaced tag\n            '{http://some/other/ns}*'    # any tag from a namespace\n            lxml.etree.Comment           # comments\n            )\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_57strip_elements = {__Pyx_NAMESTR("strip_elements"), (PyCFunction)__pyx_pw_4lxml_5etree_57strip_elements, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_56strip_elements)};
static PyObject *__pyx_pw_4lxml_5etree_57strip_elements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_element = 0;
  int __pyx_v_with_tail;
  PyObject *__pyx_v_tag_names = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_elements (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tag_names = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tag_names)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tag_names);
  } else {
    __pyx_v_tag_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,&__pyx_n_s_with_tail,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree_or_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "strip_elements") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_tree_or_element = values[0];
    if (values[1]) {
      __pyx_v_with_tail = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_with_tail == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_with_tail = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_elements", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tag_names); __pyx_v_tag_names = 0;
  __Pyx_AddTraceback("lxml.etree.strip_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_56strip_elements(__pyx_self, __pyx_v_tree_or_element, __pyx_v_with_tail, __pyx_v_tag_names);

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

static PyObject *__pyx_pf_4lxml_5etree_56strip_elements(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, int __pyx_v_with_tail, PyObject *__pyx_v_tag_names) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher = 0;
  struct LxmlElement *__pyx_v_element = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  CYTHON_UNUSED int __pyx_v_strip_comments;
  CYTHON_UNUSED int __pyx_v_strip_pis;
  CYTHON_UNUSED int __pyx_v_strip_entities;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_elements", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":85
 *     cdef qname* c_ns_tags
 *     cdef Py_ssize_t c_tag_count
 *     cdef bint strip_comments = 0, strip_pis = 0, strip_entities = 0             # <<<<<<<<<<<<<<
 * 
 *     doc = _documentOrRaise(tree_or_element)
 */
  __pyx_v_strip_comments = 0;
  __pyx_v_strip_pis = 0;
  __pyx_v_strip_entities = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":87
 *     cdef bint strip_comments = 0, strip_pis = 0, strip_entities = 0
 * 
 *     doc = _documentOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":88
 * 
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not tag_names:
 *         return
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":89
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (__pyx_v_tag_names != Py_None) && (PyTuple_GET_SIZE(__pyx_v_tag_names) != 0);
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":90
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher(tag_names)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":92
 *         return
 * 
 *     matcher = _MultiTagMatcher(tag_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag_names);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag_names);
  __Pyx_GIVEREF(__pyx_v_tag_names);
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":93
 * 
 *     matcher = _MultiTagMatcher(tag_names)
 *     matcher.cacheTags(doc)             # <<<<<<<<<<<<<<
 *     if matcher.rejectsAll():
 *         return
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_matcher, __pyx_v_doc, NULL); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":94
 *     matcher = _MultiTagMatcher(tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(__pyx_v_matcher) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":95
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(tree_or_element, _ElementTree):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":97
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_tree_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":99
 *     if isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):
 */
    __pyx_t_2 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_COMMENT_NODE) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":100
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)             # <<<<<<<<<<<<<<
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_COMMENT_NODE, __pyx_v_with_tail); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":101
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 */
    __pyx_t_2 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_PI_NODE) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":102
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, with_tail)
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)             # <<<<<<<<<<<<<<
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 * 
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_PI_NODE, __pyx_v_with_tail); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":103
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, with_tail)
 *     _strip_elements(doc, element._c_node, matcher, with_tail)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher,
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_elements(__pyx_v_doc, __pyx_v_element->_c_node, __pyx_v_matcher, __pyx_v_with_tail); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":54
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.strip_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matcher);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":105
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher,             # <<<<<<<<<<<<<<
 *                      bint with_tail):
 *     cdef xmlNode* c_child
 */

static PyObject *__pyx_f_4lxml_5etree__strip_elements(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher, int __pyx_v_with_tail) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strip_elements", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":110
 *     cdef xmlNode* c_next
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         # we run through the children here to prevent any problems
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":111
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":115
 *         # with the tree iteration which would occur if we unlinked the
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
 */
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":116
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":117
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 */
      __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":118
 *         while c_child is not NULL:
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:
 */
      __pyx_t_1 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_matcher, __pyx_v_c_child) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":119
 *             c_next = _nextElement(c_child)
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)
 */
        __pyx_t_1 = ((__pyx_v_c_child->type == XML_ELEMENT_NODE) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":120
 *             if matcher.matches(c_child):
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:             # <<<<<<<<<<<<<<
 *                         tree.xmlUnlinkNode(c_child)
 *                     _removeNode(doc, c_child)
 */
          __pyx_t_1 = ((!(__pyx_v_with_tail != 0)) != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":121
 *                 if c_child.type == tree.XML_ELEMENT_NODE:
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                     _removeNode(doc, c_child)
 *                 else:
 */
            xmlUnlinkNode(__pyx_v_c_child);
            goto __pyx_L8;
          }
          __pyx_L8:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":122
 *                     if not with_tail:
 *                         tree.xmlUnlinkNode(c_child)
 *                     _removeNode(doc, c_child)             # <<<<<<<<<<<<<<
 *                 else:
 *                     if with_tail:
 */
          __pyx_t_2 = __pyx_f_4lxml_5etree__removeNode(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L7;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":124
 *                     _removeNode(doc, c_child)
 *                 else:
 *                     if with_tail:             # <<<<<<<<<<<<<<
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
 */
          __pyx_t_1 = (__pyx_v_with_tail != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":125
 *                 else:
 *                     if with_tail:
 *                         _removeText(c_child.next)             # <<<<<<<<<<<<<<
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)
 */
            __pyx_f_4lxml_5etree__removeText(__pyx_v_c_child->next);
            goto __pyx_L9;
          }
          __pyx_L9:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":126
 *                     if with_tail:
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                     attemptDeallocation(c_child)
 *             c_child = c_next
 */
          xmlUnlinkNode(__pyx_v_c_child);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":127
 *                         _removeText(c_child.next)
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
          __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child);
        }
        __pyx_L7:;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":128
 *                     tree.xmlUnlinkNode(c_child)
 *                     attemptDeallocation(c_child)
 *             c_child = c_next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 */
      __pyx_v_c_child = __pyx_v_c_next;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":129
 *                     attemptDeallocation(c_child)
 *             c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":105
 *     _strip_elements(doc, element._c_node, matcher, with_tail)
 * 
 * cdef _strip_elements(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher,             # <<<<<<<<<<<<<<
 *                      bint with_tail):
 *     cdef xmlNode* c_child
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._strip_elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":132
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     u"""strip_tags(tree_or_element, *tag_names)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_59strip_tags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_58strip_tags[] = "strip_tags(tree_or_element, *tag_names)\n\n    Delete all elements with the provided tag names from a tree or\n    subtree.  This will remove the elements and their attributes, but\n    *not* their text/tail content or descendants.  Instead, it will\n    merge the text content and children of the element into its\n    parent.\n\n    Tag names can contain wildcards as in `_Element.iter`.\n\n    Note that this will not delete the element (or ElementTree root\n    element) that you passed even if it matches.  It will only treat\n    its descendants.\n\n    Example usage::\n\n        strip_tags(some_element,\n            'simpletagname',             # non-namespaced tag\n            '{http://some/ns}tagname',   # namespaced tag\n            '{http://some/other/ns}*'    # any tag from a namespace\n            Comment                      # comments (including their text!)\n            )\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_59strip_tags = {__Pyx_NAMESTR("strip_tags"), (PyCFunction)__pyx_pw_4lxml_5etree_59strip_tags, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_58strip_tags)};
static PyObject *__pyx_pw_4lxml_5etree_59strip_tags(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_element = 0;
  PyObject *__pyx_v_tag_names = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_tags (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_tag_names = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_tag_names)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_tag_names);
  } else {
    __pyx_v_tag_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_or_element,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree_or_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "strip_tags") < 0)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_tree_or_element = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strip_tags", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[17]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_tag_names); __pyx_v_tag_names = 0;
  __Pyx_AddTraceback("lxml.etree.strip_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_58strip_tags(__pyx_self, __pyx_v_tree_or_element, __pyx_v_tag_names);

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

static PyObject *__pyx_pf_4lxml_5etree_58strip_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree_or_element, PyObject *__pyx_v_tag_names) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher = 0;
  struct LxmlElement *__pyx_v_element = 0;
  struct LxmlDocument *__pyx_v_doc = 0;
  CYTHON_UNUSED int __pyx_v_strip_comments;
  CYTHON_UNUSED int __pyx_v_strip_pis;
  CYTHON_UNUSED int __pyx_v_strip_entities;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strip_tags", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":160
 *     cdef _Document doc
 *     cdef list ns_tags
 *     cdef bint strip_comments = 0, strip_pis = 0, strip_entities = 0             # <<<<<<<<<<<<<<
 *     cdef char** c_ns_tags
 *     cdef Py_ssize_t c_tag_count
 */
  __pyx_v_strip_comments = 0;
  __pyx_v_strip_pis = 0;
  __pyx_v_strip_entities = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":164
 *     cdef Py_ssize_t c_tag_count
 * 
 *     doc = _documentOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":165
 * 
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)             # <<<<<<<<<<<<<<
 *     if not tag_names:
 *         return
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_tree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":166
 *     doc = _documentOrRaise(tree_or_element)
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_2 = (__pyx_v_tag_names != Py_None) && (PyTuple_GET_SIZE(__pyx_v_tag_names) != 0);
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":167
 *     element = _rootNodeOrRaise(tree_or_element)
 *     if not tag_names:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     matcher = _MultiTagMatcher(tag_names)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":169
 *         return
 * 
 *     matcher = _MultiTagMatcher(tag_names)             # <<<<<<<<<<<<<<
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_tag_names);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag_names);
  __Pyx_GIVEREF(__pyx_v_tag_names);
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MultiTagMatcher)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":170
 * 
 *     matcher = _MultiTagMatcher(tag_names)
 *     matcher.cacheTags(doc)             # <<<<<<<<<<<<<<
 *     if matcher.rejectsAll():
 *         return
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags(__pyx_v_matcher, __pyx_v_doc, NULL); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":171
 *     matcher = _MultiTagMatcher(tag_names)
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_3 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll(__pyx_v_matcher) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":172
 *     matcher.cacheTags(doc)
 *     if matcher.rejectsAll():
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(tree_or_element, _ElementTree):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":174
 *         return
 * 
 *     if isinstance(tree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_tree_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":176
 *     if isinstance(tree_or_element, _ElementTree):
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):
 */
    __pyx_t_2 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_COMMENT_NODE) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":177
 *         # include PIs and comments next to the root node
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)             # <<<<<<<<<<<<<<
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_COMMENT_NODE, 0); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":178
 *         if matcher.matchesType(tree.XML_COMMENT_NODE):
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):             # <<<<<<<<<<<<<<
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 *     _strip_tags(doc, element._c_node, matcher)
 */
    __pyx_t_2 = (__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType(__pyx_v_matcher, XML_PI_NODE) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":179
 *             _removeSiblings(element._c_node, tree.XML_COMMENT_NODE, 0)
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)             # <<<<<<<<<<<<<<
 *     _strip_tags(doc, element._c_node, matcher)
 * 
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__removeSiblings(__pyx_v_element->_c_node, XML_PI_NODE, 0); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":180
 *         if matcher.matchesType(tree.XML_PI_NODE):
 *             _removeSiblings(element._c_node, tree.XML_PI_NODE, 0)
 *     _strip_tags(doc, element._c_node, matcher)             # <<<<<<<<<<<<<<
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher):
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__strip_tags(__pyx_v_doc, __pyx_v_element->_c_node, __pyx_v_matcher); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":132
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     u"""strip_tags(tree_or_element, *tag_names)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.strip_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_matcher);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":182
 *     _strip_tags(doc, element._c_node, matcher)
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_next
 */

static PyObject *__pyx_f_4lxml_5etree__strip_tags(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__MultiTagMatcher *__pyx_v_matcher) {
  xmlNode *__pyx_v_c_child;
  xmlNode *__pyx_v_c_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  xmlNode *__pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strip_tags", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":187
 *     cdef Py_ssize_t i
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)             # <<<<<<<<<<<<<<
 *     if c_node.type == tree.XML_ELEMENT_NODE:
 *         # we run through the children here to prevent any problems
 */
  BEGIN_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node, __pyx_v_c_node, 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":188
 * 
 *     tree.BEGIN_FOR_EACH_ELEMENT_FROM(c_node, c_node, 1)
 *     if c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *         # we run through the children here to prevent any problems
 *         # with the tree iteration which would occur if we unlinked the
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ELEMENT_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":192
 *         # with the tree iteration which would occur if we unlinked the
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)             # <<<<<<<<<<<<<<
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):
 */
    __pyx_v_c_child = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, 0);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":193
 *         # c_node itself
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:             # <<<<<<<<<<<<<<
 *             if not matcher.matches(c_child):
 *                 c_child = _nextElement(c_child)
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_child != NULL) != 0);
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":194
 *         c_child = _findChildForwards(c_node, 0)
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):             # <<<<<<<<<<<<<<
 *                 c_child = _nextElement(c_child)
 *                 continue
 */
      __pyx_t_1 = ((!(__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches(__pyx_v_matcher, __pyx_v_c_child) != 0)) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":195
 *         while c_child is not NULL:
 *             if not matcher.matches(c_child):
 *                 c_child = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 */
        __pyx_v_c_child = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":196
 *             if not matcher.matches(c_child):
 *                 c_child = _nextElement(c_child)
 *                 continue             # <<<<<<<<<<<<<<
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 */
        goto __pyx_L4_continue;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":197
 *                 c_child = _nextElement(c_child)
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)
 */
      __pyx_t_1 = ((__pyx_v_c_child->type == XML_ELEMENT_NODE) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":198
 *                 continue
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_child, 0);
        if (!__pyx_t_2) {
          __pyx_t_3 = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);
          __pyx_t_4 = __pyx_t_3;
        } else {
          __pyx_t_4 = __pyx_t_2;
        }
        __pyx_v_c_next = __pyx_t_4;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":199
 *             if c_child.type == tree.XML_ELEMENT_NODE:
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)             # <<<<<<<<<<<<<<
 *                 if not attemptDeallocation(c_child):
 *                     if c_child.nsDef is not NULL:
 */
        __pyx_t_5 = __pyx_f_4lxml_5etree__replaceNodeByChildren(__pyx_v_doc, __pyx_v_c_child); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":200
 *                 c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):             # <<<<<<<<<<<<<<
 *                     if c_child.nsDef is not NULL:
 *                         # make namespaces absolute
 */
        __pyx_t_1 = ((!(__pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child) != 0)) != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":201
 *                 _replaceNodeByChildren(doc, c_child)
 *                 if not attemptDeallocation(c_child):
 *                     if c_child.nsDef is not NULL:             # <<<<<<<<<<<<<<
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)
 */
          __pyx_t_1 = ((__pyx_v_c_child->nsDef != NULL) != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":203
 *                     if c_child.nsDef is not NULL:
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *             else:
 */
            __pyx_t_5 = __pyx_f_4lxml_5etree_moveNodeToDocument(__pyx_v_doc, __pyx_v_doc->_c_doc, __pyx_v_c_child); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L9;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }
        __pyx_L8:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":204
 *                         # make namespaces absolute
 *                         moveNodeToDocument(doc, doc._c_doc, c_child)
 *                 c_child = c_next             # <<<<<<<<<<<<<<
 *             else:
 *                 c_next = _nextElement(c_child)
 */
        __pyx_v_c_child = __pyx_v_c_next;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":206
 *                 c_child = c_next
 *             else:
 *                 c_next = _nextElement(c_child)             # <<<<<<<<<<<<<<
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
 */
        __pyx_v_c_next = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_child);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":207
 *             else:
 *                 c_next = _nextElement(c_child)
 *                 tree.xmlUnlinkNode(c_child)             # <<<<<<<<<<<<<<
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next
 */
        xmlUnlinkNode(__pyx_v_c_child);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":208
 *                 c_next = _nextElement(c_child)
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)             # <<<<<<<<<<<<<<
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
        __pyx_f_4lxml_5etree_attemptDeallocation(__pyx_v_c_child);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":209
 *                 tree.xmlUnlinkNode(c_child)
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next             # <<<<<<<<<<<<<<
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 */
        __pyx_v_c_child = __pyx_v_c_next;
      }
      __pyx_L7:;
      __pyx_L4_continue:;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":210
 *                 attemptDeallocation(c_child)
 *                 c_child = c_next
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)             # <<<<<<<<<<<<<<
 */
  END_FOR_EACH_ELEMENT_FROM(__pyx_v_c_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":182
 *     _strip_tags(doc, element._c_node, matcher)
 * 
 * cdef _strip_tags(_Document doc, xmlNode* c_node, _MultiTagMatcher matcher):             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_child
 *     cdef xmlNode* c_next
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._strip_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":48
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_12_BaseContext___cinit__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":49
 * 
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
 */
  __pyx_v_self->_xpathCtxt = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":48
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":51
 *         self._xpathCtxt = NULL
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         cdef _ExsltRegExp _regexp
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_12_BaseContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_12_BaseContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_error_log,&__pyx_n_s_enable_regexp,&__pyx_n_s_build_smart_strings,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_extensions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_log)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enable_regexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_build_smart_strings)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_error_log = values[2];
    __pyx_v_enable_regexp = values[3];
    __pyx_v_build_smart_strings = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_BaseContext_2__init__(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings);

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

static int __pyx_pf_4lxml_5etree_12_BaseContext_2__init__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v__regexp = 0;
  PyObject *__pyx_v_new_extensions = 0;
  PyObject *__pyx_v_ns = 0;
  PyObject *__pyx_v_extension = NULL;
  PyObject *__pyx_v_ns_uri = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":56
 *         cdef dict new_extensions
 *         cdef list ns
 *         self._utf_refs = {}             # <<<<<<<<<<<<<<
 *         self._global_namespaces = []
 *         self._function_cache = {}
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_utf_refs);
  __Pyx_DECREF(__pyx_v_self->_utf_refs);
  __pyx_v_self->_utf_refs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":57
 *         cdef list ns
 *         self._utf_refs = {}
 *         self._global_namespaces = []             # <<<<<<<<<<<<<<
 *         self._function_cache = {}
 *         self._eval_context_dict = None
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_global_namespaces);
  __Pyx_DECREF(__pyx_v_self->_global_namespaces);
  __pyx_v_self->_global_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":58
 *         self._utf_refs = {}
 *         self._global_namespaces = []
 *         self._function_cache = {}             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 *         self._error_log = error_log
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_function_cache);
  __Pyx_DECREF(__pyx_v_self->_function_cache);
  __pyx_v_self->_function_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":59
 *         self._global_namespaces = []
 *         self._function_cache = {}
 *         self._eval_context_dict = None             # <<<<<<<<<<<<<<
 *         self._error_log = error_log
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
  __Pyx_DECREF(__pyx_v_self->_eval_context_dict);
  __pyx_v_self->_eval_context_dict = ((PyObject*)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":60
 *         self._function_cache = {}
 *         self._eval_context_dict = None
 *         self._error_log = error_log             # <<<<<<<<<<<<<<
 * 
 *         if extensions is not None:
 */
  if (!(likely(((__pyx_v_error_log) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_error_log, __pyx_ptype_4lxml_5etree__ErrorLog))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_error_log;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":62
 *         self._error_log = error_log
 * 
 *         if extensions is not None:             # <<<<<<<<<<<<<<
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):
 */
  __pyx_t_2 = (__pyx_v_extensions != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":64
 *         if extensions is not None:
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):             # <<<<<<<<<<<<<<
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 */
    __pyx_t_3 = PyDict_Check(__pyx_v_extensions); 
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":65
 *             # convert extensions to UTF-8
 *             if isinstance(extensions, dict):
 *                 extensions = (extensions,)             # <<<<<<<<<<<<<<
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_extensions);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_extensions);
      __Pyx_GIVEREF(__pyx_v_extensions);
      __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":67
 *                 extensions = (extensions,)
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}             # <<<<<<<<<<<<<<
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_new_extensions = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":68
 *             # format: [ {(ns, name):function} ] -> {(ns_utf, name_utf):function}
 *             new_extensions = {}
 *             for extension in extensions:             # <<<<<<<<<<<<<<
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
 */
    if (PyList_CheckExact(__pyx_v_extensions) || PyTuple_CheckExact(__pyx_v_extensions)) {
      __pyx_t_1 = __pyx_v_extensions; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_extensions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":69
 *             new_extensions = {}
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():             # <<<<<<<<<<<<<<
 *                     if name is None:
 *                         raise ValueError, u"extensions must have non empty names"
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_extension, __pyx_n_s_items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
        __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      for (;;) {
        if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_6)) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_6)) {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_7 = __pyx_t_9(__pyx_t_6);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
          PyObject* sequence = __pyx_t_7;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          #else
          __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          #endif
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
          index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_10);
          index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_11);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_13 = NULL;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L10_unpacking_done;
          __pyx_L9_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_13 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L10_unpacking_done:;
        }
        if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
          PyObject* sequence = __pyx_t_10;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_14);
          #else
          __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_14);
          #endif
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_15 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_13 = Py_TYPE(__pyx_t_15)->tp_iternext;
          index = 0; __pyx_t_12 = __pyx_t_13(__pyx_t_15); if (unlikely(!__pyx_t_12)) goto __pyx_L11_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_12);
          index = 1; __pyx_t_14 = __pyx_t_13(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L11_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_14);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_13 = NULL;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L12_unpacking_done;
          __pyx_L11_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_13 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L12_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_12);
        __pyx_t_12 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_14);
        __pyx_t_14 = 0;
        __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":70
 *             for extension in extensions:
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:             # <<<<<<<<<<<<<<
 *                         raise ValueError, u"extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 */
        __pyx_t_2 = (__pyx_v_name == Py_None);
        __pyx_t_3 = (__pyx_t_2 != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":71
 *                 for (ns_uri, name), function in extension.items():
 *                     if name is None:
 *                         raise ValueError, u"extensions must have non empty names"             # <<<<<<<<<<<<<<
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)
 */
          __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_extensions_must_have_non_empty_n, 0, 0);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":72
 *                     if name is None:
 *                         raise ValueError, u"extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_v_ns_utf, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":73
 *                         raise ValueError, u"extensions must have non empty names"
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *                     new_extensions[(ns_utf, name_utf)] = function
 *             extensions = new_extensions or None
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":74
 *                     ns_utf   = self._to_utf(ns_uri)
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function             # <<<<<<<<<<<<<<
 *             extensions = new_extensions or None
 * 
 */
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_ns_utf);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        __Pyx_INCREF(__pyx_v_name_utf);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (unlikely(PyDict_SetItem(__pyx_v_new_extensions, __pyx_t_7, __pyx_v_function) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":75
 *                     name_utf = self._to_utf(name)
 *                     new_extensions[(ns_utf, name_utf)] = function
 *             extensions = new_extensions or None             # <<<<<<<<<<<<<<
 * 
 *         if namespaces is not None:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_new_extensions); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_3) {
      __Pyx_INCREF(Py_None);
      __pyx_t_1 = Py_None;
    } else {
      __Pyx_INCREF(__pyx_v_new_extensions);
      __pyx_t_1 = __pyx_v_new_extensions;
    }
    __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":77
 *             extensions = new_extensions or None
 * 
 *         if namespaces is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 */
  __pyx_t_3 = (__pyx_v_namespaces != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":78
 * 
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):             # <<<<<<<<<<<<<<
 *                 namespaces = namespaces.items()
 *             if namespaces:
 */
    __pyx_t_2 = PyDict_Check(__pyx_v_namespaces); 
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":79
 *         if namespaces is not None:
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()             # <<<<<<<<<<<<<<
 *             if namespaces:
 *                 ns = []
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_namespaces, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_namespaces, __pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":80
 *             if isinstance(namespaces, dict):
 *                 namespaces = namespaces.items()
 *             if namespaces:             # <<<<<<<<<<<<<<
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_namespaces); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":81
 *                 namespaces = namespaces.items()
 *             if namespaces:
 *                 ns = []             # <<<<<<<<<<<<<<
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 */
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_ns = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":82
 *             if namespaces:
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:             # <<<<<<<<<<<<<<
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \
 */
      if (PyList_CheckExact(__pyx_v_namespaces) || PyTuple_CheckExact(__pyx_v_namespaces)) {
        __pyx_t_6 = __pyx_v_namespaces; __Pyx_INCREF(__pyx_t_6); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_namespaces); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
      }
      for (;;) {
        if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_6)) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_6)) {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_1 = __pyx_t_5(__pyx_t_6);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
          PyObject* sequence = __pyx_t_1;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_11);
          #else
          __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext;
          index = 0; __pyx_t_7 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L19_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_7);
          index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_11);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_13 = NULL;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          goto __pyx_L20_unpacking_done;
          __pyx_L19_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_13 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L20_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":83
 *                 ns = []
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             u"empty namespace prefix is not supported in XPath"
 */
        __pyx_t_3 = (__pyx_v_prefix == Py_None);
        if (!(__pyx_t_3 != 0)) {
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_16 = ((!__pyx_t_2) != 0);
          __pyx_t_2 = __pyx_t_16;
        } else {
          __pyx_t_2 = (__pyx_t_3 != 0);
        }
        if (__pyx_t_2) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":84
 *                 for prefix, ns_uri in namespaces:
 *                     if prefix is None or not prefix:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             u"empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_empty_namespace_prefix_is_not_su, 0, 0);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":86
 *                         raise TypeError, \
 *                             u"empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:             # <<<<<<<<<<<<<<
 *                         raise TypeError, \
 *                             u"setting default namespace is not supported in XPath"
 */
        __pyx_t_2 = (__pyx_v_ns_uri == Py_None);
        if (!(__pyx_t_2 != 0)) {
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_16 = ((!__pyx_t_3) != 0);
          __pyx_t_3 = __pyx_t_16;
        } else {
          __pyx_t_3 = (__pyx_t_2 != 0);
        }
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":87
 *                             u"empty namespace prefix is not supported in XPath"
 *                     if ns_uri is None or not ns_uri:
 *                         raise TypeError, \             # <<<<<<<<<<<<<<
 *                             u"setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_setting_default_namespace_is_not, 0, 0);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":89
 *                         raise TypeError, \
 *                             u"setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_prefix_utf, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":90
 *                             u"setting default namespace is not supported in XPath"
 *                     prefix_utf = self._to_utf(prefix)
 *                     ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 *                 namespaces = ns
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":91
 *                     prefix_utf = self._to_utf(prefix)
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )             # <<<<<<<<<<<<<<
 *                 namespaces = ns
 *             else:
 */
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_prefix_utf);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prefix_utf);
        __Pyx_GIVEREF(__pyx_v_prefix_utf);
        __Pyx_INCREF(__pyx_v_ns_uri_utf);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ns_uri_utf);
        __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
        __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_ns, __pyx_t_1); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":92
 *                     ns_uri_utf = self._to_utf(ns_uri)
 *                     ns.append( (prefix_utf, ns_uri_utf) )
 *                 namespaces = ns             # <<<<<<<<<<<<<<
 *             else:
 *                 namespaces = None
 */
      __Pyx_INCREF(__pyx_v_ns);
      __Pyx_DECREF_SET(__pyx_v_namespaces, __pyx_v_ns);
      goto __pyx_L16;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":94
 *                 namespaces = ns
 *             else:
 *                 namespaces = None             # <<<<<<<<<<<<<<
 * 
 *         self._doc        = None
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_namespaces, Py_None);
    }
    __pyx_L16:;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":96
 *                 namespaces = None
 * 
 *         self._doc        = None             # <<<<<<<<<<<<<<
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":97
 * 
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()             # <<<<<<<<<<<<<<
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 */
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_exc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_exc));
  __pyx_v_self->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":98
 *         self._doc        = None
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions             # <<<<<<<<<<<<<<
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_extensions))||((__pyx_v_extensions) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_extensions)->tp_name), 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __pyx_v_extensions;
  __Pyx_INCREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_extensions);
  __Pyx_DECREF(__pyx_v_self->_extensions);
  __pyx_v_self->_extensions = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":99
 *         self._exc        = _ExceptionContext()
 *         self._extensions = extensions
 *         self._namespaces = namespaces             # <<<<<<<<<<<<<<
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
 */
  if (!(likely(PyList_CheckExact(__pyx_v_namespaces))||((__pyx_v_namespaces) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_namespaces)->tp_name), 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __pyx_v_namespaces;
  __Pyx_INCREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_namespaces);
  __Pyx_DECREF(__pyx_v_self->_namespaces);
  __pyx_v_self->_namespaces = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":100
 *         self._extensions = extensions
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()             # <<<<<<<<<<<<<<
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings
 */
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__TempStore)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_temp_refs);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_temp_refs));
  __pyx_v_self->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":101
 *         self._namespaces = namespaces
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()             # <<<<<<<<<<<<<<
 *         self._build_smart_strings = build_smart_strings
 * 
 */
  __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_temp_documents);
  __Pyx_DECREF(__pyx_v_self->_temp_documents);
  __pyx_v_self->_temp_documents = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":102
 *         self._temp_refs  = _TempStore()
 *         self._temp_documents  = set()
 *         self._build_smart_strings = build_smart_strings             # <<<<<<<<<<<<<<
 * 
 *         if enable_regexp:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_build_smart_strings); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_build_smart_strings = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":104
 *         self._build_smart_strings = build_smart_strings
 * 
 *         if enable_regexp:             # <<<<<<<<<<<<<<
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_enable_regexp); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":105
 * 
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()             # <<<<<<<<<<<<<<
 *             _regexp._register_in_context(self)
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExsltRegExp)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v__regexp = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":106
 *         if enable_regexp:
 *             _regexp = _ExsltRegExp()
 *             _regexp._register_in_context(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(__pyx_v__regexp, __pyx_v_self); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L23;
  }
  __pyx_L23:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":51
 *         self._xpathCtxt = NULL
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         cdef _ExsltRegExp _regexp
 */

  /* function exit code */
  __pyx_r = 0;
  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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("lxml.etree._BaseContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__regexp);
  __Pyx_XDECREF(__pyx_v_new_extensions);
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XDECREF(__pyx_v_extension);
  __Pyx_XDECREF(__pyx_v_ns_uri);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_extensions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":108
 *             _regexp._register_in_context(self)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
 */

static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_BaseContext__copy(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context = 0;
  PyObject *__pyx_v_namespaces = NULL;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":110
 *     cdef _BaseContext _copy(self):
 *         cdef _BaseContext context
 *         if self._namespaces is not None:             # <<<<<<<<<<<<<<
 *             namespaces = self._namespaces[:]
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->_namespaces != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":111
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
 *             namespaces = self._namespaces[:]             # <<<<<<<<<<<<<<
 *         else:
 *             namespaces = None
 */
    if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyList_GetSlice(__pyx_v_self->_namespaces, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_namespaces = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":113
 *             namespaces = self._namespaces[:]
 *         else:
 *             namespaces = None             # <<<<<<<<<<<<<<
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_namespaces = Py_None;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":114
 *         else:
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,             # <<<<<<<<<<<<<<
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":115
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)             # <<<<<<<<<<<<<<
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->_build_smart_strings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":114
 *         else:
 *             namespaces = None
 *         context = self.__class__(namespaces, None, self._error_log, False,             # <<<<<<<<<<<<<<
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 */
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __Pyx_INCREF(Py_False);
  PyTuple_SET_ITEM(__pyx_t_5, 3, Py_False);
  __Pyx_GIVEREF(Py_False);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__BaseContext))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":116
 *         context = self.__class__(namespaces, None, self._error_log, False,
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:             # <<<<<<<<<<<<<<
 *             context._extensions = self._extensions.copy()
 *         return context
 */
  __pyx_t_2 = (__pyx_v_self->_extensions != ((PyObject*)Py_None));
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":117
 *                                  self._build_smart_strings)
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
    if (unlikely(__pyx_v_self->_extensions == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "copy");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = PyDict_Copy(__pyx_v_self->_extensions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_context->_extensions);
    __Pyx_DECREF(__pyx_v_context->_extensions);
    __pyx_v_context->_extensions = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":118
 *         if self._extensions is not None:
 *             context._extensions = self._extensions.copy()
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes _to_utf(self, s):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":108
 *             _regexp._register_in_context(self)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseContext context
 *         if self._namespaces is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":120
 *         return context
 * 
 *     cdef bytes _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         u"Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__to_utf(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_to_utf", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":123
 *         u"Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 *         if s is None:             # <<<<<<<<<<<<<<
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 */
  __pyx_t_1 = (__pyx_v_s == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":124
 *         cdef python.PyObject* dict_result
 *         if s is None:
 *             return None             # <<<<<<<<<<<<<<
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = ((PyObject*)Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":125
 *         if s is None:
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)             # <<<<<<<<<<<<<<
 *         if dict_result is not NULL:
 *             return <bytes>dict_result
 */
  __pyx_t_3 = __pyx_v_self->_utf_refs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_dict_result = PyDict_GetItem(__pyx_t_3, __pyx_v_s);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":126
 *             return None
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <bytes>dict_result
 *         utf = _utf8(s)
 */
  __pyx_t_2 = ((__pyx_v_dict_result != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":127
 *         dict_result = python.PyDict_GetItem(self._utf_refs, s)
 *         if dict_result is not NULL:
 *             return <bytes>dict_result             # <<<<<<<<<<<<<<
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_dict_result));
    __pyx_r = ((PyObject*)__pyx_v_dict_result);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":128
 *         if dict_result is not NULL:
 *             return <bytes>dict_result
 *         utf = _utf8(s)             # <<<<<<<<<<<<<<
 *         self._utf_refs[s] = utf
 *         if python.IS_PYPY:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_utf = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":129
 *             return <bytes>dict_result
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf             # <<<<<<<<<<<<<<
 *         if python.IS_PYPY:
 *             # use C level refs, PyPy refs are not enough!
 */
  if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(PyDict_SetItem(__pyx_v_self->_utf_refs, __pyx_v_s, __pyx_v_utf) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":130
 *         utf = _utf8(s)
 *         self._utf_refs[s] = utf
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)
 */
  __pyx_t_2 = (IS_PYPY != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":132
 *         if python.IS_PYPY:
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)             # <<<<<<<<<<<<<<
 *         return utf
 * 
 */
    Py_INCREF(__pyx_v_utf);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":133
 *             # use C level refs, PyPy refs are not enough!
 *             python.Py_INCREF(utf)
 *         return utf             # <<<<<<<<<<<<<<
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_utf);
  __pyx_r = __pyx_v_utf;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":120
 *         return context
 * 
 *     cdef bytes _to_utf(self, s):             # <<<<<<<<<<<<<<
 *         u"Convert to UTF-8 and keep a reference to the encoded string"
 *         cdef python.PyObject* dict_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext._to_utf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":135
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
 */

static void __pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_xpath_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":136
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         xpathCtxt.userData = <void*>self
 *         xpathCtxt.error = _receiveXPathError
 */
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":137
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self             # <<<<<<<<<<<<<<
 *         xpathCtxt.error = _receiveXPathError
 * 
 */
  __pyx_v_xpathCtxt->userData = ((void *)__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":138
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
 *         xpathCtxt.error = _receiveXPathError             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_v_xpathCtxt->error = __pyx_f_4lxml_5etree__receiveXPathError;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":135
 *         return utf
 * 
 *     cdef void _set_xpath_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         xpathCtxt.userData = <void*>self
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":141
 * 
 *     @cython.final
 *     cdef _register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self._exc.clear()
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__register_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_register_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":142
 *     @cython.final
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self._exc.clear()
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":143
 *     cdef _register_context(self, _Document doc):
 *         self._doc = doc
 *         self._exc.clear()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_exc->__pyx_vtab)->clear(__pyx_v_self->_exc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":141
 * 
 *     @cython.final
 *     cdef _register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self._exc.clear()
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":146
 * 
 *     @cython.final
 *     cdef _cleanup_context(self):             # <<<<<<<<<<<<<<
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_cleanup_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":149
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 *         if python.IS_PYPY:             # <<<<<<<<<<<<<<
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():
 */
  __pyx_t_1 = (IS_PYPY != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":151
 *         if python.IS_PYPY:
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():             # <<<<<<<<<<<<<<
 *                 python.Py_DECREF(ref)
 *         self._utf_refs.clear()
 */
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "itervalues");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_self->_utf_refs, 1, __pyx_n_s_itervalues, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, NULL, &__pyx_t_6, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":152
 *             # clean up double refs in PyPy (see "_to_utf()" method)
 *             for ref in self._utf_refs.itervalues():
 *                 python.Py_DECREF(ref)             # <<<<<<<<<<<<<<
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None
 */
      Py_DECREF(__pyx_v_ref);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":153
 *             for ref in self._utf_refs.itervalues():
 *                 python.Py_DECREF(ref)
 *         self._utf_refs.clear()             # <<<<<<<<<<<<<<
 *         self._eval_context_dict = None
 *         self._doc = None
 */
  if (unlikely(__pyx_v_self->_utf_refs == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = __Pyx_PyDict_Clear(__pyx_v_self->_utf_refs); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":154
 *                 python.Py_DECREF(ref)
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None             # <<<<<<<<<<<<<<
 *         self._doc = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
  __Pyx_DECREF(__pyx_v_self->_eval_context_dict);
  __pyx_v_self->_eval_context_dict = ((PyObject*)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":155
 *         self._utf_refs.clear()
 *         self._eval_context_dict = None
 *         self._doc = None             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_doc));
  __pyx_v_self->_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":146
 * 
 *     @cython.final
 *     cdef _cleanup_context(self):             # <<<<<<<<<<<<<<
 *         #xpath.xmlXPathRegisteredNsCleanup(self._xpathCtxt)
 *         #self.unregisterGlobalNamespaces()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseContext._cleanup_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":158
 * 
 *     @cython.final
 *     cdef _release_context(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_context(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_release_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":159
 *     @cython.final
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_xpathCtxt != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":160
 *     cdef _release_context(self):
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL             # <<<<<<<<<<<<<<
 *             self._xpathCtxt = NULL
 * 
 */
    __pyx_v_self->_xpathCtxt->userData = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":161
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL
 *             self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 * 
 *     # namespaces (internal UTF-8 methods with leading '_')
 */
    __pyx_v_self->_xpathCtxt = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":158
 * 
 *     @cython.final
 *     cdef _release_context(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             self._xpathCtxt.userData = NULL
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":165
 *     # namespaces (internal UTF-8 methods with leading '_')
 * 
 *     cdef addNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         cdef list namespaces
 *         if prefix is None:
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_addNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_v_new_item = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("addNamespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":167
 *     cdef addNamespace(self, prefix, ns_uri):
 *         cdef list namespaces
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":168
 *         cdef list namespaces
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"             # <<<<<<<<<<<<<<
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_empty_prefix_is_not_supported_in, 0, 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":169
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":170
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_ns_uri_utf = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":171
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_prefix_utf);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_prefix_utf);
  __Pyx_GIVEREF(__pyx_v_prefix_utf);
  __Pyx_INCREF(__pyx_v_ns_uri_utf);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_ns_uri_utf);
  __Pyx_GIVEREF(__pyx_v_ns_uri_utf);
  __pyx_v_new_item = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":172
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             self._namespaces = [new_item]
 *         else:
 */
  __pyx_t_2 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":173
 *         new_item = (prefix_utf, ns_uri_utf)
 *         if self._namespaces is None:
 *             self._namespaces = [new_item]             # <<<<<<<<<<<<<<
 *         else:
 *             namespaces = []
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_new_item);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_new_item);
    __Pyx_GIVEREF(__pyx_v_new_item);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(__pyx_v_self->_namespaces);
    __pyx_v_self->_namespaces = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":175
 *             self._namespaces = [new_item]
 *         else:
 *             namespaces = []             # <<<<<<<<<<<<<<
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_namespaces = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":176
 *         else:
 *             namespaces = []
 *             for item in self._namespaces:             # <<<<<<<<<<<<<<
 *                 if item[0] == prefix_utf:
 *                     item = new_item
 */
    if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __pyx_v_self->_namespaces; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":177
 *             namespaces = []
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:             # <<<<<<<<<<<<<<
 *                     item = new_item
 *                     new_item = None
 */
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_t_5, __pyx_v_prefix_utf, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":178
 *             for item in self._namespaces:
 *                 if item[0] == prefix_utf:
 *                     item = new_item             # <<<<<<<<<<<<<<
 *                     new_item = None
 *                 namespaces.append(item)
 */
        __Pyx_INCREF(__pyx_v_new_item);
        __Pyx_DECREF_SET(__pyx_v_item, __pyx_v_new_item);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":179
 *                 if item[0] == prefix_utf:
 *                     item = new_item
 *                     new_item = None             # <<<<<<<<<<<<<<
 *                 namespaces.append(item)
 *             if new_item is not None:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_new_item, Py_None);
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":180
 *                     item = new_item
 *                     new_item = None
 *                 namespaces.append(item)             # <<<<<<<<<<<<<<
 *             if new_item is not None:
 *                 namespaces.append(new_item)
 */
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_v_item); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":181
 *                     new_item = None
 *                 namespaces.append(item)
 *             if new_item is not None:             # <<<<<<<<<<<<<<
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 */
    __pyx_t_1 = (__pyx_v_new_item != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":182
 *                 namespaces.append(item)
 *             if new_item is not None:
 *                 namespaces.append(new_item)             # <<<<<<<<<<<<<<
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
 */
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_namespaces, __pyx_v_new_item); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":183
 *             if new_item is not None:
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(
 */
    __Pyx_INCREF(__pyx_v_namespaces);
    __Pyx_GIVEREF(__pyx_v_namespaces);
    __Pyx_GOTREF(__pyx_v_self->_namespaces);
    __Pyx_DECREF(__pyx_v_self->_namespaces);
    __pyx_v_self->_namespaces = __pyx_v_namespaces;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":184
 *                 namespaces.append(new_item)
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 */
  __pyx_t_2 = ((__pyx_v_self->_xpathCtxt != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":185
 *             self._namespaces = namespaces
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 */
    xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf));
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":165
 *     # namespaces (internal UTF-8 methods with leading '_')
 * 
 *     cdef addNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         cdef list namespaces
 *         if prefix is None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext.addNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XDECREF(__pyx_v_new_item);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":188
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_ns_uri) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerNamespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":189
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:             # <<<<<<<<<<<<<<
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 */
  __pyx_t_1 = (__pyx_v_prefix == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":190
 *     cdef registerNamespace(self, prefix, ns_uri):
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"             # <<<<<<<<<<<<<<
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_u_empty_prefix_is_not_supported_in, 0, 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":191
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)             # <<<<<<<<<<<<<<
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_prefix_utf = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":192
 *             raise TypeError, u"empty prefix is not supported in XPath"
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)             # <<<<<<<<<<<<<<
 *         self._global_namespaces.append(prefix_utf)
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_vtab)->_to_utf(__pyx_v_self, __pyx_v_ns_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_ns_uri_utf = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":193
 *         prefix_utf = self._to_utf(prefix)
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 */
  if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":194
 *         ns_uri_utf = self._to_utf(ns_uri)
 *         self._global_namespaces.append(prefix_utf)
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 */
  xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":188
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerNamespace(self, prefix, ns_uri):             # <<<<<<<<<<<<<<
 *         if prefix is None:
 *             raise TypeError, u"empty prefix is not supported in XPath"
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerNamespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":197
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerLocalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             return
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerLocalNamespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":198
 * 
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:             # <<<<<<<<<<<<<<
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 */
  __pyx_t_1 = (__pyx_v_self->_namespaces == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":199
 *     cdef registerLocalNamespaces(self):
 *         if self._namespaces is None:
 *             return             # <<<<<<<<<<<<<<
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":200
 *         if self._namespaces is None:
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterNs(
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 */
  if (unlikely(__pyx_v_self->_namespaces == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __pyx_v_self->_namespaces; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":201
 *             return
 *         for prefix_utf, ns_uri_utf in self._namespaces:
 *             xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 */
    xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf));
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":197
 *                                  _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerLocalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if self._namespaces is None:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerLocalNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":204
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_ns_prefixes = 0;
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_v_ns_uri_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerGlobalNamespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":205
 * 
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__find_all_extension_prefixes(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ns_prefixes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":206
 *     cdef registerGlobalNamespaces(self):
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)
 */
  __pyx_t_2 = ((PyList_GET_SIZE(__pyx_v_ns_prefixes) > 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":207
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:             # <<<<<<<<<<<<<<
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(
 */
    if (unlikely(__pyx_v_ns_prefixes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __pyx_v_ns_prefixes; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        #else
        __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
        index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ns_uri_utf, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":208
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 */
      if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->_global_namespaces, __pyx_v_prefix_utf); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":209
 *             for prefix_utf, ns_uri_utf in ns_prefixes:
 *                 self._global_namespaces.append(prefix_utf)
 *                 xpath.xmlXPathRegisterNs(             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 */
      xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_uri_utf));
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":204
 *                 self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef registerGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         cdef list ns_prefixes = _find_all_extension_prefixes()
 *         if python.PyList_GET_SIZE(ns_prefixes) > 0:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerGlobalNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_prefixes);
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XDECREF(__pyx_v_ns_uri_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":212
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef unregisterGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_v_prefix_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterGlobalNamespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":213
 * 
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:             # <<<<<<<<<<<<<<
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 */
  __pyx_t_1 = __pyx_v_self->_global_namespaces;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyList_GET_SIZE(__pyx_t_1) > 0) != 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":214
 *     cdef unregisterGlobalNamespaces(self):
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:             # <<<<<<<<<<<<<<
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _xcstr(prefix_utf), NULL)
 */
    if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __pyx_v_self->_global_namespaces; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      __Pyx_XDECREF_SET(__pyx_v_prefix_utf, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":215
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                          _xcstr(prefix_utf), NULL)
 *             del self._global_namespaces[:]
 */
      xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":217
 *                 xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                          _xcstr(prefix_utf), NULL)
 *             del self._global_namespaces[:]             # <<<<<<<<<<<<<<
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf):
 */
    if (unlikely(__pyx_v_self->_global_namespaces == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_PyObject_DelSlice(__pyx_v_self->_global_namespaces, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":212
 *                     self._xpathCtxt, _xcstr(prefix_utf), _xcstr(ns_uri_utf))
 * 
 *     cdef unregisterGlobalNamespaces(self):             # <<<<<<<<<<<<<<
 *         if python.PyList_GET_SIZE(self._global_namespaces) > 0:
 *             for prefix_utf in self._global_namespaces:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterGlobalNamespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":219
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf):             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), NULL)
 */

static void __pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_prefix_utf) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_unregisterNamespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":220
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf):
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,             # <<<<<<<<<<<<<<
 *                                  _xcstr(prefix_utf), NULL)
 * 
 */
  xmlXPathRegisterNs(__pyx_v_self->_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_prefix_utf), NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":219
 *             del self._global_namespaces[:]
 * 
 *     cdef void _unregisterNamespace(self, prefix_utf):             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterNs(self._xpathCtxt,
 *                                  _xcstr(prefix_utf), NULL)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":225
 *     # extension functions
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:             # <<<<<<<<<<<<<<
 *         if self._extensions is None:
 *             self._extensions = {}
 */

static int __pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_ns_utf, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_function) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_addLocalExtensionFunction", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":226
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
 */
  __pyx_t_1 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":227
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:
 *         if self._extensions is None:
 *             self._extensions = {}             # <<<<<<<<<<<<<<
 *         self._extensions[(ns_utf, name_utf)] = function
 *         return 0
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_extensions);
    __Pyx_DECREF(__pyx_v_self->_extensions);
    __pyx_v_self->_extensions = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":228
 *         if self._extensions is None:
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  if (unlikely(__pyx_v_self->_extensions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_ns_utf);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ns_utf);
  __Pyx_GIVEREF(__pyx_v_ns_utf);
  __Pyx_INCREF(__pyx_v_name_utf);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name_utf);
  __Pyx_GIVEREF(__pyx_v_name_utf);
  if (unlikely(PyDict_SetItem(__pyx_v_self->_extensions, __pyx_t_3, __pyx_v_function) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":229
 *             self._extensions = {}
 *         self._extensions[(ns_utf, name_utf)] = function
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":225
 *     # extension functions
 * 
 *     cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:             # <<<<<<<<<<<<<<
 *         if self._extensions is None:
 *             self._extensions = {}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext._addLocalExtensionFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":231
 *         return 0
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                  _register_function reg_func):
 *         cdef python.PyObject* dict_result
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_ns_functions = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerGlobalFunctions", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":235
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ns_functions, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":237
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 d = <dict>dict_result
 */
    __pyx_t_6 = __pyx_v_self->_function_cache;
    __Pyx_INCREF(__pyx_t_6);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":236
 *         cdef dict d
 *         for ns_utf, ns_functions in __FUNCTION_NAMESPACE_REGISTRIES.iteritems():
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:
 */
    __pyx_v_dict_result = PyDict_GetItem(__pyx_t_6, __pyx_v_ns_utf);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":238
 *             dict_result = python.PyDict_GetItem(
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 d = <dict>dict_result
 *             else:
 */
    __pyx_t_8 = ((__pyx_v_dict_result != NULL) != 0);
    if (__pyx_t_8) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":239
 *                 self._function_cache, ns_utf)
 *             if dict_result is not NULL:
 *                 d = <dict>dict_result             # <<<<<<<<<<<<<<
 *             else:
 *                 d = {}
 */
      __pyx_t_6 = ((PyObject *)__pyx_v_dict_result);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":241
 *                 d = <dict>dict_result
 *             else:
 *                 d = {}             # <<<<<<<<<<<<<<
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
 */
      __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":242
 *             else:
 *                 d = {}
 *                 self._function_cache[ns_utf] = d             # <<<<<<<<<<<<<<
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function
 */
      if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (unlikely(PyDict_SetItem(__pyx_v_self->_function_cache, __pyx_v_ns_utf, __pyx_v_d) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":243
 *                 d = {}
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():             # <<<<<<<<<<<<<<
 *                 d[name_utf] = function
 *                 reg_func(ctxt, name_utf, ns_utf)
 */
    __pyx_t_9 = 0;
    if (unlikely(__pyx_v_ns_functions == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_ns_functions, 0, __pyx_n_s_iteritems, (&__pyx_t_10), (&__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6);
    __pyx_t_6 = __pyx_t_5;
    __pyx_t_5 = 0;
    while (1) {
      __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_10, &__pyx_t_9, &__pyx_t_5, &__pyx_t_11, NULL, __pyx_t_7);
      if (unlikely(__pyx_t_12 == 0)) break;
      if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":244
 *                 self._function_cache[ns_utf] = d
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function             # <<<<<<<<<<<<<<
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 */
      if (unlikely(__pyx_v_d == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_v_name_utf, __pyx_v_function) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":245
 *             for name_utf, function in ns_functions.iteritems():
 *                 d[name_utf] = function
 *                 reg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef registerLocalFunctions(self, void* ctxt,
 */
      __pyx_v_reg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":231
 *         return 0
 * 
 *     cdef registerGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                  _register_function reg_func):
 *         cdef python.PyObject* dict_result
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerGlobalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_ns_functions);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":247
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef registerLocalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                 _register_function reg_func):
 *         cdef python.PyObject* dict_result
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_reg_func) {
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_last_ns = NULL;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerLocalFunctions", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":251
 *         cdef python.PyObject* dict_result
 *         cdef dict d
 *         if self._extensions is None:             # <<<<<<<<<<<<<<
 *             return # done
 *         last_ns = None
 */
  __pyx_t_1 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":252
 *         cdef dict d
 *         if self._extensions is None:
 *             return # done             # <<<<<<<<<<<<<<
 *         last_ns = None
 *         d = None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":253
 *         if self._extensions is None:
 *             return # done
 *         last_ns = None             # <<<<<<<<<<<<<<
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_last_ns = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":254
 *             return # done
 *         last_ns = None
 *         d = None             # <<<<<<<<<<<<<<
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_d = ((PyObject*)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":255
 *         last_ns = None
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():             # <<<<<<<<<<<<<<
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf
 */
  __pyx_t_4 = 0;
  if (unlikely(__pyx_v_self->_extensions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_self->_extensions, 1, __pyx_n_s_iteritems, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_3);
  __pyx_t_3 = __pyx_t_7;
  __pyx_t_7 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_t_8);
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      #else
      __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
      index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_XDECREF_SET(__pyx_v_function, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":256
 *         d = None
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:             # <<<<<<<<<<<<<<
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
 */
    __pyx_t_2 = (__pyx_v_ns_utf != __pyx_v_last_ns);
    if (!(__pyx_t_2 != 0)) {
      __pyx_t_1 = (__pyx_v_d == ((PyObject*)Py_None));
      __pyx_t_14 = (__pyx_t_1 != 0);
    } else {
      __pyx_t_14 = (__pyx_t_2 != 0);
    }
    if (__pyx_t_14) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":257
 *         for (ns_utf, name_utf), function in self._extensions.iteritems():
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf             # <<<<<<<<<<<<<<
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 */
      __Pyx_INCREF(__pyx_v_ns_utf);
      __Pyx_DECREF_SET(__pyx_v_last_ns, __pyx_v_ns_utf);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":259
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)             # <<<<<<<<<<<<<<
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result
 */
      __pyx_t_8 = __pyx_v_self->_function_cache;
      __Pyx_INCREF(__pyx_t_8);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":258
 *             if ns_utf is not last_ns or d is None:
 *                 last_ns = ns_utf
 *                 dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:
 */
      __pyx_v_dict_result = PyDict_GetItem(__pyx_t_8, __pyx_v_ns_utf);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":260
 *                 dict_result = python.PyDict_GetItem(
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                     d = <dict>dict_result
 *                 else:
 */
      __pyx_t_14 = ((__pyx_v_dict_result != NULL) != 0);
      if (__pyx_t_14) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":261
 *                     self._function_cache, ns_utf)
 *                 if dict_result is not NULL:
 *                     d = <dict>dict_result             # <<<<<<<<<<<<<<
 *                 else:
 *                     d = {}
 */
        __pyx_t_8 = ((PyObject *)__pyx_v_dict_result);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_DECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_8));
        __pyx_t_8 = 0;
        goto __pyx_L9;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":263
 *                     d = <dict>dict_result
 *                 else:
 *                     d = {}             # <<<<<<<<<<<<<<
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
 */
        __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF_SET(__pyx_v_d, ((PyObject*)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":264
 *                 else:
 *                     d = {}
 *                     self._function_cache[ns_utf] = d             # <<<<<<<<<<<<<<
 *             d[name_utf] = function
 *             reg_func(ctxt, name_utf, ns_utf)
 */
        if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        if (unlikely(PyDict_SetItem(__pyx_v_self->_function_cache, __pyx_v_ns_utf, __pyx_v_d) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":265
 *                     d = {}
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function             # <<<<<<<<<<<<<<
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 */
    if (unlikely(__pyx_v_d == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_v_name_utf, __pyx_v_function) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":266
 *                     self._function_cache[ns_utf] = d
 *             d[name_utf] = function
 *             reg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,
 */
    __pyx_v_reg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":247
 *                 reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef registerLocalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                 _register_function reg_func):
 *         cdef python.PyObject* dict_result
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("lxml.etree._BaseContext.registerLocalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_last_ns);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":268
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_functions = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterAllFunctions", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":270
 *     cdef unregisterAllFunctions(self, void* ctxt,
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():             # <<<<<<<<<<<<<<
 *             for name_utf in functions:
 *                 unreg_func(ctxt, name_utf, ns_utf)
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->_function_cache, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_functions, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":271
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 */
    if (PyList_CheckExact(__pyx_v_functions) || PyTuple_CheckExact(__pyx_v_functions)) {
      __pyx_t_6 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_6)) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_6)) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":272
 *         for ns_utf, functions in self._function_cache.iteritems():
 *             for name_utf in functions:
 *                 unreg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,
 */
      __pyx_v_unreg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":268
 *             reg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterAllFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                       _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.iteritems():
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterAllFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":274
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, void *__pyx_v_ctxt, __pyx_t_4lxml_5etree__register_function __pyx_v_unreg_func) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_functions = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregisterGlobalFunctions", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":276
 *     cdef unregisterGlobalFunctions(self, void* ctxt,
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():             # <<<<<<<<<<<<<<
 *             for name_utf in functions:
 *                 if self._extensions is None or \
 */
  if (unlikely(__pyx_v_self->_function_cache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->_function_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_functions, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":277
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:             # <<<<<<<<<<<<<<
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
 */
    if (PyList_CheckExact(__pyx_v_functions) || PyTuple_CheckExact(__pyx_v_functions)) {
      __pyx_t_1 = __pyx_v_functions; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_functions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_6 = __pyx_t_10(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":278
 *         for ns_utf, functions in self._function_cache.items():
 *             for name_utf in functions:
 *                 if self._extensions is None or \             # <<<<<<<<<<<<<<
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)
 */
      __pyx_t_11 = (__pyx_v_self->_extensions == ((PyObject*)Py_None));
      if (!(__pyx_t_11 != 0)) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":279
 *             for name_utf in functions:
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:             # <<<<<<<<<<<<<<
 *                     unreg_func(ctxt, name_utf, ns_utf)
 * 
 */
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_ns_utf);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        __Pyx_INCREF(__pyx_v_name_utf);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (unlikely(__pyx_v_self->_extensions == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_12 = (__Pyx_PyDict_Contains(__pyx_t_6, __pyx_v_self->_extensions, Py_NE)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = (__pyx_t_12 != 0);
      } else {
        __pyx_t_13 = (__pyx_t_11 != 0);
      }
      if (__pyx_t_13) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":280
 *                 if self._extensions is None or \
 *                        (ns_utf, name_utf) not in self._extensions:
 *                     unreg_func(ctxt, name_utf, ns_utf)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
        __pyx_v_unreg_func(__pyx_v_ctxt, __pyx_v_name_utf, __pyx_v_ns_utf);
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":274
 *                 unreg_func(ctxt, name_utf, ns_utf)
 * 
 *     cdef unregisterGlobalFunctions(self, void* ctxt,             # <<<<<<<<<<<<<<
 *                                          _register_function unreg_func):
 *         for ns_utf, functions in self._function_cache.items():
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._BaseContext.unregisterGlobalFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":283
 * 
 *     @cython.final
 *     cdef _find_cached_function(self, const_xmlChar* c_ns_uri, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *         u"""Lookup an extension function in the cache and return it.
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, const xmlChar *__pyx_v_c_ns_uri, const xmlChar *__pyx_v_c_name) {
  PyObject *__pyx_v_c_dict;
  PyObject *__pyx_v_dict_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_cached_function", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":291
 *         cdef python.PyObject* dict_result
 *         c_dict = python.PyDict_GetItem(
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)             # <<<<<<<<<<<<<<
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(
 */
  __pyx_t_1 = __pyx_v_self->_function_cache;
  __Pyx_INCREF(__pyx_t_1);
  if (((__pyx_v_c_ns_uri == NULL) != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  } else {
    __pyx_t_3 = __Pyx_PyBytes_FromUString(__pyx_v_c_ns_uri); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":290
 *         cdef python.PyObject* c_dict
 *         cdef python.PyObject* dict_result
 *         c_dict = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:
 */
  __pyx_v_c_dict = PyDict_GetItem(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":292
 *         c_dict = python.PyDict_GetItem(
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
 */
  __pyx_t_4 = ((__pyx_v_c_dict != NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":294
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)             # <<<<<<<<<<<<<<
 *             if dict_result is not NULL:
 *                 return <object>dict_result
 */
    __pyx_t_2 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":293
 *             self._function_cache, None if c_ns_uri is NULL else c_ns_uri)
 *         if c_dict is not NULL:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:
 */
    __pyx_v_dict_result = PyDict_GetItem(((PyObject *)__pyx_v_c_dict), __pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":295
 *             dict_result = python.PyDict_GetItem(
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:             # <<<<<<<<<<<<<<
 *                 return <object>dict_result
 *         return None
 */
    __pyx_t_4 = ((__pyx_v_dict_result != NULL) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":296
 *                 <object>c_dict, <unsigned char*>c_name)
 *             if dict_result is not NULL:
 *                 return <object>dict_result             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_dict_result));
      __pyx_r = ((PyObject *)__pyx_v_dict_result);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":297
 *             if dict_result is not NULL:
 *                 return <object>dict_result
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     # Python access to the XPath context for extension functions
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":283
 * 
 *     @cython.final
 *     cdef _find_cached_function(self, const_xmlChar* c_ns_uri, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *         u"""Lookup an extension function in the cache and return it.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext._find_cached_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":302
 * 
 *     property context_node:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12context_node_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12context_node_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12context_node___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":304
 *         def __get__(self):
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *                 raise XPathError, \
 *                     u"XPath context is only usable during the evaluation"
 */
  __pyx_t_1 = ((__pyx_v_self->_xpathCtxt == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":305
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:
 *                 raise XPathError, \             # <<<<<<<<<<<<<<
 *                     u"XPath context is only usable during the evaluation"
 *             c_node = self._xpathCtxt.node
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, __pyx_kp_u_XPath_context_is_only_usable_dur, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":307
 *                 raise XPathError, \
 *                     u"XPath context is only usable during the evaluation"
 *             c_node = self._xpathCtxt.node             # <<<<<<<<<<<<<<
 *             if c_node is NULL:
 *                 raise XPathError, u"no context node"
 */
  __pyx_t_3 = __pyx_v_self->_xpathCtxt->node;
  __pyx_v_c_node = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":308
 *                     u"XPath context is only usable during the evaluation"
 *             c_node = self._xpathCtxt.node
 *             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                 raise XPathError, u"no context node"
 *             if c_node.doc != self._xpathCtxt.doc:
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":309
 *             c_node = self._xpathCtxt.node
 *             if c_node is NULL:
 *                 raise XPathError, u"no context node"             # <<<<<<<<<<<<<<
 *             if c_node.doc != self._xpathCtxt.doc:
 *                 raise XPathError, \
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, __pyx_kp_u_no_context_node, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":310
 *             if c_node is NULL:
 *                 raise XPathError, u"no context node"
 *             if c_node.doc != self._xpathCtxt.doc:             # <<<<<<<<<<<<<<
 *                 raise XPathError, \
 *                     u"document-external context nodes are not supported"
 */
  __pyx_t_1 = ((__pyx_v_c_node->doc != __pyx_v_self->_xpathCtxt->doc) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":311
 *                 raise XPathError, u"no context node"
 *             if c_node.doc != self._xpathCtxt.doc:
 *                 raise XPathError, \             # <<<<<<<<<<<<<<
 *                     u"document-external context nodes are not supported"
 *             if self._doc is None:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, __pyx_kp_u_document_external_context_nodes, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":313
 *                 raise XPathError, \
 *                     u"document-external context nodes are not supported"
 *             if self._doc is None:             # <<<<<<<<<<<<<<
 *                 raise XPathError, u"document context is missing"
 *             return _elementFactory(self._doc, c_node)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_doc) == Py_None);
  __pyx_t_4 = (__pyx_t_1 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":314
 *                     u"document-external context nodes are not supported"
 *             if self._doc is None:
 *                 raise XPathError, u"document context is missing"             # <<<<<<<<<<<<<<
 *             return _elementFactory(self._doc, c_node)
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, __pyx_kp_u_document_context_is_missing, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":315
 *             if self._doc is None:
 *                 raise XPathError, u"document context is missing"
 *             return _elementFactory(self._doc, c_node)             # <<<<<<<<<<<<<<
 * 
 *     property eval_context:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_2), __pyx_v_c_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":302
 * 
 *     property context_node:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef xmlNode* c_node
 *             if self._xpathCtxt is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._BaseContext.context_node.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":318
 * 
 *     property eval_context:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12eval_context_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_BaseContext_12eval_context_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_12_BaseContext_12eval_context___get__(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":319
 *     property eval_context:
 *         def __get__(self):
 *             if self._eval_context_dict is None:             # <<<<<<<<<<<<<<
 *                 self._eval_context_dict = {}
 *             return self._eval_context_dict
 */
  __pyx_t_1 = (__pyx_v_self->_eval_context_dict == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":320
 *         def __get__(self):
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}             # <<<<<<<<<<<<<<
 *             return self._eval_context_dict
 * 
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_eval_context_dict);
    __Pyx_DECREF(__pyx_v_self->_eval_context_dict);
    __pyx_v_self->_eval_context_dict = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":321
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}
 *             return self._eval_context_dict             # <<<<<<<<<<<<<<
 * 
 *     # Python reference keeping during XPath function evaluation
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_eval_context_dict);
  __pyx_r = __pyx_v_self->_eval_context_dict;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":318
 * 
 *     property eval_context:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._eval_context_dict is None:
 *                 self._eval_context_dict = {}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext.eval_context.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":326
 * 
 *     @cython.final
 *     cdef _release_temp_refs(self):             # <<<<<<<<<<<<<<
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_release_temp_refs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":328
 *     cdef _release_temp_refs(self):
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()             # <<<<<<<<<<<<<<
 *         self._temp_documents.clear()
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_10_TempStore_clear(__pyx_v_self->_temp_refs); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":329
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()
 *         self._temp_documents.clear()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PySet_Clear(__pyx_v_self->_temp_documents); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":326
 * 
 *     @cython.final
 *     cdef _release_temp_refs(self):             # <<<<<<<<<<<<<<
 *         u"Free temporarily referenced objects from this context."
 *         self._temp_refs.clear()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._BaseContext._release_temp_refs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":332
 * 
 *     @cython.final
 *     cdef _hold(self, obj):             # <<<<<<<<<<<<<<
 *         u"""A way to temporarily hold references to nodes in the evaluator.
 * 
 */

static PyObject *__pyx_f_4lxml_5etree_12_BaseContext__hold(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_v_o = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_hold", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":340
 *         """
 *         cdef _Element element
 *         if isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":341
 *         cdef _Element element
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)             # <<<<<<<<<<<<<<
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_self->_temp_refs, __pyx_v_obj); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":342
 *         if isinstance(obj, _Element):
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)             # <<<<<<<<<<<<<<
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 */
    if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = ((PyObject *)((struct LxmlElement *)__pyx_v_obj)->_doc);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":343
 *             self._temp_refs.add(obj)
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return             # <<<<<<<<<<<<<<
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":344
 *             self._temp_documents.add((<_Element>obj)._doc)
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *             return
 *         for o in obj:
 */
  __pyx_t_2 = (_isString(__pyx_v_obj) != 0);
  if (!__pyx_t_2) {
    __pyx_t_1 = ((!(PySequence_Check(__pyx_v_obj) != 0)) != 0);
    __pyx_t_6 = __pyx_t_1;
  } else {
    __pyx_t_6 = __pyx_t_2;
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":345
 *             return
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return             # <<<<<<<<<<<<<<
 *         for o in obj:
 *             if isinstance(o, _Element):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":346
 *         elif _isString(obj) or not python.PySequence_Check(obj):
 *             return
 *         for o in obj:             # <<<<<<<<<<<<<<
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
 */
  if (PyList_CheckExact(__pyx_v_obj) || PyTuple_CheckExact(__pyx_v_obj)) {
    __pyx_t_4 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_9 = __pyx_t_8(__pyx_t_4);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":347
 *             return
 *         for o in obj:
 *             if isinstance(o, _Element):             # <<<<<<<<<<<<<<
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)
 */
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    __pyx_t_2 = (__pyx_t_6 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":349
 *             if isinstance(o, _Element):
 *                 #print "Holding element:", <int>element._c_node
 *                 self._temp_refs.add(o)             # <<<<<<<<<<<<<<
 *                 #print "Holding document:", <int>element._doc._c_doc
 *                 self._temp_documents.add((<_Element>o)._doc)
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree_10_TempStore_add(__pyx_v_self->_temp_refs, __pyx_v_o); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":351
 *                 self._temp_refs.add(o)
 *                 #print "Holding document:", <int>element._doc._c_doc
 *                 self._temp_documents.add((<_Element>o)._doc)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
      if (unlikely(__pyx_v_self->_temp_documents == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = ((PyObject *)((struct LxmlElement *)__pyx_v_o)->_doc);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_5 = PySet_Add(__pyx_v_self->_temp_documents, __pyx_t_9); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":332
 * 
 *     @cython.final
 *     cdef _hold(self, obj):             # <<<<<<<<<<<<<<
 *         u"""A way to temporarily hold references to nodes in the evaluator.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._BaseContext._hold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":354
 * 
 *     @cython.final
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         u"""If an XPath expression returns an element from a different
 *         document than the current context document, we call this to
 */

static struct LxmlDocument *__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_self, xmlNode *__pyx_v_c_node) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findDocumentForNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":361
 *         """
 *         cdef _Document doc
 *         for doc in self._temp_documents:             # <<<<<<<<<<<<<<
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
 */
  __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_temp_documents); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = Py_TYPE(__pyx_t_1)->tp_iternext;
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":362
 *         cdef _Document doc
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:             # <<<<<<<<<<<<<<
 *                 return doc
 *         return None
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_doc) != Py_None);
    if ((__pyx_t_4 != 0)) {
      __pyx_t_5 = ((__pyx_v_doc->_c_doc == __pyx_v_c_node->doc) != 0);
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = (__pyx_t_4 != 0);
    }
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":363
 *         for doc in self._temp_documents:
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_doc));
      __pyx_r = __pyx_v_doc;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":364
 *             if doc is not None and doc._c_doc is c_node.doc:
 *                 return doc
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(Py_None);
  __pyx_r = ((struct LxmlDocument *)Py_None);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":354
 * 
 *     @cython.final
 *     cdef _Document _findDocumentForNode(self, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *         u"""If an XPath expression returns an element from a different
 *         document than the current context document, we call this to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._BaseContext._findDocumentForNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":397
 * )
 * 
 * cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
 */

static void __pyx_f_4lxml_5etree__forwardXPathError(void *__pyx_v_c_ctxt, xmlError *__pyx_v_c_error) {
  xmlError __pyx_v_error;
  int __pyx_v_xpath_code;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  xmlErrorLevel __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_forwardXPathError", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":400
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
 *     if c_error.message is not NULL:             # <<<<<<<<<<<<<<
 *         error.message = c_error.message
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_error->message != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":401
 *     cdef int xpath_code
 *     if c_error.message is not NULL:
 *         error.message = c_error.message             # <<<<<<<<<<<<<<
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
 */
    __pyx_t_2 = __pyx_v_c_error->message;
    __pyx_v_error.message = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":403
 *         error.message = c_error.message
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK             # <<<<<<<<<<<<<<
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
 */
    __pyx_v_xpath_code = (__pyx_v_c_error->code - XML_XPATH_EXPRESSION_OK);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":404
 *     else:
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):             # <<<<<<<<<<<<<<
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
 *         else:
 */
    __pyx_t_1 = (0 <= __pyx_v_xpath_code);
    if (__pyx_t_1) {
      __pyx_t_3 = __pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES;
      __Pyx_INCREF(__pyx_t_3);
      if (unlikely(__pyx_t_3 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyTuple_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = (__pyx_v_xpath_code < __pyx_t_4);
    }
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":405
 *         xpath_code = c_error.code - xmlerror.XML_XPATH_EXPRESSION_OK
 *         if 0 <= xpath_code < len(LIBXML2_XPATH_ERROR_MESSAGES):
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])             # <<<<<<<<<<<<<<
 *         else:
 *             error.message = b"unknown error"
 */
      if (unlikely(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES, __pyx_v_xpath_code, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_error.message = PyBytes_AS_STRING(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":407
 *             error.message = _cstr(LIBXML2_XPATH_ERROR_MESSAGES[xpath_code])
 *         else:
 *             error.message = b"unknown error"             # <<<<<<<<<<<<<<
 *     error.domain = c_error.domain
 *     error.code = c_error.code
 */
      __pyx_v_error.message = __pyx_k_unknown_error;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":408
 *         else:
 *             error.message = b"unknown error"
 *     error.domain = c_error.domain             # <<<<<<<<<<<<<<
 *     error.code = c_error.code
 *     error.level = c_error.level
 */
  __pyx_t_6 = __pyx_v_c_error->domain;
  __pyx_v_error.domain = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":409
 *             error.message = b"unknown error"
 *     error.domain = c_error.domain
 *     error.code = c_error.code             # <<<<<<<<<<<<<<
 *     error.level = c_error.level
 *     error.line = c_error.line
 */
  __pyx_t_6 = __pyx_v_c_error->code;
  __pyx_v_error.code = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":410
 *     error.domain = c_error.domain
 *     error.code = c_error.code
 *     error.level = c_error.level             # <<<<<<<<<<<<<<
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column
 */
  __pyx_t_7 = __pyx_v_c_error->level;
  __pyx_v_error.level = __pyx_t_7;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":411
 *     error.code = c_error.code
 *     error.level = c_error.level
 *     error.line = c_error.line             # <<<<<<<<<<<<<<
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file
 */
  __pyx_t_6 = __pyx_v_c_error->line;
  __pyx_v_error.line = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":412
 *     error.level = c_error.level
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column             # <<<<<<<<<<<<<<
 *     error.file = c_error.file
 * 
 */
  __pyx_t_6 = __pyx_v_c_error->int1;
  __pyx_v_error.int2 = __pyx_t_6;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":413
 *     error.line = c_error.line
 *     error.int2 = c_error.int1 # column
 *     error.file = c_error.file             # <<<<<<<<<<<<<<
 * 
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 */
  __pyx_t_2 = __pyx_v_c_error->file;
  __pyx_v_error.file = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":415
 *     error.file = c_error.file
 * 
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)             # <<<<<<<<<<<<<<
 * 
 * cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil:
 */
  __pyx_f_4lxml_5etree_13_BaseErrorLog__receive(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_c_ctxt)->_error_log), (&__pyx_v_error));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":397
 * )
 * 
 * cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil:             # <<<<<<<<<<<<<<
 *     cdef xmlerror.xmlError error
 *     cdef int xpath_code
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("lxml.etree._forwardXPathError", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":417
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 * 
 * cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     if not __DEBUG:
 *         return
 */

static void __pyx_f_4lxml_5etree__receiveXPathError(void *__pyx_v_c_context, xmlError *__pyx_v_error) {
  int __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":420
 *     if not __DEBUG:
 *         return
 *     if c_context is NULL:             # <<<<<<<<<<<<<<
 *         _forwardError(NULL, error)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_c_context == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":421
 *         return
 *     if c_context is NULL:
 *         _forwardError(NULL, error)             # <<<<<<<<<<<<<<
 *     else:
 *         _forwardXPathError(c_context, error)
 */
    __pyx_f_4lxml_5etree__forwardError(NULL, __pyx_v_error);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":423
 *         _forwardError(NULL, error)
 *     else:
 *         _forwardXPathError(c_context, error)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_f_4lxml_5etree__forwardXPathError(__pyx_v_c_context, __pyx_v_error);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":417
 *     (<_BaseContext>c_ctxt)._error_log._receive(&error)
 * 
 * cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil:             # <<<<<<<<<<<<<<
 *     if not __DEBUG:
 *         return
 */

  /* function exit code */
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":426
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     u"""Extension(module, function_mapping=None, ns=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_61Extension(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_60Extension[] = "Extension(module, function_mapping=None, ns=None)\n\n    Build a dictionary of extension functions from the functions\n    defined in a module or the methods of an object.\n\n    As second argument, you can pass an additional mapping of\n    attribute names to XPath function names, or a list of function\n    names that should be taken.\n\n    The ``ns`` keyword argument accepts a namespace URI for the XPath\n    functions.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_61Extension = {__Pyx_NAMESTR("Extension"), (PyCFunction)__pyx_pw_4lxml_5etree_61Extension, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_60Extension)};
static PyObject *__pyx_pw_4lxml_5etree_61Extension(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_module = 0;
  PyObject *__pyx_v_function_mapping = 0;
  PyObject *__pyx_v_ns = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Extension (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_module,&__pyx_n_s_function_mapping,&__pyx_n_s_ns,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_module)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function_mapping);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Extension") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_module = values[0];
    __pyx_v_function_mapping = values[1];
    __pyx_v_ns = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Extension", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Extension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_60Extension(__pyx_self, __pyx_v_module, __pyx_v_function_mapping, __pyx_v_ns);

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

static PyObject *__pyx_pf_4lxml_5etree_60Extension(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_function_mapping, PyObject *__pyx_v_ns) {
  PyObject *__pyx_v_functions = 0;
  PyObject *__pyx_v_function_name = NULL;
  PyObject *__pyx_v_xpath_name = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Extension", 0);
  __Pyx_INCREF(__pyx_v_function_mapping);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":439
 *     functions.
 *     """
 *     cdef dict functions = {}             # <<<<<<<<<<<<<<
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_functions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":440
 *     """
 *     cdef dict functions = {}
 *     if isinstance(function_mapping, dict):             # <<<<<<<<<<<<<<
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 */
  __pyx_t_2 = PyDict_Check(__pyx_v_function_mapping); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":441
 *     cdef dict functions = {}
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():             # <<<<<<<<<<<<<<
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_function_mapping, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_4 = __pyx_t_6(__pyx_t_1);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_function_name, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xpath_name, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":442
 *     if isinstance(function_mapping, dict):
 *         for function_name, xpath_name in function_mapping.items():
 *             functions[(ns, xpath_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     else:
 *         if function_mapping is None:
 */
      __pyx_t_4 = __Pyx_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __Pyx_INCREF(__pyx_v_xpath_name);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_xpath_name);
      __Pyx_GIVEREF(__pyx_v_xpath_name);
      if (unlikely(PyDict_SetItem(__pyx_v_functions, __pyx_t_8, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":444
 *             functions[(ns, xpath_name)] = getattr(module, function_name)
 *     else:
 *         if function_mapping is None:             # <<<<<<<<<<<<<<
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]
 */
    __pyx_t_3 = (__pyx_v_function_mapping == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":445
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_Dir(__pyx_v_module); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_8 = __pyx_t_4; __Pyx_INCREF(__pyx_t_8); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = Py_TYPE(__pyx_t_8)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_8)) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_8)) {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_4 = __pyx_t_6(__pyx_t_8);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":446
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_3 = ((!__pyx_t_2) != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":445
 *     else:
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)             # <<<<<<<<<<<<<<
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:
 */
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_name))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_function_mapping, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":447
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:             # <<<<<<<<<<<<<<
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions
 */
    if (PyList_CheckExact(__pyx_v_function_mapping) || PyTuple_CheckExact(__pyx_v_function_mapping)) {
      __pyx_t_1 = __pyx_v_function_mapping; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_function_mapping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    for (;;) {
      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_8 = __pyx_t_6(__pyx_t_1);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_function_name, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":448
 *                                  if not name.startswith(u'_') ]
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)             # <<<<<<<<<<<<<<
 *     return functions
 * 
 */
      __pyx_t_8 = __Pyx_GetAttr(__pyx_v_module, __pyx_v_function_name); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_ns);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ns);
      __Pyx_GIVEREF(__pyx_v_ns);
      __Pyx_INCREF(__pyx_v_function_name);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_function_name);
      __Pyx_GIVEREF(__pyx_v_function_name);
      if (unlikely(PyDict_SetItem(__pyx_v_functions, __pyx_t_7, __pyx_t_8) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":449
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 *     return functions             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_functions);
  __pyx_r = __pyx_v_functions;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":426
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     u"""Extension(module, function_mapping=None, ns=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.Extension", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_function_name);
  __Pyx_XDECREF(__pyx_v_xpath_name);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_function_mapping);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":458
 * cdef class _ExsltRegExp:
 *     cdef dict _compile_map
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._compile_map = {}
 * 
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":459
 *     cdef dict _compile_map
 *     def __cinit__(self):
 *         self._compile_map = {}             # <<<<<<<<<<<<<<
 * 
 *     cdef _make_string(self, value):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_compile_map);
  __Pyx_DECREF(__pyx_v_self->_compile_map);
  __pyx_v_self->_compile_map = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":458
 * cdef class _ExsltRegExp:
 *     cdef dict _compile_map
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._compile_map = {}
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":461
 *         self._compile_map = {}
 * 
 *     cdef _make_string(self, value):             # <<<<<<<<<<<<<<
 *         if _isString(value):
 *             return value
 */

static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_firstnode = NULL;
  xmlChar *__pyx_v_c_text;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_string", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":462
 * 
 *     cdef _make_string(self, value):
 *         if _isString(value):             # <<<<<<<<<<<<<<
 *             return value
 *         elif isinstance(value, list):
 */
  __pyx_t_1 = (_isString(__pyx_v_value) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":463
 *     cdef _make_string(self, value):
 *         if _isString(value):
 *             return value             # <<<<<<<<<<<<<<
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":464
 *         if _isString(value):
 *             return value
 *         elif isinstance(value, list):             # <<<<<<<<<<<<<<
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
 */
  __pyx_t_1 = PyList_Check(__pyx_v_value); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":466
 *         elif isinstance(value, list):
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:             # <<<<<<<<<<<<<<
 *                 return u''
 *             firstnode = value[0]
 */
    __pyx_t_2 = ((PyList_GET_SIZE(__pyx_v_value) == 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":467
 *             # node set: take recursive text concatenation of first element
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return u''             # <<<<<<<<<<<<<<
 *             firstnode = value[0]
 *             if _isString(firstnode):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u__15);
      __pyx_r = __pyx_kp_u__15;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":468
 *             if python.PyList_GET_SIZE(value) == 0:
 *                 return u''
 *             firstnode = value[0]             # <<<<<<<<<<<<<<
 *             if _isString(firstnode):
 *                 return firstnode
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_firstnode = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":469
 *                 return u''
 *             firstnode = value[0]
 *             if _isString(firstnode):             # <<<<<<<<<<<<<<
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 */
    __pyx_t_2 = (_isString(__pyx_v_firstnode) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":470
 *             firstnode = value[0]
 *             if _isString(firstnode):
 *                 return firstnode             # <<<<<<<<<<<<<<
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_firstnode);
      __pyx_r = __pyx_v_firstnode;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":471
 *             if _isString(firstnode):
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):             # <<<<<<<<<<<<<<
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 */
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_firstnode, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":472
 *                 return firstnode
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)             # <<<<<<<<<<<<<<
 *                 if c_text is NULL:
 *                     raise MemoryError()
 */
      __pyx_v_c_text = xmlNodeGetContent(((struct LxmlElement *)__pyx_v_firstnode)->_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":473
 *             elif isinstance(firstnode, _Element):
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError()
 *                 try:
 */
      __pyx_t_1 = ((__pyx_v_c_text == NULL) != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":474
 *                 c_text = tree.xmlNodeGetContent((<_Element>firstnode)._c_node)
 *                 if c_text is NULL:
 *                     raise MemoryError()             # <<<<<<<<<<<<<<
 *                 try:
 *                     return funicode(c_text)
 */
        PyErr_NoMemory(); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":475
 *                 if c_text is NULL:
 *                     raise MemoryError()
 *                 try:             # <<<<<<<<<<<<<<
 *                     return funicode(c_text)
 *                 finally:
 */
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":476
 *                     raise MemoryError()
 *                 try:
 *                     return funicode(c_text)             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(c_text)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L7_return;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":478
 *                     return funicode(c_text)
 *                 finally:
 *                     tree.xmlFree(c_text)             # <<<<<<<<<<<<<<
 *             else:
 *                 return unicode(firstnode)
 */
      /*finally:*/ {
        /*exception exit:*/{
          __pyx_L8_error:;
          __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
          {
            xmlFree(__pyx_v_c_text);
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          }
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
          __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
          goto __pyx_L1_error;
        }
        __pyx_L7_return: {
          __pyx_t_12 = __pyx_r;
          __pyx_r = 0;
          xmlFree(__pyx_v_c_text);
          __pyx_r = __pyx_t_12;
          __pyx_t_12 = 0;
          goto __pyx_L0;
        }
      }
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":480
 *                     tree.xmlFree(c_text)
 *             else:
 *                 return unicode(firstnode)             # <<<<<<<<<<<<<<
 *         else:
 *             return unicode(value)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_firstnode);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_firstnode);
      __Pyx_GIVEREF(__pyx_v_firstnode);
      __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_13;
      __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":482
 *                 return unicode(firstnode)
 *         else:
 *             return unicode(value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _compile(self, rexp, ignore_case):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":461
 *         self._compile_map = {}
 * 
 *     cdef _make_string(self, value):             # <<<<<<<<<<<<<<
 *         if _isString(value):
 *             return value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._make_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_firstnode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":484
 *             return unicode(value)
 * 
 *     cdef _compile(self, rexp, ignore_case):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
 */

static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__compile(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, PyObject *__pyx_v_rexp, PyObject *__pyx_v_ignore_case) {
  PyObject *__pyx_v_c_result;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_py_flags = NULL;
  PyObject *__pyx_v_rexp_compiled = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_compile", 0);
  __Pyx_INCREF(__pyx_v_rexp);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":486
 *     cdef _compile(self, rexp, ignore_case):
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)             # <<<<<<<<<<<<<<
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_rexp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rexp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":487
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
 *         key = (rexp, ignore_case)             # <<<<<<<<<<<<<<
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_rexp);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rexp);
  __Pyx_GIVEREF(__pyx_v_rexp);
  __Pyx_INCREF(__pyx_v_ignore_case);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ignore_case);
  __Pyx_GIVEREF(__pyx_v_ignore_case);
  __pyx_v_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":488
 *         rexp = self._make_string(rexp)
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)             # <<<<<<<<<<<<<<
 *         if c_result is not NULL:
 *             return <object>c_result
 */
  __pyx_t_1 = __pyx_v_self->_compile_map;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_c_result = PyDict_GetItem(__pyx_t_1, __pyx_v_key);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":489
 *         key = (rexp, ignore_case)
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:             # <<<<<<<<<<<<<<
 *             return <object>c_result
 *         py_flags = re.UNICODE
 */
  __pyx_t_2 = ((__pyx_v_c_result != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":490
 *         c_result = python.PyDict_GetItem(self._compile_map, key)
 *         if c_result is not NULL:
 *             return <object>c_result             # <<<<<<<<<<<<<<
 *         py_flags = re.UNICODE
 *         if ignore_case:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_c_result));
    __pyx_r = ((PyObject *)__pyx_v_c_result);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":491
 *         if c_result is not NULL:
 *             return <object>c_result
 *         py_flags = re.UNICODE             # <<<<<<<<<<<<<<
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_UNICODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_flags = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":492
 *             return <object>c_result
 *         py_flags = re.UNICODE
 *         if ignore_case:             # <<<<<<<<<<<<<<
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_case); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":493
 *         py_flags = re.UNICODE
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE             # <<<<<<<<<<<<<<
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_IGNORECASE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Or(__pyx_v_py_flags, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_py_flags, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":494
 *         if ignore_case:
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)             # <<<<<<<<<<<<<<
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __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[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_rexp);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rexp);
  __Pyx_GIVEREF(__pyx_v_rexp);
  __Pyx_INCREF(__pyx_v_py_flags);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_py_flags);
  __Pyx_GIVEREF(__pyx_v_py_flags);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexp_compiled = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":495
 *             py_flags = py_flags | re.IGNORECASE
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled             # <<<<<<<<<<<<<<
 *         return rexp_compiled
 * 
 */
  if (unlikely(__pyx_v_self->_compile_map == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (unlikely(PyDict_SetItem(__pyx_v_self->_compile_map, __pyx_v_key, __pyx_v_rexp_compiled) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":496
 *         rexp_compiled = re.compile(rexp, py_flags)
 *         self._compile_map[key] = rexp_compiled
 *         return rexp_compiled             # <<<<<<<<<<<<<<
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rexp_compiled);
  __pyx_r = __pyx_v_rexp_compiled;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":484
 *             return unicode(value)
 * 
 *     cdef _compile(self, rexp, ignore_case):             # <<<<<<<<<<<<<<
 *         cdef python.PyObject* c_result
 *         rexp = self._make_string(rexp)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._compile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_py_flags);
  __Pyx_XDECREF(__pyx_v_rexp_compiled);
  __Pyx_XDECREF(__pyx_v_rexp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":498
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("test (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctxt,&__pyx_n_s_s_4,&__pyx_n_s_rexp,&__pyx_n_s_flags,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_kp_u__15);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ctxt)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s_4)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "test") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("test", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp_2test(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_ctxt, __pyx_v_s, __pyx_v_rexp, __pyx_v_flags);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_2test(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags) {
  PyObject *__pyx_v_rexpc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":499
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":500
 *     def test(self, ctxt, s, rexp, flags=u''):
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if rexpc.search(s) is None:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":501
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)             # <<<<<<<<<<<<<<
 *         if rexpc.search(s) is None:
 *             return False
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree_12_ExsltRegExp__compile(__pyx_v_self, __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":502
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if rexpc.search(s) is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_search); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = (__pyx_t_2 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":503
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if rexpc.search(s) is None:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":505
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def match(self, ctxt, s, rexp, flags=u''):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":498
 *         return rexp_compiled
 * 
 *     def test(self, ctxt, s, rexp, flags=u''):             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rexpc);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":507
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=u''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("match (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctxt,&__pyx_n_s_s_4,&__pyx_n_s_rexp,&__pyx_n_s_flags,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_kp_u__15);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ctxt)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s_4)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "match") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("match", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp_4match(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_ctxt, __pyx_v_s, __pyx_v_rexp, __pyx_v_flags);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_4match(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags) {
  PyObject *__pyx_v_result_list = 0;
  PyObject *__pyx_v_rexpc = NULL;
  PyObject *__pyx_v_results = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_v_join_groups = NULL;
  PyObject *__pyx_v_s_match = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("match", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":509
 *     def match(self, ctxt, s, rexp, flags=u''):
 *         cdef list result_list
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":510
 *         cdef list result_list
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":511
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)             # <<<<<<<<<<<<<<
 *         if u'g' in flags:
 *             results = rexpc.findall(s)
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree_12_ExsltRegExp__compile(__pyx_v_self, __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":512
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:             # <<<<<<<<<<<<<<
 *             results = rexpc.findall(s)
 *             if not results:
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_n_u_g, __pyx_v_flags, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":513
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 *             results = rexpc.findall(s)             # <<<<<<<<<<<<<<
 *             if not results:
 *                 return ()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_findall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_results = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":514
 *         if u'g' in flags:
 *             results = rexpc.findall(s)
 *             if not results:             # <<<<<<<<<<<<<<
 *                 return ()
 *         else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_results); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = ((!__pyx_t_4) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":515
 *             results = rexpc.findall(s)
 *             if not results:
 *                 return ()             # <<<<<<<<<<<<<<
 *         else:
 *             result = rexpc.search(s)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_r = __pyx_empty_tuple;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":517
 *                 return ()
 *         else:
 *             result = rexpc.search(s)             # <<<<<<<<<<<<<<
 *             if not result:
 *                 return ()
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_search); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":518
 *         else:
 *             result = rexpc.search(s)
 *             if not result:             # <<<<<<<<<<<<<<
 *                 return ()
 *             results = [ result.group() ]
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((!__pyx_t_2) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":519
 *             result = rexpc.search(s)
 *             if not result:
 *                 return ()             # <<<<<<<<<<<<<<
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_r = __pyx_empty_tuple;
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":520
 *             if not result:
 *                 return ()
 *             results = [ result.group() ]             # <<<<<<<<<<<<<<
 *             results.extend( result.groups(u'') )
 *         result_list = []
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_group); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_v_results = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":521
 *                 return ()
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )             # <<<<<<<<<<<<<<
 *         result_list = []
 *         root = Element(u'matches')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_results, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":522
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )
 *         result_list = []             # <<<<<<<<<<<<<<
 *         root = Element(u'matches')
 *         join_groups = u''.join
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_result_list = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":523
 *             results.extend( result.groups(u'') )
 *         result_list = []
 *         root = Element(u'matches')             # <<<<<<<<<<<<<<
 *         join_groups = u''.join
 *         for s_match in results:
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Element); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_root = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":524
 *         result_list = []
 *         root = Element(u'matches')
 *         join_groups = u''.join             # <<<<<<<<<<<<<<
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u__15, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_join_groups = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":525
 *         root = Element(u'matches')
 *         join_groups = u''.join
 *         for s_match in results:             # <<<<<<<<<<<<<<
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = join_groups(s_match)
 */
  if (PyList_CheckExact(__pyx_v_results) || PyTuple_CheckExact(__pyx_v_results)) {
    __pyx_t_1 = __pyx_v_results; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_results); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_s_match, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":526
 *         join_groups = u''.join
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):             # <<<<<<<<<<<<<<
 *                 s_match = join_groups(s_match)
 *             elem = SubElement(root, u'match')
 */
    __pyx_t_4 = (PyTuple_CheckExact(__pyx_v_s_match) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":527
 *         for s_match in results:
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = join_groups(s_match)             # <<<<<<<<<<<<<<
 *             elem = SubElement(root, u'match')
 *             elem.text = s_match
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_s_match);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_s_match);
      __Pyx_GIVEREF(__pyx_v_s_match);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_join_groups, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_s_match, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":528
 *             if python.PyTuple_CheckExact(s_match):
 *                 s_match = join_groups(s_match)
 *             elem = SubElement(root, u'match')             # <<<<<<<<<<<<<<
 *             elem.text = s_match
 *             result_list.append(elem)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SubElement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_root);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_root);
    __Pyx_GIVEREF(__pyx_v_root);
    __Pyx_INCREF(__pyx_n_u_match);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_u_match);
    __Pyx_GIVEREF(__pyx_n_u_match);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":529
 *                 s_match = join_groups(s_match)
 *             elem = SubElement(root, u'match')
 *             elem.text = s_match             # <<<<<<<<<<<<<<
 *             result_list.append(elem)
 *         return result_list
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_elem, __pyx_n_s_text, __pyx_v_s_match) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":530
 *             elem = SubElement(root, u'match')
 *             elem.text = s_match
 *             result_list.append(elem)             # <<<<<<<<<<<<<<
 *         return result_list
 * 
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_v_elem); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":531
 *             elem.text = s_match
 *             result_list.append(elem)
 *         return result_list             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result_list);
  __pyx_r = __pyx_v_result_list;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":507
 *             return True
 * 
 *     def match(self, ctxt, s, rexp, flags=u''):             # <<<<<<<<<<<<<<
 *         cdef list result_list
 *         flags = self._make_string(flags)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.match", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result_list);
  __Pyx_XDECREF(__pyx_v_rexpc);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XDECREF(__pyx_v_join_groups);
  __Pyx_XDECREF(__pyx_v_s_match);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":533
 *         return result_list
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):             # <<<<<<<<<<<<<<
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_ctxt = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_rexp = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_replacement = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctxt,&__pyx_n_s_s_4,&__pyx_n_s_rexp,&__pyx_n_s_flags,&__pyx_n_s_replacement,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ctxt)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s_4)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_replacement)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_ctxt = values[0];
    __pyx_v_s = values[1];
    __pyx_v_rexp = values[2];
    __pyx_v_flags = values[3];
    __pyx_v_replacement = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_ExsltRegExp_6replace(((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)__pyx_v_self), __pyx_v_ctxt, __pyx_v_s, __pyx_v_rexp, __pyx_v_flags, __pyx_v_replacement);

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

static PyObject *__pyx_pf_4lxml_5etree_12_ExsltRegExp_6replace(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ctxt, PyObject *__pyx_v_s, PyObject *__pyx_v_rexp, PyObject *__pyx_v_flags, PyObject *__pyx_v_replacement) {
  PyObject *__pyx_v_rexpc = NULL;
  long __pyx_v_count;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_flags);
  __Pyx_INCREF(__pyx_v_replacement);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":534
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 *         replacement = self._make_string(replacement)             # <<<<<<<<<<<<<<
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_replacement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_replacement, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":535
 *     def replace(self, ctxt, s, rexp, flags, replacement):
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)             # <<<<<<<<<<<<<<
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":536
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)             # <<<<<<<<<<<<<<
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_ExsltRegExp__make_string(__pyx_v_self, __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":537
 *         flags = self._make_string(flags)
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)             # <<<<<<<<<<<<<<
 *         if u'g' in flags:
 *             count = 0
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_n_u_i, __pyx_v_flags, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_4lxml_5etree_12_ExsltRegExp__compile(__pyx_v_self, __pyx_v_rexp, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rexpc = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":538
 *         s = self._make_string(s)
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:             # <<<<<<<<<<<<<<
 *             count = 0
 *         else:
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_n_u_g, __pyx_v_flags, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":539
 *         rexpc = self._compile(rexp, u'i' in flags)
 *         if u'g' in flags:
 *             count = 0             # <<<<<<<<<<<<<<
 *         else:
 *             count = 1
 */
    __pyx_v_count = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":541
 *             count = 0
 *         else:
 *             count = 1             # <<<<<<<<<<<<<<
 *         return rexpc.sub(replacement, s, count)
 * 
 */
    __pyx_v_count = 1;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":542
 *         else:
 *             count = 1
 *         return rexpc.sub(replacement, s, count)             # <<<<<<<<<<<<<<
 * 
 *     cdef _register_in_context(self, _BaseContext context):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rexpc, __pyx_n_s_sub); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_replacement);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_replacement);
  __Pyx_GIVEREF(__pyx_v_replacement);
  __Pyx_INCREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":533
 *         return result_list
 * 
 *     def replace(self, ctxt, s, rexp, flags, replacement):             # <<<<<<<<<<<<<<
 *         replacement = self._make_string(replacement)
 *         flags = self._make_string(flags)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rexpc);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_flags);
  __Pyx_XDECREF(__pyx_v_replacement);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":544
 *         return rexpc.sub(replacement, s, count)
 * 
 *     cdef _register_in_context(self, _BaseContext context):             # <<<<<<<<<<<<<<
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 */

static PyObject *__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context(struct __pyx_obj_4lxml_5etree__ExsltRegExp *__pyx_v_self, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  PyObject *__pyx_v_ns = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_register_in_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":545
 * 
 *     cdef _register_in_context(self, _BaseContext context):
 *         ns = b"http://exslt.org/regular-expressions"             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 */
  __Pyx_INCREF(__pyx_kp_b_http_exslt_org_regular_expressio);
  __pyx_v_ns = __pyx_kp_b_http_exslt_org_regular_expressio;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":546
 *     cdef _register_in_context(self, _BaseContext context):
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_test); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, __pyx_v_ns, __pyx_n_b_test, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":547
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)             # <<<<<<<<<<<<<<
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, __pyx_v_ns, __pyx_n_b_match, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":548
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 *         context._addLocalExtensionFunction(ns, b"match",   self.match)
 *         context._addLocalExtensionFunction(ns, b"replace", self.replace)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__BaseContext *)__pyx_v_context->__pyx_vtab)->_addLocalExtensionFunction(__pyx_v_context, __pyx_v_ns, __pyx_n_b_replace, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":544
 *         return rexpc.sub(replacement, s, count)
 * 
 *     cdef _register_in_context(self, _BaseContext context):             # <<<<<<<<<<<<<<
 *         ns = b"http://exslt.org/regular-expressions"
 *         context._addLocalExtensionFunction(ns, b"test",    self.test)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ExsltRegExp._register_in_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":554
 * # helper functions
 * 
 * cdef xpath.xmlXPathObject* _wrapXPathObject(object obj, _Document doc,             # <<<<<<<<<<<<<<
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
 */

static xmlXPathObject *__pyx_f_4lxml_5etree__wrapXPathObject(PyObject *__pyx_v_obj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  xmlNodeSet *__pyx_v_resultSet;
  struct LxmlElement *__pyx_v_fake_node = 0;
  xmlNode *__pyx_v_c_node;
  PyObject *__pyx_v_value = NULL;
  xmlXPathObject *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  const char *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_wrapXPathObject", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":557
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
 *     cdef _Element fake_node = None             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_node
 * 
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_fake_node = ((struct LxmlElement *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":560
 *     cdef xmlNode* c_node
 * 
 *     if isinstance(obj, unicode):             # <<<<<<<<<<<<<<
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_obj); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":561
 * 
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)             # <<<<<<<<<<<<<<
 *     if isinstance(obj, bytes):
 *         # libxml2 copies the string value
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":562
 *     if isinstance(obj, unicode):
 *         obj = _utf8(obj)
 *     if isinstance(obj, bytes):             # <<<<<<<<<<<<<<
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_obj); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":564
 *     if isinstance(obj, bytes):
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))             # <<<<<<<<<<<<<<
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
 */
    __pyx_r = xmlXPathNewCString(PyBytes_AS_STRING(__pyx_v_obj));
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":565
 *         # libxml2 copies the string value
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 */
  __pyx_t_3 = ((PyObject*)&PyBool_Type);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":566
 *         return xpath.xmlXPathNewCString(_cstr(obj))
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)             # <<<<<<<<<<<<<<
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 */
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_obj); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = xmlXPathNewBoolean(__pyx_t_4);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":567
 *     if isinstance(obj, bool):
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 */
  __pyx_t_2 = (PyNumber_Check(__pyx_v_obj) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":568
 *         return xpath.xmlXPathNewBoolean(obj)
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)             # <<<<<<<<<<<<<<
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 */
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_obj); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = xmlXPathNewFloat(__pyx_t_5);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":569
 *     if python.PyNumber_Check(obj):
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 */
  __pyx_t_2 = (__pyx_v_obj == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":570
 *         return xpath.xmlXPathNewFloat(obj)
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 */
    __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL);
    goto __pyx_L7;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":571
 *     if obj is None:
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":572
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)             # <<<<<<<<<<<<<<
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 */
    __pyx_v_resultSet = xmlXPathNodeSetCreate(((struct LxmlElement *)__pyx_v_obj)->_c_node);
    goto __pyx_L7;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":573
 *     elif isinstance(obj, _Element):
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):             # <<<<<<<<<<<<<<
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 */
  __pyx_t_2 = (PySequence_Check(__pyx_v_obj) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":574
 *         resultSet = xpath.xmlXPathNodeSetCreate((<_Element>obj)._c_node)
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)             # <<<<<<<<<<<<<<
 *         try:
 *             for value in obj:
 */
    __pyx_v_resultSet = xmlXPathNodeSetCreate(NULL);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":575
 *     elif python.PySequence_Check(obj):
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:             # <<<<<<<<<<<<<<
 *             for value in obj:
 *                 if isinstance(value, _Element):
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":576
 *         resultSet = xpath.xmlXPathNodeSetCreate(NULL)
 *         try:
 *             for value in obj:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 */
        if (PyList_CheckExact(__pyx_v_obj) || PyTuple_CheckExact(__pyx_v_obj)) {
          __pyx_t_3 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
          __pyx_t_10 = NULL;
        } else {
          __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext;
        }
        for (;;) {
          if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_3)) {
            if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_11 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            #else
            __pyx_t_11 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            #endif
          } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_3)) {
            if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            #else
            __pyx_t_11 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            #endif
          } else {
            __pyx_t_11 = __pyx_t_10(__pyx_t_3);
            if (unlikely(!__pyx_t_11)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_11);
          }
          __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":577
 *         try:
 *             for value in obj:
 *                 if isinstance(value, _Element):             # <<<<<<<<<<<<<<
 *                     if context is not None:
 *                         context._hold(value)
 */
          __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree__Element)); 
          __pyx_t_1 = (__pyx_t_2 != 0);
          if (__pyx_t_1) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":578
 *             for value in obj:
 *                 if isinstance(value, _Element):
 *                     if context is not None:             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 */
            __pyx_t_1 = (((PyObject *)__pyx_v_context) != Py_None);
            __pyx_t_2 = (__pyx_t_1 != 0);
            if (__pyx_t_2) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":579
 *                 if isinstance(value, _Element):
 *                     if context is not None:
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 */
              __pyx_t_11 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              goto __pyx_L19;
            }
            __pyx_L19:;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":580
 *                     if context is not None:
 *                         context._hold(value)
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)             # <<<<<<<<<<<<<<
 *                 else:
 *                     if context is None or doc is None:
 */
            xmlXPathNodeSetAdd(__pyx_v_resultSet, ((struct LxmlElement *)__pyx_v_value)->_c_node);
            goto __pyx_L18;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":582
 *                     xpath.xmlXPathNodeSetAdd(resultSet, (<_Element>value)._c_node)
 *                 else:
 *                     if context is None or doc is None:             # <<<<<<<<<<<<<<
 *                         raise XPathResultError, \
 *                               u"Non-Element values not supported at this point - got %r" % value
 */
            __pyx_t_2 = (((PyObject *)__pyx_v_context) == Py_None);
            if (!(__pyx_t_2 != 0)) {
              __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
              __pyx_t_12 = (__pyx_t_1 != 0);
            } else {
              __pyx_t_12 = (__pyx_t_2 != 0);
            }
            if (__pyx_t_12) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":583
 *                 else:
 *                     if context is None or doc is None:
 *                         raise XPathResultError, \             # <<<<<<<<<<<<<<
 *                               u"Non-Element values not supported at this point - got %r" % value
 *                     # support strings by appending text nodes to an Element
 */
              __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathResultError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_11);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":584
 *                     if context is None or doc is None:
 *                         raise XPathResultError, \
 *                               u"Non-Element values not supported at this point - got %r" % value             # <<<<<<<<<<<<<<
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):
 */
              __pyx_t_13 = PyUnicode_Format(__pyx_kp_u_Non_Element_values_not_supported, __pyx_v_value); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_Raise(__pyx_t_11, __pyx_t_13, 0, 0);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              {__pyx_filename = __pyx_f[8]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            }

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":586
 *                               u"Non-Element values not supported at this point - got %r" % value
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):             # <<<<<<<<<<<<<<
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
 */
            __pyx_t_12 = PyUnicode_Check(__pyx_v_value); 
            __pyx_t_2 = (__pyx_t_12 != 0);
            if (__pyx_t_2) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":587
 *                     # support strings by appending text nodes to an Element
 *                     if isinstance(value, unicode):
 *                         value = _utf8(value)             # <<<<<<<<<<<<<<
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:
 */
              __pyx_t_13 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_13);
              __pyx_t_13 = 0;
              goto __pyx_L21;
            }
            __pyx_L21:;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":588
 *                     if isinstance(value, unicode):
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):             # <<<<<<<<<<<<<<
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 */
            __pyx_t_2 = PyBytes_Check(__pyx_v_value); 
            __pyx_t_12 = (__pyx_t_2 != 0);
            if (__pyx_t_12) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":589
 *                         value = _utf8(value)
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:             # <<<<<<<<<<<<<<
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
 */
              __pyx_t_12 = (((PyObject *)__pyx_v_fake_node) == Py_None);
              __pyx_t_2 = (__pyx_t_12 != 0);
              if (__pyx_t_2) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":590
 *                     if isinstance(value, bytes):
 *                         if fake_node is None:
 *                             fake_node = _makeElement("text-root", NULL, doc, None,             # <<<<<<<<<<<<<<
 *                                                      None, None, None, None, None)
 *                             context._hold(fake_node)
 */
                __pyx_t_13 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_kp_s_text_root, NULL, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None, Py_None, Py_None, Py_None, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF_SET(__pyx_v_fake_node, ((struct LxmlElement *)__pyx_t_13));
                __pyx_t_13 = 0;

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":592
 *                             fake_node = _makeElement("text-root", NULL, doc, None,
 *                                                      None, None, None, None, None)
 *                             context._hold(fake_node)             # <<<<<<<<<<<<<<
 *                         else:
 *                             # append a comment node to keep the text nodes separate
 */
                __pyx_t_13 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, ((PyObject *)__pyx_v_fake_node)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                goto __pyx_L23;
              }
              /*else*/ {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":595
 *                         else:
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")             # <<<<<<<<<<<<<<
 *                             if c_node is NULL:
 *                                 raise MemoryError()
 */
                __pyx_v_c_node = xmlNewDocComment(__pyx_v_doc->_c_doc, ((unsigned char *)((unsigned char *)__pyx_k__15)));

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":596
 *                             # append a comment node to keep the text nodes separate
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")
 *                             if c_node is NULL:             # <<<<<<<<<<<<<<
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 */
                __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
                if (__pyx_t_2) {

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":597
 *                             c_node = tree.xmlNewDocComment(doc._c_doc, <unsigned char*>"")
 *                             if c_node is NULL:
 *                                 raise MemoryError()             # <<<<<<<<<<<<<<
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)
 */
                  PyErr_NoMemory(); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                }

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":598
 *                             if c_node is NULL:
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 */
                xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node);
              }
              __pyx_L23:;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":599
 *                                 raise MemoryError()
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)             # <<<<<<<<<<<<<<
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:
 */
              __pyx_t_13 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_value); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":600
 *                             tree.xmlAddChild(fake_node._c_node, c_node)
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))             # <<<<<<<<<<<<<<
 *                         if c_node is NULL:
 *                             raise MemoryError()
 */
              __pyx_v_c_node = xmlNewDocText(__pyx_v_doc->_c_doc, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_value));

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":601
 *                         context._hold(value)
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:             # <<<<<<<<<<<<<<
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 */
              __pyx_t_2 = ((__pyx_v_c_node == NULL) != 0);
              if (__pyx_t_2) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":602
 *                         c_node = tree.xmlNewDocText(doc._c_doc, _xcstr(value))
 *                         if c_node is NULL:
 *                             raise MemoryError()             # <<<<<<<<<<<<<<
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 */
                PyErr_NoMemory(); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              }

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":603
 *                         if c_node is NULL:
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)             # <<<<<<<<<<<<<<
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 */
              xmlAddChild(__pyx_v_fake_node->_c_node, __pyx_v_c_node);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":604
 *                             raise MemoryError()
 *                         tree.xmlAddChild(fake_node._c_node, c_node)
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)             # <<<<<<<<<<<<<<
 *                     else:
 *                         raise XPathResultError, \
 */
              xmlXPathNodeSetAdd(__pyx_v_resultSet, __pyx_v_c_node);
              goto __pyx_L22;
            }
            /*else*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":606
 *                         xpath.xmlXPathNodeSetAdd(resultSet, c_node)
 *                     else:
 *                         raise XPathResultError, \             # <<<<<<<<<<<<<<
 *                               u"This is not a supported node-set result: %r" % value
 *         except:
 */
              __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathResultError); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_13);

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":607
 *                     else:
 *                         raise XPathResultError, \
 *                               u"This is not a supported node-set result: %r" % value             # <<<<<<<<<<<<<<
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 */
              __pyx_t_11 = PyUnicode_Format(__pyx_kp_u_This_is_not_a_supported_node_set, __pyx_v_value); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_Raise(__pyx_t_13, __pyx_t_11, 0, 0);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              {__pyx_filename = __pyx_f[8]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            }
            __pyx_L22:;
          }
          __pyx_L18:;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L15_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":608
 *                         raise XPathResultError, \
 *                               u"This is not a supported node-set result: %r" % value
 *         except:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._wrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_11, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GOTREF(__pyx_t_13);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":609
 *                               u"This is not a supported node-set result: %r" % value
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)             # <<<<<<<<<<<<<<
 *             raise
 *     else:
 */
        xmlXPathFreeNodeSet(__pyx_v_resultSet);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":610
 *         except:
 *             xpath.xmlXPathFreeNodeSet(resultSet)
 *             raise             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \
 */
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ErrRestore(__pyx_t_3, __pyx_t_11, __pyx_t_13);
        __pyx_t_3 = 0; __pyx_t_11 = 0; __pyx_t_13 = 0; 
        {__pyx_filename = __pyx_f[8]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L9_exception_handled;
      }
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L15_try_end:;
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":612
 *             raise
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(obj).decode('utf8')
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 */
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathResultError); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":613
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \
 *             python._fqtypename(obj).decode('utf8')             # <<<<<<<<<<<<<<
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 */
    __pyx_t_14 = _fqtypename(__pyx_v_obj);
    __pyx_t_11 = __Pyx_decode_c_string(__pyx_t_14, 0, strlen(__pyx_t_14), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":612
 *             raise
 *     else:
 *         raise XPathResultError, u"Unknown return type: %s" % \             # <<<<<<<<<<<<<<
 *             python._fqtypename(obj).decode('utf8')
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 */
    __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Unknown_return_type_s, __pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_Raise(__pyx_t_13, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":614
 *         raise XPathResultError, u"Unknown return type: %s" % \
 *             python._fqtypename(obj).decode('utf8')
 *     return xpath.xmlXPathWrapNodeSet(resultSet)             # <<<<<<<<<<<<<<
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 */
  __pyx_r = xmlXPathWrapNodeSet(__pyx_v_resultSet);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":554
 * # helper functions
 * 
 * cdef xpath.xmlXPathObject* _wrapXPathObject(object obj, _Document doc,             # <<<<<<<<<<<<<<
 *                                             _BaseContext context) except NULL:
 *     cdef xpath.xmlNodeSet* resultSet
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree._wrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_fake_node);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":616
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,             # <<<<<<<<<<<<<<
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 */

static PyObject *__pyx_f_4lxml_5etree__unwrapXPathObject(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  PyObject *__pyx_v_stringval = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unwrapXPathObject", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":640
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 */
  switch (__pyx_v_xpathObj->type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":618
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:             # <<<<<<<<<<<<<<
 *         raise XPathResultError, u"Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 */
    case XPATH_UNDEFINED:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":619
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, u"Undefined xpath result"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathResultError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, __pyx_kp_u_Undefined_xpath_result, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":620
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 *         raise XPathResultError, u"Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 */
    case XPATH_NODESET:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":621
 *         raise XPathResultError, u"Undefined xpath result"
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_4lxml_5etree__createNodeSetResult(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":622
 *     elif xpathObj.type == xpath.XPATH_NODESET:
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:             # <<<<<<<<<<<<<<
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 */
    case XPATH_BOOLEAN:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":623
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_xpathObj->boolval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":624
 *     elif xpathObj.type == xpath.XPATH_BOOLEAN:
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:             # <<<<<<<<<<<<<<
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
 */
    case XPATH_NUMBER:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":625
 *         return xpathObj.boolval
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_xpathObj->floatval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":626
 *     elif xpathObj.type == xpath.XPATH_NUMBER:
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:             # <<<<<<<<<<<<<<
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
 */
    case XPATH_STRING:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":627
 *         return xpathObj.floatval
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)             # <<<<<<<<<<<<<<
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_xpathObj->stringval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_stringval = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":628
 *     elif xpathObj.type == xpath.XPATH_STRING:
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:             # <<<<<<<<<<<<<<
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, 0)
 */
    __pyx_t_2 = (__pyx_v_context->_build_smart_strings != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":629
 *         stringval = funicode(xpathObj.stringval)
 *         if context._build_smart_strings:
 *             stringval = _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *                 stringval, None, None, 0)
 *         return stringval
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_stringval, ((struct LxmlElement *)Py_None), Py_None, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_stringval, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":631
 *             stringval = _elementStringResultFactory(
 *                 stringval, None, None, 0)
 *         return stringval             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, u"XPATH_POINT"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_stringval);
    __pyx_r = __pyx_v_stringval;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":632
 *                 stringval, None, None, 0)
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 */
    case XPATH_POINT:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":633
 *         return stringval
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, u"XPATH_POINT"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, u"XPATH_RANGE"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_POINT, 0, 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":634
 *     elif xpathObj.type == xpath.XPATH_POINT:
 *         raise NotImplementedError, u"XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 */
    case XPATH_RANGE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":635
 *         raise NotImplementedError, u"XPATH_POINT"
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, u"XPATH_RANGE"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_RANGE, 0, 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":636
 *     elif xpathObj.type == xpath.XPATH_RANGE:
 *         raise NotImplementedError, u"XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 */
    case XPATH_LOCATIONSET:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":637
 *         raise NotImplementedError, u"XPATH_RANGE"
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_LOCATIONSET, 0, 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":638
 *     elif xpathObj.type == xpath.XPATH_LOCATIONSET:
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 */
    case XPATH_USERS:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":639
 *         raise NotImplementedError, u"XPATH_LOCATIONSET"
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"             # <<<<<<<<<<<<<<
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_n_u_XPATH_USERS, 0, 0);
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":640
 *     elif xpathObj.type == xpath.XPATH_USERS:
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:             # <<<<<<<<<<<<<<
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 */
    case XPATH_XSLT_TREE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":641
 *         raise NotImplementedError, u"XPATH_USERS"
 *     elif xpathObj.type == xpath.XPATH_XSLT_TREE:
 *         return _createNodeSetResult(xpathObj, doc, context)             # <<<<<<<<<<<<<<
 *     else:
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_4lxml_5etree__createNodeSetResult(__pyx_v_xpathObj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":643
 *         return _createNodeSetResult(xpathObj, doc, context)
 *     else:
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)             # <<<<<<<<<<<<<<
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathResultError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_xpathObj->type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_Unknown_xpath_result_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":616
 *     return xpath.xmlXPathWrapNodeSet(resultSet)
 * 
 * cdef object _unwrapXPathObject(xpath.xmlXPathObject* xpathObj,             # <<<<<<<<<<<<<<
 *                                _Document doc, _BaseContext context):
 *     if xpathObj.type == xpath.XPATH_UNDEFINED:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._unwrapXPathObject", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_stringval);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":645
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,             # <<<<<<<<<<<<<<
 *                                  _BaseContext context):
 *     cdef xmlNode* c_node
 */

static PyObject *__pyx_f_4lxml_5etree__createNodeSetResult(xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  xmlNode *__pyx_v_c_node;
  int __pyx_v_i;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_createNodeSetResult", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":650
 *     cdef int i
 *     cdef list result
 *     result = []             # <<<<<<<<<<<<<<
 *     if xpathObj.nodesetval is NULL:
 *         return result
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":651
 *     cdef list result
 *     result = []
 *     if xpathObj.nodesetval is NULL:             # <<<<<<<<<<<<<<
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
 */
  __pyx_t_2 = ((__pyx_v_xpathObj->nodesetval == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":652
 *     result = []
 *     if xpathObj.nodesetval is NULL:
 *         return result             # <<<<<<<<<<<<<<
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":653
 *     if xpathObj.nodesetval is NULL:
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):             # <<<<<<<<<<<<<<
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 */
  __pyx_t_3 = __pyx_v_xpathObj->nodesetval->nodeNr;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":654
 *         return result
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]             # <<<<<<<<<<<<<<
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 */
    __pyx_v_c_node = (__pyx_v_xpathObj->nodesetval->nodeTab[__pyx_v_i]);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":655
 *     for i in range(xpathObj.nodesetval.nodeNr):
 *         c_node = xpathObj.nodesetval.nodeTab[i]
 *         _unpackNodeSetEntry(result, c_node, doc, context,             # <<<<<<<<<<<<<<
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 *     return result
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_result, __pyx_v_c_node, __pyx_v_doc, __pyx_v_context, (__pyx_v_xpathObj->type == XPATH_XSLT_TREE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":657
 *         _unpackNodeSetEntry(result, c_node, doc, context,
 *                             xpathObj.type == xpath.XPATH_XSLT_TREE)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":645
 *         raise XPathResultError, u"Unknown xpath result %s" % unicode(xpathObj.type)
 * 
 * cdef object _createNodeSetResult(xpath.xmlXPathObject* xpathObj, _Document doc,             # <<<<<<<<<<<<<<
 *                                  _BaseContext context):
 *     cdef xmlNode* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._createNodeSetResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":659
 *     return result
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
 */

static PyObject *__pyx_f_4lxml_5etree__unpackNodeSetEntry(PyObject *__pyx_v_results, xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context, int __pyx_v_is_fragment) {
  xmlNode *__pyx_v_c_child;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  xmlNode *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unpackNodeSetEntry", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":662
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
 *     if _isElement(c_node):             # <<<<<<<<<<<<<<
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:
 *             # XXX: works, but maybe not always the right thing to do?
 */
  __pyx_t_1 = (_isElement(__pyx_v_c_node) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":663
 *     cdef xmlNode* c_child
 *     if _isElement(c_node):
 *         if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *             # XXX: works, but maybe not always the right thing to do?
 *             # XPath: only runs when extensions create or copy trees
 */
    __pyx_t_1 = ((__pyx_v_c_node->doc != __pyx_v_doc->_c_doc) != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = ((__pyx_v_c_node->doc->_private == NULL) != 0);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_3 = __pyx_t_1;
    }
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":668
 *             #        -> we store Python refs to these, so that is OK
 *             # XSLT: can it leak when merging trees from multiple sources?
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(
 */
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":670
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(             # <<<<<<<<<<<<<<
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":671
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":670
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *             # FIXME: call _instantiateElementFromXPath() instead?
 *         results.append(             # <<<<<<<<<<<<<<
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":672
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 */
  switch (__pyx_v_c_node->type) {
    case XML_TEXT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":673
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(
 */
    case XML_CDATA_SECTION_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":674
 *     elif c_node.type == tree.XML_TEXT_NODE or \
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))
 */
    case XML_ATTRIBUTE_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":672
 *         results.append(
 *             _fakeDocElementFactory(doc, c_node))
 *     elif c_node.type == tree.XML_TEXT_NODE or \             # <<<<<<<<<<<<<<
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 */
    __pyx_t_3 = 1;
    break;
    default:
    __pyx_t_3 = 0;
    break;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":675
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(             # <<<<<<<<<<<<<<
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":676
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree__buildElementStringResult(__pyx_v_doc, __pyx_v_c_node, __pyx_v_context); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":675
 *              c_node.type == tree.XML_CDATA_SECTION_NODE or \
 *              c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         results.append(             # <<<<<<<<<<<<<<
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":677
 *         results.append(
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:             # <<<<<<<<<<<<<<
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 */
  __pyx_t_3 = ((__pyx_v_c_node->type == XML_NAMESPACE_DECL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":678
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),             # <<<<<<<<<<<<<<
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 */
    if (unlikely(__pyx_v_results == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
      {__pyx_filename = __pyx_f[8]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicodeOrNone(((xmlNs *)__pyx_v_c_node)->prefix); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":679
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree_funicodeOrNone(((xmlNs *)__pyx_v_c_node)->href); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":678
 *             _buildElementStringResult(doc, c_node, context))
 *     elif c_node.type == tree.XML_NAMESPACE_DECL:
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),             # <<<<<<<<<<<<<<
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_7); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":680
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 */
  switch (__pyx_v_c_node->type) {
    case XML_DOCUMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":681
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:             # <<<<<<<<<<<<<<
 *         # ignored for everything but result tree fragments
 *         if is_fragment:
 */
    case XML_HTML_DOCUMENT_NODE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":680
 *         results.append( (funicodeOrNone((<xmlNs*>c_node).prefix),
 *                          funicodeOrNone((<xmlNs*>c_node).href)) )
 *     elif c_node.type == tree.XML_DOCUMENT_NODE or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 */
    __pyx_t_3 = 1;
    break;
    default:
    __pyx_t_3 = 0;
    break;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":683
 *             c_node.type == tree.XML_HTML_DOCUMENT_NODE:
 *         # ignored for everything but result tree fragments
 *         if is_fragment:             # <<<<<<<<<<<<<<
 *             c_child = c_node.children
 *             while c_child is not NULL:
 */
    __pyx_t_3 = (__pyx_v_is_fragment != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":684
 *         # ignored for everything but result tree fragments
 *         if is_fragment:
 *             c_child = c_node.children             # <<<<<<<<<<<<<<
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 */
      __pyx_t_8 = __pyx_v_c_node->children;
      __pyx_v_c_child = __pyx_t_8;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":685
 *         if is_fragment:
 *             c_child = c_node.children
 *             while c_child is not NULL:             # <<<<<<<<<<<<<<
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 */
      while (1) {
        __pyx_t_3 = ((__pyx_v_c_child != NULL) != 0);
        if (!__pyx_t_3) break;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":686
 *             c_child = c_node.children
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)             # <<<<<<<<<<<<<<
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 */
        __pyx_t_7 = __pyx_f_4lxml_5etree__unpackNodeSetEntry(__pyx_v_results, __pyx_v_c_child, __pyx_v_doc, __pyx_v_context, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":687
 *             while c_child is not NULL:
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next             # <<<<<<<<<<<<<<
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:
 */
        __pyx_t_8 = __pyx_v_c_child->next;
        __pyx_v_c_child = __pyx_t_8;
      }
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":688
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_XINCLUDE_END:
 *         pass
 */
  switch (__pyx_v_c_node->type) {
    case XML_XINCLUDE_START:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":689
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \
 *             c_node.type == tree.XML_XINCLUDE_END:             # <<<<<<<<<<<<<<
 *         pass
 *     else:
 */
    case XML_XINCLUDE_END:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":688
 *                 _unpackNodeSetEntry(results, c_child, doc, context, 0)
 *                 c_child = c_child.next
 *     elif c_node.type == tree.XML_XINCLUDE_START or \             # <<<<<<<<<<<<<<
 *             c_node.type == tree.XML_XINCLUDE_END:
 *         pass
 */
    __pyx_t_3 = 1;
    break;
    default:
    __pyx_t_3 = 0;
    break;
  }
  if (__pyx_t_3) {
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":693
 *     else:
 *         raise NotImplementedError, \
 *             u"Not yet implemented result node type: %d" % c_node.type             # <<<<<<<<<<<<<<
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj):
 */
    __pyx_t_7 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_Not_yet_implemented_result_node, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_t_6, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    {__pyx_filename = __pyx_f[8]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":659
 *     return result
 * 
 * cdef _unpackNodeSetEntry(list results, xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                          _BaseContext context, bint is_fragment):
 *     cdef xmlNode* c_child
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._unpackNodeSetEntry", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":695
 *             u"Not yet implemented result node type: %d" % c_node.type
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj):             # <<<<<<<<<<<<<<
 *     u"""Free the XPath object, but *never* free the *content* of node sets.
 *     Python dealloc will do that for us.
 */

static void __pyx_f_4lxml_5etree__freeXPathObject(xmlXPathObject *__pyx_v_xpathObj) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_freeXPathObject", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":699
 *     Python dealloc will do that for us.
 *     """
 *     if xpathObj.nodesetval is not NULL:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 */
  __pyx_t_1 = ((__pyx_v_xpathObj->nodesetval != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":700
 *     """
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)             # <<<<<<<<<<<<<<
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)
 */
    xmlXPathFreeNodeSet(__pyx_v_xpathObj->nodesetval);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":701
 *     if xpathObj.nodesetval is not NULL:
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL             # <<<<<<<<<<<<<<
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 */
    __pyx_v_xpathObj->nodesetval = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":702
 *         xpath.xmlXPathFreeNodeSet(xpathObj.nodesetval)
 *         xpathObj.nodesetval = NULL
 *     xpath.xmlXPathFreeObject(xpathObj)             # <<<<<<<<<<<<<<
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,
 */
  xmlXPathFreeObject(__pyx_v_xpathObj);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":695
 *             u"Not yet implemented result node type: %d" % c_node.type
 * 
 * cdef void _freeXPathObject(xpath.xmlXPathObject* xpathObj):             # <<<<<<<<<<<<<<
 *     u"""Free the XPath object, but *never* free the *content* of node sets.
 *     Python dealloc will do that for us.
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":704
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 */

static struct LxmlElement *__pyx_f_4lxml_5etree__instantiateElementFromXPath(xmlNode *__pyx_v_c_node, struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_instantiateElementFromXPath", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":707
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 *     if c_node.doc != doc._c_doc and c_node.doc._private is NULL:             # <<<<<<<<<<<<<<
 *         # not from the context document and not from a fake document
 *         # either => may still be from a known document, e.g. one
 */
  __pyx_t_1 = ((__pyx_v_c_node->doc != __pyx_v_doc->_c_doc) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_c_node->doc->_private == NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":711
 *         # either => may still be from a known document, e.g. one
 *         # created by an extension function
 *         doc = context._findDocumentForNode(c_node)             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             # not from a known document at all! => can only make a
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode(__pyx_v_context, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":712
 *         # created by an extension function
 *         doc = context._findDocumentForNode(c_node)
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_doc) == Py_None);
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":715
 *             # not from a known document at all! => can only make a
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)             # <<<<<<<<<<<<<<
 *     return _fakeDocElementFactory(doc, c_node)
 * 
 */
      __pyx_v_c_node = xmlDocCopyNode(__pyx_v_c_node, __pyx_v_doc->_c_doc, 1);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":716
 *             # safety copy here
 *             c_node = tree.xmlDocCopyNode(c_node, doc._c_doc, 1)
 *     return _fakeDocElementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__fakeDocElementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":704
 *     xpath.xmlXPathFreeObject(xpathObj)
 * 
 * cdef _Element _instantiateElementFromXPath(xmlNode* c_node, _Document doc,             # <<<<<<<<<<<<<<
 *                                            _BaseContext context):
 *     # NOTE: this may copy the element - only call this when it can't leak
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._instantiateElementFromXPath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":729
 *     cdef readonly bint is_attribute
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_getparent(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":730
 * 
 *     def getparent(self):
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 * class _ElementStringResult(bytes):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_r = ((PyObject *)__pyx_v_self->_parent);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":729
 *     cdef readonly bint is_attribute
 * 
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":724
 * cdef class _ElementUnicodeResult(unicode):
 *     cdef _Element _parent
 *     cdef readonly object attrname             # <<<<<<<<<<<<<<
 *     cdef readonly bint is_tail
 *     cdef readonly bint is_text
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_8attrname_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_8attrname_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_8attrname___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->attrname);
  __pyx_r = __pyx_v_self->attrname;
  goto __pyx_L0;

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":725
 *     cdef _Element _parent
 *     cdef readonly object attrname
 *     cdef readonly bint is_tail             # <<<<<<<<<<<<<<
 *     cdef readonly bint is_text
 *     cdef readonly bint is_attribute
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_tail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_tail_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_tail___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementUnicodeResult.is_tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":726
 *     cdef readonly object attrname
 *     cdef readonly bint is_tail
 *     cdef readonly bint is_text             # <<<<<<<<<<<<<<
 *     cdef readonly bint is_attribute
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_text_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_text_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_7is_text___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementUnicodeResult.is_text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":727
 *     cdef readonly bint is_tail
 *     cdef readonly bint is_text
 *     cdef readonly bint is_attribute             # <<<<<<<<<<<<<<
 * 
 *     def getparent(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_12is_attribute_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_12is_attribute_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_21_ElementUnicodeResult_12is_attribute___get__(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_attribute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementUnicodeResult.is_attribute.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":735
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_20_ElementStringResult_1getparent(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_4lxml_5etree_20_ElementStringResult_1getparent = {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pw_4lxml_5etree_20_ElementStringResult_1getparent, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_4lxml_5etree_20_ElementStringResult_1getparent(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getparent (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_20_ElementStringResult_getparent(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":736
 *     # in Pyrex/Cython
 *     def getparent(self):
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":735
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._ElementStringResult.getparent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":738
 *         return self._parent
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     cdef _ElementUnicodeResult uresult
 */

static PyObject *__pyx_f_4lxml_5etree__elementStringResultFactory(PyObject *__pyx_v_string_value, struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_attrname, int __pyx_v_is_tail) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *__pyx_v_uresult = 0;
  int __pyx_v_is_text;
  int __pyx_v_is_attribute;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_elementStringResultFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":742
 *     cdef _ElementUnicodeResult uresult
 *     cdef bint is_text
 *     cdef bint is_attribute = attrname is not None             # <<<<<<<<<<<<<<
 *     if parent is None:
 *         is_text = 0
 */
  __pyx_t_1 = (__pyx_v_attrname != Py_None);
  __pyx_v_is_attribute = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":743
 *     cdef bint is_text
 *     cdef bint is_attribute = attrname is not None
 *     if parent is None:             # <<<<<<<<<<<<<<
 *         is_text = 0
 *     else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_parent) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":744
 *     cdef bint is_attribute = attrname is not None
 *     if parent is None:
 *         is_text = 0             # <<<<<<<<<<<<<<
 *     else:
 *         is_text = not (is_tail or is_attribute)
 */
    __pyx_v_is_text = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":746
 *         is_text = 0
 *     else:
 *         is_text = not (is_tail or is_attribute)             # <<<<<<<<<<<<<<
 * 
 *     if type(string_value) is bytes:
 */
    if (!(__pyx_v_is_tail != 0)) {
      __pyx_t_2 = (__pyx_v_is_attribute != 0);
    } else {
      __pyx_t_2 = (__pyx_v_is_tail != 0);
    }
    __pyx_v_is_text = (!__pyx_t_2);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":748
 *         is_text = not (is_tail or is_attribute)
 * 
 *     if type(string_value) is bytes:             # <<<<<<<<<<<<<<
 *         result = _ElementStringResult(string_value)
 *         result._parent = parent
 */
  __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_string_value)) == ((PyObject *)((PyObject*)(&PyBytes_Type))));
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":749
 * 
 *     if type(string_value) is bytes:
 *         result = _ElementStringResult(string_value)             # <<<<<<<<<<<<<<
 *         result._parent = parent
 *         result.is_attribute = is_attribute
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ElementStringResult); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_string_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_string_value);
    __Pyx_GIVEREF(__pyx_v_string_value);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":750
 *     if type(string_value) is bytes:
 *         result = _ElementStringResult(string_value)
 *         result._parent = parent             # <<<<<<<<<<<<<<
 *         result.is_attribute = is_attribute
 *         result.is_tail = is_tail
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_parent, ((PyObject *)__pyx_v_parent)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":751
 *         result = _ElementStringResult(string_value)
 *         result._parent = parent
 *         result.is_attribute = is_attribute             # <<<<<<<<<<<<<<
 *         result.is_tail = is_tail
 *         result.is_text = is_text
 */
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_attribute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_is_attribute, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":752
 *         result._parent = parent
 *         result.is_attribute = is_attribute
 *         result.is_tail = is_tail             # <<<<<<<<<<<<<<
 *         result.is_text = is_text
 *         result.attrname = attrname
 */
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_tail); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_is_tail, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":753
 *         result.is_attribute = is_attribute
 *         result.is_tail = is_tail
 *         result.is_text = is_text             # <<<<<<<<<<<<<<
 *         result.attrname = attrname
 *         return result
 */
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_text); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_is_text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":754
 *         result.is_tail = is_tail
 *         result.is_text = is_text
 *         result.attrname = attrname             # <<<<<<<<<<<<<<
 *         return result
 *     else:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_attrname, __pyx_v_attrname) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":755
 *         result.is_text = is_text
 *         result.attrname = attrname
 *         return result             # <<<<<<<<<<<<<<
 *     else:
 *         uresult = _ElementUnicodeResult(string_value)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_result);
    __pyx_r = __pyx_v_result;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":757
 *         return result
 *     else:
 *         uresult = _ElementUnicodeResult(string_value)             # <<<<<<<<<<<<<<
 *         uresult._parent = parent
 *         uresult.is_attribute = is_attribute
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_string_value);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_string_value);
    __Pyx_GIVEREF(__pyx_v_string_value);
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementUnicodeResult)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_uresult = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":758
 *     else:
 *         uresult = _ElementUnicodeResult(string_value)
 *         uresult._parent = parent             # <<<<<<<<<<<<<<
 *         uresult.is_attribute = is_attribute
 *         uresult.is_tail = is_tail
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_parent));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
    __Pyx_GOTREF(__pyx_v_uresult->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_uresult->_parent));
    __pyx_v_uresult->_parent = __pyx_v_parent;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":759
 *         uresult = _ElementUnicodeResult(string_value)
 *         uresult._parent = parent
 *         uresult.is_attribute = is_attribute             # <<<<<<<<<<<<<<
 *         uresult.is_tail = is_tail
 *         uresult.is_text = is_text
 */
    __pyx_v_uresult->is_attribute = __pyx_v_is_attribute;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":760
 *         uresult._parent = parent
 *         uresult.is_attribute = is_attribute
 *         uresult.is_tail = is_tail             # <<<<<<<<<<<<<<
 *         uresult.is_text = is_text
 *         uresult.attrname = attrname
 */
    __pyx_v_uresult->is_tail = __pyx_v_is_tail;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":761
 *         uresult.is_attribute = is_attribute
 *         uresult.is_tail = is_tail
 *         uresult.is_text = is_text             # <<<<<<<<<<<<<<
 *         uresult.attrname = attrname
 *         return uresult
 */
    __pyx_v_uresult->is_text = __pyx_v_is_text;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":762
 *         uresult.is_tail = is_tail
 *         uresult.is_text = is_text
 *         uresult.attrname = attrname             # <<<<<<<<<<<<<<
 *         return uresult
 * 
 */
    __Pyx_INCREF(__pyx_v_attrname);
    __Pyx_GIVEREF(__pyx_v_attrname);
    __Pyx_GOTREF(__pyx_v_uresult->attrname);
    __Pyx_DECREF(__pyx_v_uresult->attrname);
    __pyx_v_uresult->attrname = __pyx_v_attrname;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":763
 *         uresult.is_text = is_text
 *         uresult.attrname = attrname
 *         return uresult             # <<<<<<<<<<<<<<
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_uresult));
    __pyx_r = ((PyObject *)__pyx_v_uresult);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":738
 *         return self._parent
 * 
 * cdef object _elementStringResultFactory(string_value, _Element parent,             # <<<<<<<<<<<<<<
 *                                         attrname, bint is_tail):
 *     cdef _ElementUnicodeResult uresult
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._elementStringResultFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_uresult);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":765
 *         return uresult
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                       _BaseContext context):
 *     cdef _Element parent = None
 */

static PyObject *__pyx_f_4lxml_5etree__buildElementStringResult(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context) {
  struct LxmlElement *__pyx_v_parent = 0;
  PyObject *__pyx_v_attrname = 0;
  xmlNode *__pyx_v_c_element;
  int __pyx_v_is_tail;
  xmlChar *__pyx_v_s;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  xmlNode *__pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_buildElementStringResult", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":767
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,
 *                                       _BaseContext context):
 *     cdef _Element parent = None             # <<<<<<<<<<<<<<
 *     cdef object attrname = None
 *     cdef xmlNode* c_element
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_parent = ((struct LxmlElement *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":768
 *                                       _BaseContext context):
 *     cdef _Element parent = None
 *     cdef object attrname = None             # <<<<<<<<<<<<<<
 *     cdef xmlNode* c_element
 *     cdef bint is_tail
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_attrname = Py_None;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":772
 *     cdef bint is_tail
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:             # <<<<<<<<<<<<<<
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 */
  __pyx_t_1 = ((__pyx_v_c_node->type == XML_ATTRIBUTE_NODE) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":773
 * 
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         attrname = _namespacedName(c_node)             # <<<<<<<<<<<<<<
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_attrname, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":774
 *     if c_node.type == tree.XML_ATTRIBUTE_NODE:
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0             # <<<<<<<<<<<<<<
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:
 */
    __pyx_v_is_tail = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":775
 *         attrname = _namespacedName(c_node)
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)             # <<<<<<<<<<<<<<
 *         try:
 *             value = funicode(s)
 */
    __pyx_v_s = xmlNodeGetContent(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":776
 *         is_tail = 0
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:             # <<<<<<<<<<<<<<
 *             value = funicode(s)
 *         finally:
 */
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":777
 *         s = tree.xmlNodeGetContent(c_node)
 *         try:
 *             value = funicode(s)             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
      __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":779
 *             value = funicode(s)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         c_element = NULL
 *     else:
 */
    /*finally:*/ {
      /*normal exit:*/{
        xmlFree(__pyx_v_s);
        goto __pyx_L6;
      }
      /*exception exit:*/{
        __pyx_L5_error:;
        __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
        {
          xmlFree(__pyx_v_s);
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
        goto __pyx_L1_error;
      }
      __pyx_L6:;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":780
 *         finally:
 *             tree.xmlFree(s)
 *         c_element = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type"
 */
    __pyx_v_c_element = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":784
 *         #assert c_node.type == tree.XML_TEXT_NODE or c_node.type == tree.XML_CDATA_SECTION_NODE, "invalid node type"
 *         # may be tail text or normal text
 *         value = funicode(c_node.content)             # <<<<<<<<<<<<<<
 *         c_element = _previousElement(c_node)
 *         is_tail = c_element is not NULL
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":785
 *         # may be tail text or normal text
 *         value = funicode(c_node.content)
 *         c_element = _previousElement(c_node)             # <<<<<<<<<<<<<<
 *         is_tail = c_element is not NULL
 * 
 */
    __pyx_v_c_element = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":786
 *         value = funicode(c_node.content)
 *         c_element = _previousElement(c_node)
 *         is_tail = c_element is not NULL             # <<<<<<<<<<<<<<
 * 
 *     if not context._build_smart_strings:
 */
    __pyx_v_is_tail = (__pyx_v_c_element != NULL);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":788
 *         is_tail = c_element is not NULL
 * 
 *     if not context._build_smart_strings:             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_context->_build_smart_strings != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":789
 * 
 *     if not context._build_smart_strings:
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     if c_element is NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":791
 *         return value
 * 
 *     if c_element is NULL:             # <<<<<<<<<<<<<<
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
 */
  __pyx_t_1 = ((__pyx_v_c_element == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":793
 *     if c_element is NULL:
 *         # non-tail text or attribute text
 *         c_element = c_node.parent             # <<<<<<<<<<<<<<
 *         while c_element is not NULL and not _isElement(c_element):
 *             c_element = c_element.parent
 */
    __pyx_t_12 = __pyx_v_c_node->parent;
    __pyx_v_c_element = __pyx_t_12;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":794
 *         # non-tail text or attribute text
 *         c_element = c_node.parent
 *         while c_element is not NULL and not _isElement(c_element):             # <<<<<<<<<<<<<<
 *             c_element = c_element.parent
 * 
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_element != NULL) != 0);
      if (__pyx_t_1) {
        __pyx_t_13 = ((!(_isElement(__pyx_v_c_element) != 0)) != 0);
        __pyx_t_14 = __pyx_t_13;
      } else {
        __pyx_t_14 = __pyx_t_1;
      }
      if (!__pyx_t_14) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":795
 *         c_element = c_node.parent
 *         while c_element is not NULL and not _isElement(c_element):
 *             c_element = c_element.parent             # <<<<<<<<<<<<<<
 * 
 *     if c_element is not NULL:
 */
      __pyx_t_12 = __pyx_v_c_element->parent;
      __pyx_v_c_element = __pyx_t_12;
    }
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":797
 *             c_element = c_element.parent
 * 
 *     if c_element is not NULL:             # <<<<<<<<<<<<<<
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 */
  __pyx_t_14 = ((__pyx_v_c_element != NULL) != 0);
  if (__pyx_t_14) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":798
 * 
 *     if c_element is not NULL:
 *         parent = _instantiateElementFromXPath(c_element, doc, context)             # <<<<<<<<<<<<<<
 * 
 *     return _elementStringResultFactory(
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__instantiateElementFromXPath(__pyx_v_c_element, __pyx_v_doc, __pyx_v_context)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_parent, ((struct LxmlElement *)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":800
 *         parent = _instantiateElementFromXPath(c_element, doc, context)
 * 
 *     return _elementStringResultFactory(             # <<<<<<<<<<<<<<
 *         value, parent, attrname, is_tail)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":801
 * 
 *     return _elementStringResultFactory(
 *         value, parent, attrname, is_tail)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__elementStringResultFactory(__pyx_v_value, __pyx_v_parent, __pyx_v_attrname, __pyx_v_is_tail); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":765
 *         return uresult
 * 
 * cdef object _buildElementStringResult(_Document doc, xmlNode* c_node,             # <<<<<<<<<<<<<<
 *                                       _BaseContext context):
 *     cdef _Element parent = None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._buildElementStringResult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_parent);
  __Pyx_XDECREF(__pyx_v_attrname);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":806
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs):
 *     cdef _Document doc
 */

static void __pyx_f_4lxml_5etree__extension_function_call(struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context, PyObject *__pyx_v_function, xmlXPathParserContext *__pyx_v_ctxt, int __pyx_v_nargs) {
  struct LxmlDocument *__pyx_v_doc = 0;
  xmlXPathObject *__pyx_v_obj;
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED int __pyx_v_i;
  PyObject *__pyx_v_o = NULL;
  PyObject *__pyx_v_res = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  xmlXPathObject *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_extension_function_call", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":812
 *     cdef list args
 *     cdef int i
 *     doc = context._doc             # <<<<<<<<<<<<<<
 *     try:
 *         args = []
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_context->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":813
 *     cdef int i
 *     doc = context._doc
 *     try:             # <<<<<<<<<<<<<<
 *         args = []
 *         for i in range(nargs):
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":814
 *     doc = context._doc
 *     try:
 *         args = []             # <<<<<<<<<<<<<<
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)
 */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_args = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":815
 *     try:
 *         args = []
 *         for i in range(nargs):             # <<<<<<<<<<<<<<
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)
 */
        __pyx_t_5 = __pyx_v_nargs;
        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
          __pyx_v_i = __pyx_t_6;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":816
 *         args = []
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)             # <<<<<<<<<<<<<<
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)
 */
          __pyx_v_obj = valuePop(__pyx_v_ctxt);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":817
 *         for i in range(nargs):
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)             # <<<<<<<<<<<<<<
 *             _freeXPathObject(obj)
 *             args.append(o)
 */
          __pyx_t_1 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_obj, __pyx_v_doc, __pyx_v_context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":818
 *             obj = xpath.valuePop(ctxt)
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)             # <<<<<<<<<<<<<<
 *             args.append(o)
 *         args.reverse()
 */
          __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_obj);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":819
 *             o = _unwrapXPathObject(obj, doc, context)
 *             _freeXPathObject(obj)
 *             args.append(o)             # <<<<<<<<<<<<<<
 *         args.reverse()
 * 
 */
          __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_args, __pyx_v_o); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":820
 *             _freeXPathObject(obj)
 *             args.append(o)
 *         args.reverse()             # <<<<<<<<<<<<<<
 * 
 *         res = function(context, *args)
 */
        __pyx_t_7 = PyList_Reverse(__pyx_v_args); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L6_error;}

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":822
 *         args.reverse()
 * 
 *         res = function(context, *args)             # <<<<<<<<<<<<<<
 *         # wrap result for XPath consumption
 *         obj = _wrapXPathObject(res, doc, context)
 */
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_context));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_context));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
        __pyx_t_8 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_function, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_v_res = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":824
 *         res = function(context, *args)
 *         # wrap result for XPath consumption
 *         obj = _wrapXPathObject(res, doc, context)             # <<<<<<<<<<<<<<
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
 */
        __pyx_t_10 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_res, __pyx_v_doc, __pyx_v_context); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __pyx_v_obj = __pyx_t_10;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":826
 *         obj = _wrapXPathObject(res, doc, context)
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)             # <<<<<<<<<<<<<<
 *         xpath.valuePush(ctxt, obj)
 *     except:
 */
        __pyx_t_8 = __pyx_f_4lxml_5etree_12_BaseContext__hold(__pyx_v_context, __pyx_v_res); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":827
 *         # prevent Python from deallocating elements handed to libxml2
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)             # <<<<<<<<<<<<<<
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 */
        valuePush(__pyx_v_ctxt, __pyx_v_obj);
      }
      __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;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":828
 *         context._hold(res)
 *         xpath.valuePush(ctxt, obj)
 *     except:             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 *         context._exc._store_raised()
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._extension_function_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":829
 *         xpath.valuePush(ctxt, obj)
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_raised()
 *     finally:
 */
        xmlXPathErr(__pyx_v_ctxt, XPATH_EXPR_ERROR);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":830
 *     except:
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_EXPR_ERROR)
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_raised(__pyx_v_context->_exc);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L7_exception_handled;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L13_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":832
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * # lookup the function by name and call it
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        goto __pyx_L18_return;
      }
      __pyx_L18_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":806
 * # callbacks for XPath/XSLT extension functions
 * 
 * cdef void _extension_function_call(_BaseContext context, function,             # <<<<<<<<<<<<<<
 *                                    xpath.xmlXPathParserContext* ctxt, int nargs):
 *     cdef _Document doc
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":836
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) with gil:
 *     cdef _BaseContext context
 */

static void __pyx_f_4lxml_5etree__xpath_function_call(xmlXPathParserContext *__pyx_v_ctxt, int __pyx_v_nargs) {
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_v_context = 0;
  xmlXPathContext *__pyx_v_rctxt;
  PyObject *__pyx_v_function = NULL;
  __Pyx_RefNannyDeclarations
  xmlXPathContext *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xpath_function_call", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":839
 *                                int nargs) with gil:
 *     cdef _BaseContext context
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context             # <<<<<<<<<<<<<<
 *     context = <_BaseContext> rctxt.userData
 *     try:
 */
  __pyx_t_1 = __pyx_v_ctxt->context;
  __pyx_v_rctxt = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":840
 *     cdef _BaseContext context
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context
 *     context = <_BaseContext> rctxt.userData             # <<<<<<<<<<<<<<
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_rctxt->userData);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":841
 *     cdef xpath.xmlXPathContext* rctxt = ctxt.context
 *     context = <_BaseContext> rctxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":842
 *     context = <_BaseContext> rctxt.userData
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)             # <<<<<<<<<<<<<<
 *         if function is not None:
 *             _extension_function_call(context, function, ctxt, nargs)
 */
        __pyx_t_2 = __pyx_f_4lxml_5etree_12_BaseContext__find_cached_function(__pyx_v_context, __pyx_v_rctxt->functionURI, __pyx_v_rctxt->function); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_function = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":843
 *     try:
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:             # <<<<<<<<<<<<<<
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
 */
        __pyx_t_6 = (__pyx_v_function != Py_None);
        __pyx_t_7 = (__pyx_t_6 != 0);
        if (__pyx_t_7) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":844
 *         function = context._find_cached_function(rctxt.functionURI, rctxt.function)
 *         if function is not None:
 *             _extension_function_call(context, function, ctxt, nargs)             # <<<<<<<<<<<<<<
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 */
          __pyx_f_4lxml_5etree__extension_function_call(__pyx_v_context, __pyx_v_function, __pyx_v_ctxt, __pyx_v_nargs);
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":846
 *             _extension_function_call(context, function, ctxt, nargs)
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)             # <<<<<<<<<<<<<<
 *             context._exc._store_exception(
 *                 XPathFunctionError(u"XPath function '%s' not found" %
 */
          xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":848
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(
 *                 XPathFunctionError(u"XPath function '%s' not found" %             # <<<<<<<<<<<<<<
 *                 _namespacedNameFromNsName(rctxt.functionURI, rctxt.function)))
 *     except:
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathFunctionError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_2);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":849
 *             context._exc._store_exception(
 *                 XPathFunctionError(u"XPath function '%s' not found" %
 *                 _namespacedNameFromNsName(rctxt.functionURI, rctxt.function)))             # <<<<<<<<<<<<<<
 *     except:
 *         # may not be the right error, but we need to tell libxml2 *something*
 */
          __pyx_t_8 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_rctxt->functionURI, __pyx_v_rctxt->function); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_8);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":848
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(
 *                 XPathFunctionError(u"XPath function '%s' not found" %             # <<<<<<<<<<<<<<
 *                 _namespacedNameFromNsName(rctxt.functionURI, rctxt.function)))
 *     except:
 */
          __pyx_t_9 = PyUnicode_Format(__pyx_kp_u_XPath_function_s_not_found, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":847
 *         else:
 *             xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *             context._exc._store_exception(             # <<<<<<<<<<<<<<
 *                 XPathFunctionError(u"XPath function '%s' not found" %
 *                 _namespacedNameFromNsName(rctxt.functionURI, rctxt.function)))
 */
          ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_exception(__pyx_v_context->_exc, __pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_L14:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":850
 *                 XPathFunctionError(u"XPath function '%s' not found" %
 *                 _namespacedNameFromNsName(rctxt.functionURI, rctxt.function)))
 *     except:             # <<<<<<<<<<<<<<
 *         # may not be the right error, but we need to tell libxml2 *something*
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._xpath_function_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_2);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":852
 *     except:
 *         # may not be the right error, but we need to tell libxml2 *something*
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)             # <<<<<<<<<<<<<<
 *         context._exc._store_raised()
 *     finally:
 */
        xmlXPathErr(__pyx_v_ctxt, XPATH_UNKNOWN_FUNC_ERROR);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":853
 *         # may not be the right error, but we need to tell libxml2 *something*
 *         xpath.xmlXPathErr(ctxt, xpath.XPATH_UNKNOWN_FUNC_ERROR)
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->_exc->__pyx_vtab)->_store_raised(__pyx_v_context->_exc);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L7_exception_handled;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L13_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":855
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      {
        goto __pyx_L17_return;
      }
      __pyx_L17_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":836
 * # lookup the function by name and call it
 * 
 * cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt,             # <<<<<<<<<<<<<<
 *                                int nargs) with gil:
 *     cdef _BaseContext context
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":31
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

static int __pyx_f_4lxml_5etree__register_xpath_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_register_xpath_function", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":32
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":33
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf),
 *             _xpath_function_call)
 */
    __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_f_4lxml_5etree__xpath_function_call);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":37
 *             _xpath_function_call)
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             _xpath_function_call)
 */
    __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), __pyx_f_4lxml_5etree__xpath_function_call);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":31
 * )
 * 
 * cdef int _register_xpath_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":41
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

static int __pyx_f_4lxml_5etree__unregister_xpath_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_unregister_xpath_function", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":42
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return xpath.xmlXPathRegisterFunc(
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":43
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 *     else:
 */
    __pyx_r = xmlXPathRegisterFunc(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), NULL);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":46
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), NULL)
 *     else:
 *         return xpath.xmlXPathRegisterFuncNS(             # <<<<<<<<<<<<<<
 *             <xpath.xmlXPathContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf), NULL)
 * 
 */
    __pyx_r = xmlXPathRegisterFuncNS(((xmlXPathContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), NULL);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":41
 *             _xpath_function_call)
 * 
 * cdef int _unregister_xpath_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return xpath.xmlXPathRegisterFunc(
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":54
 * cdef class _XPathContext(_BaseContext):
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         self._variables = variables
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_13_XPathContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_13_XPathContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_variables = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_error_log,&__pyx_n_s_enable_regexp,&__pyx_n_s_variables,&__pyx_n_s_build_smart_strings,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_extensions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_log)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enable_regexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_variables)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_build_smart_strings)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_error_log = values[2];
    __pyx_v_enable_regexp = values[3];
    __pyx_v_variables = values[4];
    __pyx_v_build_smart_strings = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XPathContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13_XPathContext___init__(((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_variables, __pyx_v_build_smart_strings);

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

static int __pyx_pf_4lxml_5etree_13_XPathContext___init__(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_variables, PyObject *__pyx_v_build_smart_strings) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":56
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,
 *                  build_smart_strings):
 *         self._variables = variables             # <<<<<<<<<<<<<<
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)
 */
  __Pyx_INCREF(__pyx_v_variables);
  __Pyx_GIVEREF(__pyx_v_variables);
  __Pyx_GOTREF(__pyx_v_self->_variables);
  __Pyx_DECREF(__pyx_v_self->_variables);
  __pyx_v_self->_variables = __pyx_v_variables;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":57
 *                  build_smart_strings):
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseContext)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":58
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
  __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 57; __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_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_error_log);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_error_log);
  __Pyx_GIVEREF(__pyx_v_error_log);
  __Pyx_INCREF(__pyx_v_enable_regexp);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  __Pyx_INCREF(__pyx_v_build_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_build_smart_strings);
  __Pyx_GIVEREF(__pyx_v_build_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":57
 *                  build_smart_strings):
 *         self._variables = variables
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 57; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":54
 * cdef class _XPathContext(_BaseContext):
 *     cdef object _variables
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp, variables,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         self._variables = variables
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":60
 *                               build_smart_strings)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xpathCtxt)
 *         # This would be a good place to set up the XPath parser dict, but
 */

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_set_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":61
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._set_xpath_context(xpathCtxt)             # <<<<<<<<<<<<<<
 *         # This would be a good place to set up the XPath parser dict, but
 *         # we cannot use the current thread dict as we do not know which
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_xpath_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xpathCtxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":65
 *         # we cannot use the current thread dict as we do not know which
 *         # thread will execute the XPath evaluator - so, no dict for now.
 *         self.registerLocalNamespaces()             # <<<<<<<<<<<<<<
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":66
 *         # thread will execute the XPath evaluator - so, no dict for now.
 *         self.registerLocalNamespaces()
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)             # <<<<<<<<<<<<<<
 * 
 *     cdef register_context(self, _Document doc):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xpathCtxt, __pyx_f_4lxml_5etree__register_xpath_function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":60
 *                               build_smart_strings)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xpathCtxt)
 *         # This would be a good place to set up the XPath parser dict, but
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.set_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":68
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 *     cdef register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
 */

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_register_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":69
 * 
 *     cdef register_context(self, _Document doc):
 *         self._register_context(doc)             # <<<<<<<<<<<<<<
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__register_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":70
 *     cdef register_context(self, _Document doc):
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()             # <<<<<<<<<<<<<<
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":71
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)             # <<<<<<<<<<<<<<
 *         self.registerExsltFunctions()
 *         if self._variables is not None:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_self->__pyx_base._xpathCtxt, __pyx_f_4lxml_5etree__register_xpath_function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":72
 *         self.registerGlobalNamespaces()
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()             # <<<<<<<<<<<<<<
 *         if self._variables is not None:
 *             self.registerVariables(self._variables)
 */
  __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":73
 *         self.registerGlobalFunctions(self._xpathCtxt, _register_xpath_function)
 *         self.registerExsltFunctions()
 *         if self._variables is not None:             # <<<<<<<<<<<<<<
 *             self.registerVariables(self._variables)
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_variables != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":74
 *         self.registerExsltFunctions()
 *         if self._variables is not None:
 *             self.registerVariables(self._variables)             # <<<<<<<<<<<<<<
 * 
 *     cdef unregister_context(self):
 */
    __pyx_t_1 = __pyx_v_self->_variables;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":68
 *         self.registerLocalFunctions(xpathCtxt, _register_xpath_function)
 * 
 *     cdef register_context(self, _Document doc):             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerGlobalNamespaces()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XPathContext.register_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":76
 *             self.registerVariables(self._variables)
 * 
 *     cdef unregister_context(self):             # <<<<<<<<<<<<<<
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
 */

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_unregister_context(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregister_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":77
 * 
 *     cdef unregister_context(self):
 *         self.unregisterGlobalFunctions(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.unregisterGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_self->__pyx_base._xpathCtxt, __pyx_f_4lxml_5etree__unregister_xpath_function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":79
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.unregisterGlobalNamespaces(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":80
 *             self._xpathCtxt, _unregister_xpath_function)
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 * 
 */
  xmlXPathRegisteredVariablesCleanup(__pyx_v_self->__pyx_base._xpathCtxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":81
 *         self.unregisterGlobalNamespaces()
 *         xpath.xmlXPathRegisteredVariablesCleanup(self._xpathCtxt)
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 * 
 *     cdef void registerExsltFunctions(self):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":76
 *             self.registerVariables(self._variables)
 * 
 *     cdef unregister_context(self):             # <<<<<<<<<<<<<<
 *         self.unregisterGlobalFunctions(
 *             self._xpathCtxt, _unregister_xpath_function)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.unregister_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":83
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self):             # <<<<<<<<<<<<<<
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 */

static void __pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("registerExsltFunctions", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":84
 * 
 *     cdef void registerExsltFunctions(self):
 *         if xslt.LIBXSLT_VERSION < 10125:             # <<<<<<<<<<<<<<
 *             # we'd only execute dummy functions anyway
 *             return
 */
  __pyx_t_1 = ((LIBXSLT_VERSION < 10125) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":86
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 *             return             # <<<<<<<<<<<<<<
 *         tree.xmlHashScan(
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":87
 *             # we'd only execute dummy functions anyway
 *             return
 *         tree.xmlHashScan(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt.nsHash, _registerExsltFunctionsForNamespaces,
 *             self._xpathCtxt)
 */
  xmlHashScan(__pyx_v_self->__pyx_base._xpathCtxt->nsHash, __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces, __pyx_v_self->__pyx_base._xpathCtxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":83
 *         self._cleanup_context()
 * 
 *     cdef void registerExsltFunctions(self):             # <<<<<<<<<<<<<<
 *         if xslt.LIBXSLT_VERSION < 10125:
 *             # we'd only execute dummy functions anyway
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":91
 *             self._xpathCtxt)
 * 
 *     cdef registerVariables(self, variable_dict):             # <<<<<<<<<<<<<<
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
 */

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariables(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_variable_dict) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  xmlXPathObject *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerVariables", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":92
 * 
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():             # <<<<<<<<<<<<<<
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_variable_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":93
 *     cdef registerVariables(self, variable_dict):
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":95
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 *     cdef registerVariable(self, name, value):
 */
    __pyx_t_9 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":94
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
 *             xpath.xmlXPathRegisterVariable(             # <<<<<<<<<<<<<<
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 */
    xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_9);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":91
 *             self._xpathCtxt)
 * 
 *     cdef registerVariables(self, variable_dict):             # <<<<<<<<<<<<<<
 *         for name, value in variable_dict.items():
 *             name_utf = self._to_utf(name)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._XPathContext.registerVariables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":97
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef registerVariable(self, name, value):             # <<<<<<<<<<<<<<
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
 */

static PyObject *__pyx_f_4lxml_5etree_13_XPathContext_registerVariable(struct __pyx_obj_4lxml_5etree__XPathContext *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlXPathObject *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("registerVariable", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":98
 * 
 *     cdef registerVariable(self, name, value):
 *         name_utf = self._to_utf(name)             # <<<<<<<<<<<<<<
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._to_utf(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name_utf = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":100
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__wrapXPathObject(__pyx_v_value, ((struct LxmlDocument *)Py_None), ((struct __pyx_obj_4lxml_5etree__BaseContext *)Py_None)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":99
 *     cdef registerVariable(self, name, value):
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(             # <<<<<<<<<<<<<<
 *             self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 */
  xmlXPathRegisterVariable(__pyx_v_self->__pyx_base._xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), __pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":97
 *                 self._xpathCtxt, _xcstr(name_utf), _wrapXPathObject(value, None, None))
 * 
 *     cdef registerVariable(self, name, value):             # <<<<<<<<<<<<<<
 *         name_utf = self._to_utf(name)
 *         xpath.xmlXPathRegisterVariable(
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathContext.registerVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":103
 * 
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, xmlChar* c_prefix):
 *     c_href = <const_xmlChar*> _c_href
 */

static void __pyx_f_4lxml_5etree__registerExsltFunctionsForNamespaces(void *__pyx_v__c_href, void *__pyx_v__ctxt, xmlChar *__pyx_v_c_prefix) {
  const xmlChar *__pyx_v_c_href;
  xmlXPathContext *__pyx_v_ctxt;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_registerExsltFunctionsForNamespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":105
 * cdef void _registerExsltFunctionsForNamespaces(
 *         void* _c_href, void* _ctxt, xmlChar* c_prefix):
 *     c_href = <const_xmlChar*> _c_href             # <<<<<<<<<<<<<<
 *     ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 */
  __pyx_v_c_href = ((const xmlChar *)__pyx_v__c_href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":106
 *         void* _c_href, void* _ctxt, xmlChar* c_prefix):
 *     c_href = <const_xmlChar*> _c_href
 *     ctxt = <xpath.xmlXPathContext*> _ctxt             # <<<<<<<<<<<<<<
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 */
  __pyx_v_ctxt = ((xmlXPathContext *)__pyx_v__ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":108
 *     ctxt = <xpath.xmlXPathContext*> _ctxt
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 */
  __pyx_t_1 = ((xmlStrcmp(__pyx_v_c_href, EXSLT_DATE_NAMESPACE) == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":109
 * 
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 */
    exsltDateXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":110
 *     if tree.xmlStrcmp(c_href, xslt.EXSLT_DATE_NAMESPACE) == 0:
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 */
  __pyx_t_1 = ((xmlStrcmp(__pyx_v_c_href, EXSLT_SETS_NAMESPACE) == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":111
 *         xslt.exsltDateXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 */
    exsltSetsXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":112
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_SETS_NAMESPACE) == 0:
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 */
  __pyx_t_1 = ((xmlStrcmp(__pyx_v_c_href, EXSLT_MATH_NAMESPACE) == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":113
 *         xslt.exsltSetsXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
 */
    exsltMathXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":114
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_MATH_NAMESPACE) == 0:
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:             # <<<<<<<<<<<<<<
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)
 * 
 */
  __pyx_t_1 = ((xmlStrcmp(__pyx_v_c_href, EXSLT_STRINGS_NAMESPACE) == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":115
 *         xslt.exsltMathXpathCtxtRegister(ctxt, c_prefix)
 *     elif tree.xmlStrcmp(c_href, xslt.EXSLT_STRINGS_NAMESPACE) == 0:
 *         xslt.exsltStrXpathCtxtRegister(ctxt, c_prefix)             # <<<<<<<<<<<<<<
 * 
 * cdef bint _XPATH_VERSION_WARNING_REQUIRED
 */
    exsltStrXpathCtxtRegister(__pyx_v_ctxt, __pyx_v_c_prefix);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":103
 * 
 * 
 * cdef void _registerExsltFunctionsForNamespaces(             # <<<<<<<<<<<<<<
 *         void* _c_href, void* _ctxt, xmlChar* c_prefix):
 *     c_href = <const_xmlChar*> _c_href
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":128
 *     cdef python.PyThread_type_lock _eval_lock
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
 */

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

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

static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":129
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 */
  __pyx_v_self->_xpathCtxt = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":130
 *     def __cinit__(self):
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 */
  __pyx_t_1 = (ENABLE_THREADING != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":131
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()
 */
    __pyx_v_self->_eval_lock = PyThread_allocate_lock();

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":132
 *         if config.ENABLE_THREADING:
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()
 */
    __pyx_t_1 = ((__pyx_v_self->_eval_lock == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":133
 *             self._eval_lock = python.PyThread_allocate_lock()
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":134
 *             if self._eval_lock is NULL:
 *                 raise MemoryError()
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":128
 *     cdef python.PyThread_type_lock _eval_lock
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = NULL
 *         if config.ENABLE_THREADING:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":136
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         global _XPATH_VERSION_WARNING_REQUIRED
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_enable_regexp,&__pyx_n_s_smart_strings,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_extensions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enable_regexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_smart_strings)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_enable_regexp = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__init__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_enable_regexp, __pyx_v_smart_strings);

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

static int __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_2__init__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_smart_strings) {
  PyObject *__pyx_v_warnings = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":139
 *                  smart_strings):
 *         global _XPATH_VERSION_WARNING_REQUIRED
 *         if _XPATH_VERSION_WARNING_REQUIRED:             # <<<<<<<<<<<<<<
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings
 */
  __pyx_t_1 = (__pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":140
 *         global _XPATH_VERSION_WARNING_REQUIRED
 *         if _XPATH_VERSION_WARNING_REQUIRED:
 *             _XPATH_VERSION_WARNING_REQUIRED = 0             # <<<<<<<<<<<<<<
 *             import warnings
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "
 */
    __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":141
 *         if _XPATH_VERSION_WARNING_REQUIRED:
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings             # <<<<<<<<<<<<<<
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "
 *                           u"Use it at your own risk.")
 */
    __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_warnings = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":142
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "             # <<<<<<<<<<<<<<
 *                           u"Use it at your own risk.")
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__89, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 142; __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:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":144
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "
 *                           u"Use it at your own risk.")
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,             # <<<<<<<<<<<<<<
 *                                       enable_regexp, None, smart_strings)
 * 
 */
  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __Pyx_INCREF(__pyx_v_enable_regexp);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 4, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathContext)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_context));
  __pyx_v_self->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":136
 *         self._error_log = _ErrorLog()
 * 
 *     def __init__(self, namespaces, extensions, enable_regexp,             # <<<<<<<<<<<<<<
 *                  smart_strings):
 *         global _XPATH_VERSION_WARNING_REQUIRED
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":148
 * 
 *     property error_log:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_9error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_9error_log___get__(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":149
 *     property error_log:
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_evaluator_not_initialised);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":150
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":148
 * 
 *     property error_log:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":152
 *             return self._error_log.copy()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_4__dealloc__(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":153
 * 
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 */
  __pyx_t_1 = ((__pyx_v_self->_xpathCtxt != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":154
 *     def __dealloc__(self):
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:
 */
    xmlXPathFreeContext(__pyx_v_self->_xpathCtxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":155
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:             # <<<<<<<<<<<<<<
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)
 */
  __pyx_t_1 = (ENABLE_THREADING != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":156
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:             # <<<<<<<<<<<<<<
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->_eval_lock != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":157
 *         if config.ENABLE_THREADING:
 *             if self._eval_lock is not NULL:
 *                 python.PyThread_free_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 */
      PyThread_free_lock(__pyx_v_self->_eval_lock);
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":152
 *             return self._error_log.copy()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpathCtxt is not NULL:
 *             xpath.xmlXPathFreeContext(self._xpathCtxt)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":159
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)
 */

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathContext *__pyx_v_xpathCtxt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":160
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt             # <<<<<<<<<<<<<<
 *         self._context.set_context(xpathCtxt)
 * 
 */
  __pyx_v_self->_xpathCtxt = __pyx_v_xpathCtxt;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":161
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, _eval_arg, **_variables):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_set_context(__pyx_v_self->_context, __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":159
 *                 python.PyThread_free_lock(self._eval_lock)
 * 
 *     cdef set_context(self, xpath.xmlXPathContext* xpathCtxt):             # <<<<<<<<<<<<<<
 *         self._xpathCtxt = xpathCtxt
 *         self._context.set_context(xpathCtxt)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.set_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":163
 *         self._context.set_context(xpathCtxt)
 * 
 *     def evaluate(self, _eval_arg, **_variables):             # <<<<<<<<<<<<<<
 *         u"""evaluate(self, _eval_arg, **_variables)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_19_XPathEvaluatorBase_6evaluate[] = "evaluate(self, _eval_arg, **_variables)\n\n        Evaluate an XPath expression.\n\n        Instead of calling this method, you can also call the evaluator object\n        itself.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n\n        :deprecated: call the object, not its method.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__eval_arg = 0;
  PyObject *__pyx_v__variables = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_eval_arg,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_eval_arg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, pos_args, "evaluate") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__eval_arg = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_6evaluate(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v__eval_arg, __pyx_v__variables);

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

static PyObject *__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase_6evaluate(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, PyObject *__pyx_v__eval_arg, PyObject *__pyx_v__variables) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":176
 *         :deprecated: call the object, not its method.
 *         """
 *         return self(_eval_arg, **_variables)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _checkAbsolutePath(self, char* path):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v__eval_arg);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__eval_arg);
  __Pyx_GIVEREF(__pyx_v__eval_arg);
  __pyx_t_2 = __pyx_v__variables;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 176; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":163
 *         self._context.set_context(xpathCtxt)
 * 
 *     def evaluate(self, _eval_arg, **_variables):             # <<<<<<<<<<<<<<
 *         u"""evaluate(self, _eval_arg, **_variables)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":178
 *         return self(_eval_arg, **_variables)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path):             # <<<<<<<<<<<<<<
 *         cdef char c
 *         if path is NULL:
 */

static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, char *__pyx_v_path) {
  char __pyx_v_c;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_checkAbsolutePath", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":180
 *     cdef bint _checkAbsolutePath(self, char* path):
 *         cdef char c
 *         if path is NULL:             # <<<<<<<<<<<<<<
 *             return 0
 *         c = path[0]
 */
  __pyx_t_1 = ((__pyx_v_path == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":181
 *         cdef char c
 *         if path is NULL:
 *             return 0             # <<<<<<<<<<<<<<
 *         c = path[0]
 *         while c == c' ' or c == c'\t':
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":182
 *         if path is NULL:
 *             return 0
 *         c = path[0]             # <<<<<<<<<<<<<<
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
 */
  __pyx_v_c = (__pyx_v_path[0]);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":183
 *             return 0
 *         c = path[0]
 *         while c == c' ' or c == c'\t':             # <<<<<<<<<<<<<<
 *             path = path + 1
 *             c = path[0]
 */
  while (1) {
    switch (__pyx_v_c) {
      case ' ':
      case '\t':
      __pyx_t_1 = 1;
      break;
      default:
      __pyx_t_1 = 0;
      break;
    }
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":184
 *         c = path[0]
 *         while c == c' ' or c == c'\t':
 *             path = path + 1             # <<<<<<<<<<<<<<
 *             c = path[0]
 *         return c == c'/'
 */
    __pyx_v_path = (__pyx_v_path + 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":185
 *         while c == c' ' or c == c'\t':
 *             path = path + 1
 *             c = path[0]             # <<<<<<<<<<<<<<
 *         return c == c'/'
 * 
 */
    __pyx_v_c = (__pyx_v_path[0]);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":186
 *             path = path + 1
 *             c = path[0]
 *         return c == c'/'             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = (__pyx_v_c == '/');
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":178
 *         return self(_eval_arg, **_variables)
 * 
 *     cdef bint _checkAbsolutePath(self, char* path):             # <<<<<<<<<<<<<<
 *         cdef char c
 *         if path is NULL:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":189
 * 
 *     @cython.final
 *     cdef int _lock(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 */

static int __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  int __pyx_v_result;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_lock", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":191
 *     cdef int _lock(self) except -1:
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(
 */
  if ((ENABLE_THREADING != 0)) {
    __pyx_t_1 = ((__pyx_v_self->_eval_lock != NULL) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = (ENABLE_THREADING != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":192
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":193
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:
 *                 result = python.PyThread_acquire_lock(             # <<<<<<<<<<<<<<
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:
 */
          __pyx_v_result = PyThread_acquire_lock(__pyx_v_self->_eval_lock, WAIT_LOCK);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":192
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":195
 *                 result = python.PyThread_acquire_lock(
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:             # <<<<<<<<<<<<<<
 *                 raise XPathError, u"XPath evaluator locking failed"
 *         return 0
 */
    __pyx_t_2 = ((__pyx_v_result == 0) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":196
 *                     self._eval_lock, python.WAIT_LOCK)
 *             if result == 0:
 *                 raise XPathError, u"XPath evaluator locking failed"             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, __pyx_kp_u_XPath_evaluator_locking_failed, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":197
 *             if result == 0:
 *                 raise XPathError, u"XPath evaluator locking failed"
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":189
 * 
 *     @cython.final
 *     cdef int _lock(self) except -1:             # <<<<<<<<<<<<<<
 *         cdef int result
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._lock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":200
 * 
 *     @cython.final
 *     cdef void _unlock(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)
 */

static void __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_unlock", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":201
 *     @cython.final
 *     cdef void _unlock(self):
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:             # <<<<<<<<<<<<<<
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 */
  if ((ENABLE_THREADING != 0)) {
    __pyx_t_1 = ((__pyx_v_self->_eval_lock != NULL) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = (ENABLE_THREADING != 0);
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":202
 *     cdef void _unlock(self):
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef _raise_parse_error(self):
 */
    PyThread_release_lock(__pyx_v_self->_eval_lock);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":200
 * 
 *     @cython.final
 *     cdef void _unlock(self):             # <<<<<<<<<<<<<<
 *         if config.ENABLE_THREADING and self._eval_lock != NULL:
 *             python.PyThread_release_lock(self._eval_lock)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":204
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _raise_parse_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 */

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_parse_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_entries = 0;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_parse_error", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":206
 *     cdef _raise_parse_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_filter_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 206; __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[18]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 206; __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_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":207
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":208
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(__pyx_v_entries, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_message = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":209
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 raise XPathSyntaxError(message, self._error_log)
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(
 */
    __pyx_t_4 = (__pyx_v_message != Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":210
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathSyntaxError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":211
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Error in xpath expression"),
 *                                self._error_log)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathSyntaxError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_kp_u_Error_in_xpath_expression); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":213
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 *                                self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef _raise_eval_error(self):
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 211; __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_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":211
 *             if message is not None:
 *                 raise XPathSyntaxError(message, self._error_log)
 *         raise XPathSyntaxError(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Error in xpath expression"),
 *                                self._error_log)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[18]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":204
 *             python.PyThread_release_lock(self._eval_lock)
 * 
 *     cdef _raise_parse_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._raise_parse_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF((PyObject *)__pyx_v_entries);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":215
 *                                self._error_log)
 * 
 *     cdef _raise_eval_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 */

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_eval_error(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_entries = 0;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_raise_eval_error", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":217
 *     cdef _raise_eval_error(self):
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)             # <<<<<<<<<<<<<<
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_filter_types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 217; __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[18]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 217; __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_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_entries = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":218
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:             # <<<<<<<<<<<<<<
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":219
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)             # <<<<<<<<<<<<<<
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_filter_types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 219; __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[18]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
    __Pyx_GIVEREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__BaseErrorLog))))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_entries, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":220
 *         if not entries:
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:             # <<<<<<<<<<<<<<
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_entries)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":221
 *             entries = self._error_log.filter_types(_XPATH_SYNTAX_ERRORS)
 *         if entries:
 *             message = entries._buildExceptionMessage(None)             # <<<<<<<<<<<<<<
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(__pyx_v_entries, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":222
 *         if entries:
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:             # <<<<<<<<<<<<<<
 *                 raise XPathEvalError(message, self._error_log)
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(
 */
    __pyx_t_5 = (__pyx_v_message != Py_None);
    __pyx_t_4 = (__pyx_t_5 != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":223
 *             message = entries._buildExceptionMessage(None)
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathEvalError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 223; __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[18]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 223; __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_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":224
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Error in xpath expression"),
 *                              self._error_log)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathEvalError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_kp_u_Error_in_xpath_expression); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":226
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(
 *                 u"Error in xpath expression"),
 *                              self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_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_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":224
 *             if message is not None:
 *                 raise XPathEvalError(message, self._error_log)
 *         raise XPathEvalError(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Error in xpath expression"),
 *                              self._error_log)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 224; __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_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[18]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":215
 *                                self._error_log)
 * 
 *     cdef _raise_eval_error(self):             # <<<<<<<<<<<<<<
 *         cdef _BaseErrorLog entries
 *         entries = self._error_log.filter_types(_XPATH_EVAL_ERRORS)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._raise_eval_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF((PyObject *)__pyx_v_entries);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":228
 *                              self._error_log)
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):             # <<<<<<<<<<<<<<
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
 */

static PyObject *__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *__pyx_v_self, xmlXPathObject *__pyx_v_xpathObj, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_result", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":229
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():             # <<<<<<<<<<<<<<
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 */
  __pyx_t_1 = (((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_context->__pyx_base._exc->__pyx_vtab)->_has_raised(__pyx_v_self->_context->__pyx_base._exc) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":230
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:             # <<<<<<<<<<<<<<
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
 */
    __pyx_t_1 = ((__pyx_v_xpathObj != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":231
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()
 */
      __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":232
 *             if xpathObj is not NULL:
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()
 */
      __pyx_v_xpathObj = NULL;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":233
 *                 _freeXPathObject(xpathObj)
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             self._context._exc._raise_if_stored()
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":234
 *                 xpathObj = NULL
 *             self._context._release_temp_refs()
 *             self._context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *         if xpathObj is NULL:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_self->_context->__pyx_base._exc->__pyx_vtab)->_raise_if_stored(__pyx_v_self->_context->__pyx_base._exc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":236
 *             self._context._exc._raise_if_stored()
 * 
 *         if xpathObj is NULL:             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 *             self._raise_eval_error()
 */
  __pyx_t_1 = ((__pyx_v_xpathObj == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":237
 * 
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 *             self._raise_eval_error()
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":238
 *         if xpathObj is NULL:
 *             self._context._release_temp_refs()
 *             self._raise_eval_error()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self->__pyx_vtab)->_raise_eval_error(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 238; __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:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":240
 *             self._raise_eval_error()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":241
 * 
 *         try:
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)             # <<<<<<<<<<<<<<
 *         finally:
 *             _freeXPathObject(xpathObj)
 */
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_context);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_4lxml_5etree__unwrapXPathObject(__pyx_v_xpathObj, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":243
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 *             _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":244
 *         finally:
 *             _freeXPathObject(xpathObj)
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8;
    }
    /*exception exit:*/{
      __pyx_L7_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":243
 *             result = _unwrapXPathObject(xpathObj, doc, self._context)
 *         finally:
 *             _freeXPathObject(xpathObj)             # <<<<<<<<<<<<<<
 *             self._context._release_temp_refs()
 * 
 */
        __pyx_f_4lxml_5etree__freeXPathObject(__pyx_v_xpathObj);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":244
 *         finally:
 *             _freeXPathObject(xpathObj)
 *             self._context._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
        __pyx_t_4 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L8:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":246
 *             self._context._release_temp_refs()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":228
 *                              self._error_log)
 * 
 *     cdef object _handle_result(self, xpath.xmlXPathObject* xpathObj, _Document doc):             # <<<<<<<<<<<<<<
 *         if self._context._exc._has_raised():
 *             if xpathObj is not NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree._XPathEvaluatorBase._handle_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":263
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_smart_strings,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":264
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         cdef int ns_register_status
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 4)) {
        Py_ssize_t index;
        for (index = 1; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_element = ((struct LxmlElement *)values[0]);
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_element), __pyx_ptype_4lxml_5etree__Element, 0, "element", 0))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v_element, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":263
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_21XPathElementEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  xmlXPathContext *__pyx_v_xpathCtxt;
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":268
 *         cdef int ns_register_status
 *         cdef _Document doc
 *         _assertValidNode(element)             # <<<<<<<<<<<<<<
 *         _assertValidDoc(element._doc)
 *         self._element = element
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":269
 *         cdef _Document doc
 *         _assertValidNode(element)
 *         _assertValidDoc(element._doc)             # <<<<<<<<<<<<<<
 *         self._element = element
 *         doc = element._doc
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":270
 *         _assertValidNode(element)
 *         _assertValidDoc(element._doc)
 *         self._element = element             # <<<<<<<<<<<<<<
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element));
  __Pyx_GOTREF(__pyx_v_self->_element);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_element));
  __pyx_v_self->_element = __pyx_v_element;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":271
 *         _assertValidDoc(element._doc)
 *         self._element = element
 *         doc = element._doc             # <<<<<<<<<<<<<<
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_element->_doc);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":272
 *         self._element = element
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":273
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 */
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 272; __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(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  __Pyx_INCREF(__pyx_v_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":272
 *         self._element = element
 *         doc = element._doc
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":274
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 */
  __pyx_v_xpathCtxt = xmlXPathNewContext(__pyx_v_doc->_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":275
 *                                      regexp, smart_strings)
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 */
  __pyx_t_5 = ((__pyx_v_xpathCtxt == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":276
 *         xpathCtxt = xpath.xmlXPathNewContext(doc._c_doc)
 *         if xpathCtxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":277
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespace(self, prefix, uri):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_context(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":263
 *     """
 *     cdef _Element _element
 *     def __init__(self, _Element element not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

  /* function exit code */
  __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("lxml.etree.XPathElementEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":279
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         u"""Register a namespace with the XPath context.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace[] = "Register a namespace with the XPath context.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prefix = 0;
  PyObject *__pyx_v_uri = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "register_namespace") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_prefix = values[0];
    __pyx_v_uri = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_namespace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespace(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v_prefix, __pyx_v_uri);

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

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_2register_namespace(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespace", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":282
 *         u"""Register a namespace with the XPath context.
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         self._context.addNamespace(prefix, uri)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base._xpathCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_context_not_initialised);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":283
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def register_namespaces(self, namespaces):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base._context->__pyx_base.__pyx_vtab)->__pyx_base.addNamespace(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_base._context), __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":279
 *         self.set_context(xpathCtxt)
 * 
 *     def register_namespace(self, prefix, uri):             # <<<<<<<<<<<<<<
 *         u"""Register a namespace with the XPath context.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":285
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         u"""Register a prefix -> uri dict.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_v_namespaces); /*proto*/
static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces[] = "Register a prefix -> uri dict.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces(PyObject *__pyx_v_self, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_namespaces (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), ((PyObject *)__pyx_v_namespaces));

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

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_4register_namespaces(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v_namespaces) {
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_uri = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_namespaces", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":288
 *         u"""Register a prefix -> uri dict.
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         for prefix, uri in namespaces.items():
 *             self._context.addNamespace(prefix, uri)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base._xpathCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_context_not_initialised);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":289
 *         """
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():             # <<<<<<<<<<<<<<
 *             self._context.addNamespace(prefix, uri)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_namespaces, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":290
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         for prefix, uri in namespaces.items():
 *             self._context.addNamespace(prefix, uri)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _path, **_variables):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__XPathContext *)__pyx_v_self->__pyx_base._context->__pyx_base.__pyx_vtab)->__pyx_base.addNamespace(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->__pyx_base._context), __pyx_v_prefix, __pyx_v_uri); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 290; __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_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":285
 *         self._context.addNamespace(prefix, uri)
 * 
 *     def register_namespaces(self, namespaces):             # <<<<<<<<<<<<<<
 *         u"""Register a prefix -> uri dict.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.register_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":292
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _path, **_variables)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_21XPathElementEvaluator_6__call__[] = "__call__(self, _path, **_variables)\n\n        Evaluate an XPath expression on the document.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n\n        Absolute XPath expressions (starting with '/') will be evaluated\n        against the ElementTree as returned by getroottree().\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v__variables = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__path = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_21XPathElementEvaluator_6__call__(((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self), __pyx_v__path, __pyx_v__variables);

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

static PyObject *__pyx_pf_4lxml_5etree_21XPathElementEvaluator_6__call__(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables) {
  xmlXPathObject *__pyx_v_xpathObj;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_path = NULL;
  const xmlChar *__pyx_v_c_path;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlNode *__pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":305
 *         cdef xpath.xmlXPathObject*  xpathObj
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         path = _utf8(_path)
 *         doc = self._element._doc
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base._xpathCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_context_not_initialised);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":306
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":307
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_element->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":309
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":310
 * 
 *         self._lock()
 *         self._xpathCtxt.node = self._element._c_node             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
 */
  __pyx_t_3 = __pyx_v_self->_element->_c_node;
  __pyx_v_self->__pyx_base._xpathCtxt->node = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":311
 *         self._lock()
 *         self._xpathCtxt.node = self._element._c_node
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":312
 *         self._xpathCtxt.node = self._element._c_node
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":313
 *         try:
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             c_path = _xcstr(path)
 *             with nogil:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":314
 *             self._context.register_context(doc)
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 */
    __pyx_v_c_path = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_path);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":315
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":316
 *             c_path = _xcstr(path)
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathEvalExpression(             # <<<<<<<<<<<<<<
 *                     c_path, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, doc)
 */
          __pyx_v_xpathObj = xmlXPathEvalExpression(__pyx_v_c_path, __pyx_v_self->__pyx_base._xpathCtxt);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":315
 *             self._context.registerVariables(_variables)
 *             c_path = _xcstr(path)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":318
 *                 xpathObj = xpath.xmlXPathEvalExpression(
 *                     c_path, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._context.unregister_context()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":320
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":321
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
      __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_2 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":320
 *             result = self._handle_result(xpathObj, doc)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 * 
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":321
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
        __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":323
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":292
 *             self._context.addNamespace(prefix, uri)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _path, **_variables)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPathElementEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":336
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct LxmlElementTree *__pyx_v_etree = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_smart_strings,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":337
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 4)) {
        Py_ssize_t index;
        for (index = 1; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree = ((struct LxmlElementTree *)values[0]);
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_etree), __pyx_ptype_4lxml_5etree__ElementTree, 0, "etree", 0))) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self), __pyx_v_etree, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":336
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator___init__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, struct LxmlElementTree *__pyx_v_etree, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":338
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(             # <<<<<<<<<<<<<<
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":339
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __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_INCREF(((PyObject *)__pyx_v_etree->_context_node));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_etree->_context_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_etree->_context_node));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":338
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(             # <<<<<<<<<<<<<<
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":339
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":340
 *         XPathElementEvaluator.__init__(
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,             # <<<<<<<<<<<<<<
 *             smart_strings=smart_strings)
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":341
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 *             smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _path, **_variables):
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":338
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(             # <<<<<<<<<<<<<<
 *             self, etree._context_node, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":336
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, _ElementTree etree not None, *, namespaces=None,             # <<<<<<<<<<<<<<
 *                  extensions=None, regexp=True, smart_strings=True):
 *         XPathElementEvaluator.__init__(
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":343
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _path, **_variables)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_22XPathDocumentEvaluator_2__call__[] = "__call__(self, _path, **_variables)\n\n        Evaluate an XPath expression on the document.\n\n        Variables may be provided as keyword arguments.  Note that namespaces\n        are currently not supported for variables.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__path = 0;
  PyObject *__pyx_v__variables = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path_2,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__path = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_2__call__(((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self), __pyx_v__path, __pyx_v__variables);

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

static PyObject *__pyx_pf_4lxml_5etree_22XPathDocumentEvaluator_2__call__(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *__pyx_v_self, PyObject *__pyx_v__path, PyObject *__pyx_v__variables) {
  xmlXPathObject *__pyx_v_xpathObj;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = 0;
  PyObject *__pyx_v_path = NULL;
  const xmlChar *__pyx_v_c_path;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  char const *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":354
 *         cdef xmlDoc* c_doc
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         path = _utf8(_path)
 *         doc = self._element._doc
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base.__pyx_base._xpathCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_context_not_initialised);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":355
 *         cdef _Document doc
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)             # <<<<<<<<<<<<<<
 *         doc = self._element._doc
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v__path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":356
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         path = _utf8(_path)
 *         doc = self._element._doc             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base._element->_doc);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":358
 *         doc = self._element._doc
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         try:
 *             self._context.register_context(doc)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":359
 * 
 *         self._lock()
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":360
 *         self._lock()
 *         try:
 *             self._context.register_context(doc)             # <<<<<<<<<<<<<<
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base.__pyx_base._context, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":361
 *         try:
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)             # <<<<<<<<<<<<<<
 *             try:
 *                 self._context.registerVariables(_variables)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_self->__pyx_base._element->_c_node); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __pyx_v_c_doc = __pyx_t_3;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":362
 *             self._context.register_context(doc)
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:             # <<<<<<<<<<<<<<
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)
 */
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":363
 *             c_doc = _fakeRootDoc(doc._c_doc, self._element._c_node)
 *             try:
 *                 self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *                 c_path = _xcstr(path)
 *                 with nogil:
 */
      __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base.__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":364
 *             try:
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc
 */
      __pyx_v_c_path = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_path);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":365
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":366
 *                 c_path = _xcstr(path)
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 */
            __pyx_v_self->__pyx_base.__pyx_base._xpathCtxt->doc = __pyx_v_c_doc;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":367
 *                 with nogil:
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)             # <<<<<<<<<<<<<<
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
 */
            __pyx_v_self->__pyx_base.__pyx_base._xpathCtxt->node = xmlDocGetRootElement(__pyx_v_c_doc);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":368
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 *                     xpathObj = xpath.xmlXPathEvalExpression(             # <<<<<<<<<<<<<<
 *                         c_path, self._xpathCtxt)
 *                 result = self._handle_result(xpathObj, doc)
 */
            __pyx_v_xpathObj = xmlXPathEvalExpression(__pyx_v_c_path, __pyx_v_self->__pyx_base.__pyx_base._xpathCtxt);
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":365
 *                 self._context.registerVariables(_variables)
 *                 c_path = _xcstr(path)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._xpathCtxt.doc  = c_doc
 *                     self._xpathCtxt.node = tree.xmlDocGetRootElement(c_doc)
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":370
 *                     xpathObj = xpath.xmlXPathEvalExpression(
 *                         c_path, self._xpathCtxt)
 *                 result = self._handle_result(xpathObj, doc)             # <<<<<<<<<<<<<<
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":372
 *                 result = self._handle_result(xpathObj, doc)
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *                 self._context.unregister_context()
 *         finally:
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":373
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._unlock()
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8;
      }
      /*exception exit:*/{
        __pyx_L7_error:;
        __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __pyx_t_2 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
        {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":372
 *                 result = self._handle_result(xpathObj, doc)
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *                 self._context.unregister_context()
 *         finally:
 */
          __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":373
 *             finally:
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *                 self._context.unregister_context()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._unlock()
 */
          __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base.__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
        goto __pyx_L4_error;
        __pyx_L13_error:;
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
        goto __pyx_L4_error;
      }
      __pyx_L8:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":375
 *                 self._context.unregister_context()
 *         finally:
 *             self._unlock()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_lineno; __pyx_t_2 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {
        __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_2; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":377
 *             self._unlock()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":343
 *             smart_strings=smart_strings)
 * 
 *     def __call__(self, _path, **_variables):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _path, **_variables)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPathDocumentEvaluator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":380
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_63XPathEvaluator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_62XPathEvaluator[] = "XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n\n    Creates an XPath evaluator for an ElementTree or an Element.\n\n    The resulting object can be called with an XPath expression as argument\n    and XPath variables provided as keyword arguments.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    ";
static PyMethodDef __pyx_mdef_4lxml_5etree_63XPathEvaluator = {__Pyx_NAMESTR("XPathEvaluator"), (PyCFunction)__pyx_pw_4lxml_5etree_63XPathEvaluator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_62XPathEvaluator)};
static PyObject *__pyx_pw_4lxml_5etree_63XPathEvaluator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree_or_element = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("XPathEvaluator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree_or_element,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_smart_strings,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":381
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,
 *                    regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 * 
 */
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree_or_element)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 4)) {
        Py_ssize_t index;
        for (index = 1; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "XPathEvaluator") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree_or_element = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("XPathEvaluator", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPathEvaluator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_62XPathEvaluator(__pyx_self, __pyx_v_etree_or_element, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":380
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

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

static PyObject *__pyx_pf_4lxml_5etree_62XPathEvaluator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_etree_or_element, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("XPathEvaluator", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":395
 *     you pass ``smart_strings=False``.
 *     """
 *     if isinstance(etree_or_element, _ElementTree):             # <<<<<<<<<<<<<<
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_etree_or_element, ((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":396
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":397
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_etree_or_element);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_etree_or_element);
    __Pyx_GIVEREF(__pyx_v_etree_or_element);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":396
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":397
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 */
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":398
 *         return XPathDocumentEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 *     else:
 *         return XPathElementEvaluator(
 */
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":396
 *     """
 *     if isinstance(etree_or_element, _ElementTree):
 *         return XPathDocumentEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathDocumentEvaluator)), __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":400
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":401
 *     else:
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 * 
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_etree_or_element);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_etree_or_element);
    __Pyx_GIVEREF(__pyx_v_etree_or_element);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":400
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":401
 *     else:
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 * 
 */
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":402
 *         return XPathElementEvaluator(
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":400
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 *     else:
 *         return XPathElementEvaluator(             # <<<<<<<<<<<<<<
 *             etree_or_element, namespaces=namespaces,
 *             extensions=extensions, regexp=regexp, smart_strings=smart_strings)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPathElementEvaluator)), __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":380
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XPathEvaluator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":419
 *     cdef xpath.xmlXPathCompExpr* _xpath
 *     cdef bytes _path
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpath = NULL
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_5XPath___cinit__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":420
 *     cdef bytes _path
 *     def __cinit__(self):
 *         self._xpath = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 */
  __pyx_v_self->_xpath = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":419
 *     cdef xpath.xmlXPathCompExpr* _xpath
 *     cdef bytes _path
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xpath = NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":422
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_5XPath_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_5XPath_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_smart_strings,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":423
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,
 *                  regexp=True, smart_strings=True):             # <<<<<<<<<<<<<<
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 */
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 4)) {
        Py_ssize_t index;
        for (index = 1; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_path = values[0];
    __pyx_v_namespaces = values[1];
    __pyx_v_extensions = values[2];
    __pyx_v_regexp = values[3];
    __pyx_v_smart_strings = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_2__init__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self), __pyx_v_path, __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":422
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

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

static int __pyx_pf_4lxml_5etree_5XPath_2__init__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  xmlXPathContext *__pyx_v_xpathCtxt;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":425
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XPathEvaluatorBase)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":426
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)             # <<<<<<<<<<<<<<
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 */
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 425; __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_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  __Pyx_INCREF(__pyx_v_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_smart_strings);
  __Pyx_GIVEREF(__pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":425
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,             # <<<<<<<<<<<<<<
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 425; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":427
 *         _XPathEvaluatorBase.__init__(self, namespaces, extensions,
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)             # <<<<<<<<<<<<<<
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_path);
  __Pyx_DECREF(__pyx_v_self->_path);
  __pyx_v_self->_path = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":428
 *                                      regexp, smart_strings)
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)             # <<<<<<<<<<<<<<
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 */
  __pyx_v_xpathCtxt = xmlXPathNewContext(NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":429
 *         self._path = _utf8(path)
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 */
  __pyx_t_4 = ((__pyx_v_xpathCtxt == NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":430
 *         xpathCtxt = xpath.xmlXPathNewContext(NULL)
 *         if xpathCtxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":431
 *         if xpathCtxt is NULL:
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_context(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathCtxt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":432
 *             raise MemoryError()
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))             # <<<<<<<<<<<<<<
 *         if self._xpath is NULL:
 *             self._raise_parse_error()
 */
  __pyx_t_3 = __pyx_v_self->_path;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_self->_xpath = xmlXPathCtxtCompile(__pyx_v_xpathCtxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_t_3));
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":433
 *         self.set_context(xpathCtxt)
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:             # <<<<<<<<<<<<<<
 *             self._raise_parse_error()
 * 
 */
  __pyx_t_4 = ((__pyx_v_self->_xpath == NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":434
 *         self._xpath = xpath.xmlXPathCtxtCompile(xpathCtxt, _xcstr(self._path))
 *         if self._xpath is NULL:
 *             self._raise_parse_error()             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _etree_or_element, **_variables):
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._raise_parse_error(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":422
 *         self._xpath = NULL
 * 
 *     def __init__(self, path, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                  regexp=True, smart_strings=True):
 *         cdef xpath.xmlXPathContext* xpathCtxt
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.XPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":436
 *             self._raise_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         u"__call__(self, _etree_or_element, **_variables)"
 *         cdef xpath.xmlXPathObject*  xpathObj
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5XPath_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_5XPath_4__call__[] = "__call__(self, _etree_or_element, **_variables)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_5XPath_4__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_5XPath_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__etree_or_element = 0;
  PyObject *__pyx_v__variables = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  __pyx_v__variables = PyDict_New(); if (unlikely(!__pyx_v__variables)) return NULL;
  __Pyx_GOTREF(__pyx_v__variables);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree_or_element_2,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree_or_element_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v__variables, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__etree_or_element = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v__variables); __pyx_v__variables = 0;
  __Pyx_AddTraceback("lxml.etree.XPath.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_4__call__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self), __pyx_v__etree_or_element, __pyx_v__variables);

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

static PyObject *__pyx_pf_4lxml_5etree_5XPath_4__call__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self, PyObject *__pyx_v__etree_or_element, PyObject *__pyx_v__variables) {
  xmlXPathObject *__pyx_v_xpathObj;
  struct LxmlDocument *__pyx_v_document = 0;
  struct LxmlElement *__pyx_v_element = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  xmlNode *__pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":442
 *         cdef _Element element
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"             # <<<<<<<<<<<<<<
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->__pyx_base._xpathCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_context_not_initialised);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":443
 * 
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_document = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":444
 *         assert self._xpathCtxt is not NULL, "XPath context not initialised"
 *         document = _documentOrRaise(_etree_or_element)
 *         element  = _rootNodeOrRaise(_etree_or_element)             # <<<<<<<<<<<<<<
 * 
 *         self._lock()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__etree_or_element)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_element = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":446
 *         element  = _rootNodeOrRaise(_etree_or_element)
 * 
 *         self._lock()             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":447
 * 
 *         self._lock()
 *         self._xpathCtxt.doc  = document._c_doc             # <<<<<<<<<<<<<<
 *         self._xpathCtxt.node = element._c_node
 * 
 */
  __pyx_t_3 = __pyx_v_document->_c_doc;
  __pyx_v_self->__pyx_base._xpathCtxt->doc = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":448
 *         self._lock()
 *         self._xpathCtxt.doc  = document._c_doc
 *         self._xpathCtxt.node = element._c_node             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_4 = __pyx_v_element->_c_node;
  __pyx_v_self->__pyx_base._xpathCtxt->node = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":450
 *         self._xpathCtxt.node = element._c_node
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":451
 * 
 *         try:
 *             self._context.register_context(document)             # <<<<<<<<<<<<<<
 *             self._context.registerVariables(_variables)
 *             with nogil:
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_register_context(__pyx_v_self->__pyx_base._context, __pyx_v_document); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":452
 *         try:
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_registerVariables(__pyx_v_self->__pyx_base._context, __pyx_v__variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":453
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":454
 *             self._context.registerVariables(_variables)
 *             with nogil:
 *                 xpathObj = xpath.xmlXPathCompiledEval(             # <<<<<<<<<<<<<<
 *                     self._xpath, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, document)
 */
          __pyx_v_xpathObj = xmlXPathCompiledEval(__pyx_v_self->_xpath, __pyx_v_self->__pyx_base._xpathCtxt);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":453
 *             self._context.register_context(document)
 *             self._context.registerVariables(_variables)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":456
 *                 xpathObj = xpath.xmlXPathCompiledEval(
 *                     self._xpath, self._xpathCtxt)
 *             result = self._handle_result(xpathObj, document)             # <<<<<<<<<<<<<<
 *         finally:
 *             self._context.unregister_context()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_XPath *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._handle_result(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self), __pyx_v_xpathObj, __pyx_v_document); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":458
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":459
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
      __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_2 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":458
 *             result = self._handle_result(xpathObj, document)
 *         finally:
 *             self._context.unregister_context()             # <<<<<<<<<<<<<<
 *             self._unlock()
 *         return result
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_13_XPathContext_unregister_context(__pyx_v_self->__pyx_base._context); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":459
 *         finally:
 *             self._context.unregister_context()
 *             self._unlock()             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
        __pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock(((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)__pyx_v_self));
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L10_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":460
 *             self._context.unregister_context()
 *             self._unlock()
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     property path:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":436
 *             self._raise_parse_error()
 * 
 *     def __call__(self, _etree_or_element, **_variables):             # <<<<<<<<<<<<<<
 *         u"__call__(self, _etree_or_element, **_variables)"
 *         cdef xpath.xmlXPathObject*  xpathObj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_document);
  __Pyx_XDECREF((PyObject *)__pyx_v_element);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":465
 *         u"""The literal XPath expression.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._path.decode(u'UTF-8')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5XPath_4path_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5XPath_4path_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_4path___get__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_5XPath_4path___get__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":466
 *         """
 *         def __get__(self):
 *             return self._path.decode(u'UTF-8')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_path == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_self->_path, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":465
 *         u"""The literal XPath expression.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._path.decode(u'UTF-8')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":468
 *             return self._path.decode(u'UTF-8')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_5XPath_6__dealloc__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":469
 * 
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:             # <<<<<<<<<<<<<<
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_xpath != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":470
 *     def __dealloc__(self):
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    xmlXPathFreeCompExpr(__pyx_v_self->_xpath);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":468
 *             return self._path.decode(u'UTF-8')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xpath is not NULL:
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":472
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.path
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_5XPath_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_5XPath_9__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_5XPath_8__repr__(((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_5XPath_8__repr__(struct __pyx_obj_4lxml_5etree_XPath *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":473
 * 
 *     def __repr__(self):
 *         return self.path             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":472
 *             xpath.xmlXPathFreeCompExpr(self._xpath)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.path
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XPath.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":490
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7ETXPath_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7ETXPath_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_smart_strings,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":491
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):             # <<<<<<<<<<<<<<
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,
 */
    values[3] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 3)) {
        Py_ssize_t index;
        for (index = 1; index < 4 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_path = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_regexp = values[2];
    __pyx_v_smart_strings = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[18]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.ETXPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7ETXPath___init__(((struct __pyx_obj_4lxml_5etree_ETXPath *)__pyx_v_self), __pyx_v_path, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":490
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 */

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

static int __pyx_pf_4lxml_5etree_7ETXPath___init__(struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_smart_strings) {
  PyObject *__pyx_v_namespaces = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":492
 *     def __init__(self, path, *, extensions=None, regexp=True,
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)             # <<<<<<<<<<<<<<
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree_ETXPath *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_nsextract_path(__pyx_v_self, __pyx_v_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[18]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_namespaces = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":493
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __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[18]; __pyx_lineno = 493; __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(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_namespaces, __pyx_v_namespaces) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":494
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,             # <<<<<<<<<<<<<<
 *                        smart_strings=smart_strings)
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_extensions, __pyx_v_extensions) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_regexp, __pyx_v_regexp) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":495
 *         XPath.__init__(self, path, namespaces=namespaces,
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef _nsextract_path(self, path):
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_smart_strings, __pyx_v_smart_strings) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":493
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 *         XPath.__init__(self, path, namespaces=namespaces,             # <<<<<<<<<<<<<<
 *                        extensions=extensions, regexp=regexp,
 *                        smart_strings=smart_strings)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":490
 *     you pass ``smart_strings=False``.
 *     """
 *     def __init__(self, path, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  smart_strings=True):
 *         path, namespaces = self._nsextract_path(path)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.ETXPath.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":497
 *                        smart_strings=smart_strings)
 * 
 *     cdef _nsextract_path(self, path):             # <<<<<<<<<<<<<<
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
 */

static PyObject *__pyx_f_4lxml_5etree_7ETXPath__nsextract_path(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_ETXPath *__pyx_v_self, PyObject *__pyx_v_path) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_namespace_defs = 0;
  int __pyx_v_i;
  PyObject *__pyx_v_path_utf = NULL;
  PyObject *__pyx_v_stripped_path = NULL;
  PyObject *__pyx_v_namespace_def = NULL;
  PyObject *__pyx_v_prefix = NULL;
  PyObject *__pyx_v_namespace = NULL;
  PyObject *__pyx_v_prefix_str = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_nsextract_path", 0);
  __Pyx_INCREF(__pyx_v_path);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":499
 *     cdef _nsextract_path(self, path):
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}             # <<<<<<<<<<<<<<
 *         cdef list namespace_defs = []
 *         cdef int i
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespaces = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":500
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
 *         cdef list namespace_defs = []             # <<<<<<<<<<<<<<
 *         cdef int i
 *         path_utf = _utf8(path)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_namespace_defs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":502
 *         cdef list namespace_defs = []
 *         cdef int i
 *         path_utf = _utf8(path)             # <<<<<<<<<<<<<<
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path_utf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":503
 *         cdef int i
 *         path_utf = _utf8(path)
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals             # <<<<<<<<<<<<<<
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_b__15);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_b__15);
  __Pyx_GIVEREF(__pyx_kp_b__15);
  __Pyx_INCREF(__pyx_v_path_utf);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_path_utf);
  __Pyx_GIVEREF(__pyx_v_path_utf);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__replace_strings, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_stripped_path = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":504
 *         path_utf = _utf8(path)
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1             # <<<<<<<<<<<<<<
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:
 */
  __pyx_v_i = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":505
 *         stripped_path = _replace_strings(b'', path_utf) # remove string literals
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):             # <<<<<<<<<<<<<<
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_stripped_path);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stripped_path);
  __Pyx_GIVEREF(__pyx_v_stripped_path);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__find_namespaces, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[18]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_namespace_def, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":506
 *         i = 1
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:             # <<<<<<<<<<<<<<
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
 */
    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_namespace_def, __pyx_v_namespace_defs, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":507
 *         for namespace_def in _find_namespaces(stripped_path):
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 */
      __pyx_t_1 = PyBytes_FromFormat(__pyx_k_xpp_02d, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":508
 *             if namespace_def not in namespace_defs:
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":509
 *                 prefix = python.PyBytes_FromFormat("__xpp%02d", i)
 *                 i += 1
 *                 namespace_defs.append(namespace_def)             # <<<<<<<<<<<<<<
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = (<bytes>namespace).decode('utf8')
 */
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_namespace_defs, __pyx_v_namespace_def); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":510
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'             # <<<<<<<<<<<<<<
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace
 */
      __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_namespace_def, 1, -1, NULL, NULL, &__pyx_slice__90, 1, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_namespace, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":511
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = (<bytes>namespace).decode('utf8')             # <<<<<<<<<<<<<<
 *                 namespaces[prefix.decode('utf8')] = namespace
 *                 prefix_str = prefix + b':'
 */
      if (unlikely(__pyx_v_namespace == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
        {__pyx_filename = __pyx_f[18]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_decode_bytes(((PyObject*)__pyx_v_namespace), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_namespace, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":512
 *                 namespace = namespace_def[1:-1] # remove '{}'
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace             # <<<<<<<<<<<<<<
 *                 prefix_str = prefix + b':'
 *                 # FIXME: this also replaces {namespaces} within strings!
 */
      if (unlikely(__pyx_v_prefix == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode");
        {__pyx_filename = __pyx_f[18]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_prefix, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(PyDict_SetItem(__pyx_v_namespaces, __pyx_t_1, __pyx_v_namespace) < 0)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":513
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace
 *                 prefix_str = prefix + b':'             # <<<<<<<<<<<<<<
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 */
      __pyx_t_1 = PyNumber_Add(__pyx_v_prefix, __pyx_kp_b__60); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_prefix_str, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":515
 *                 prefix_str = prefix + b':'
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)             # <<<<<<<<<<<<<<
 *         path = path_utf.decode('utf8')
 *         return path, namespaces
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_path_utf, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_namespace_def);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_namespace_def);
      __Pyx_GIVEREF(__pyx_v_namespace_def);
      __Pyx_INCREF(__pyx_v_prefix_str);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_prefix_str);
      __Pyx_GIVEREF(__pyx_v_prefix_str);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_path_utf, __pyx_t_9);
      __pyx_t_9 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":516
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = path_utf.decode('utf8')             # <<<<<<<<<<<<<<
 *         return path, namespaces
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_path_utf, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_9);
  __pyx_t_9 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":517
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = path_utf.decode('utf8')
 *         return path, namespaces             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":497
 *                        smart_strings=smart_strings)
 * 
 *     cdef _nsextract_path(self, path):             # <<<<<<<<<<<<<<
 *         # replace {namespaces} by new prefixes
 *         cdef dict namespaces = {}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree.ETXPath._nsextract_path", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_namespaces);
  __Pyx_XDECREF(__pyx_v_namespace_defs);
  __Pyx_XDECREF(__pyx_v_path_utf);
  __Pyx_XDECREF(__pyx_v_stripped_path);
  __Pyx_XDECREF(__pyx_v_namespace_def);
  __Pyx_XDECREF(__pyx_v_prefix);
  __Pyx_XDECREF(__pyx_v_namespace);
  __Pyx_XDECREF(__pyx_v_prefix_str);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":56
 *     cdef _BaseParser _parser
 * 
 *     cdef _XSLTResolverContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()
 */

static struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  xmlDoc *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":58
 *     cdef _XSLTResolverContext _copy(self):
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()             # <<<<<<<<<<<<<<
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTResolverContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":59
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()
 *         _initXSLTResolverContext(context, self._parser)             # <<<<<<<<<<<<<<
 *         context._c_style_doc = self._c_style_doc
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__initXSLTResolverContext(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":60
 *         context = _XSLTResolverContext()
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_3 = __pyx_v_self->_c_style_doc;
  __pyx_v_context->_c_style_doc = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":61
 *         _initXSLTResolverContext(context, self._parser)
 *         context._c_style_doc = self._c_style_doc
 *         return context             # <<<<<<<<<<<<<<
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":56
 *     cdef _BaseParser _parser
 * 
 *     cdef _XSLTResolverContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTResolverContext context
 *         context = _XSLTResolverContext()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTResolverContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":63
 *         return context
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,             # <<<<<<<<<<<<<<
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
 */

static PyObject *__pyx_f_4lxml_5etree__initXSLTResolverContext(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context, struct __pyx_obj_4lxml_5etree__BaseParser *__pyx_v_parser) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_initXSLTResolverContext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":65
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)             # <<<<<<<<<<<<<<
 *     context._parser = parser
 *     context._c_style_doc = NULL
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_parser), __pyx_n_s_resolvers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ResolverRegistry))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __pyx_f_4lxml_5etree__initResolverContext(((struct __pyx_obj_4lxml_5etree__ResolverContext *)__pyx_v_context), ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":66
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
 *     context._parser = parser             # <<<<<<<<<<<<<<
 *     context._c_style_doc = NULL
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parser));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
  __Pyx_GOTREF(__pyx_v_context->_parser);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_parser));
  __pyx_v_context->_parser = __pyx_v_parser;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":67
 *     _initResolverContext(context, parser.resolvers)
 *     context._parser = parser
 *     context._c_style_doc = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(const_xmlChar* c_uri, void* c_context,
 */
  __pyx_v_context->_c_style_doc = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":63
 *         return context
 * 
 * cdef _initXSLTResolverContext(_XSLTResolverContext context,             # <<<<<<<<<<<<<<
 *                               _BaseParser parser):
 *     _initResolverContext(context, parser.resolvers)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._initXSLTResolverContext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":69
 *     context._c_style_doc = NULL
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(const_xmlChar* c_uri, void* c_context,             # <<<<<<<<<<<<<<
 *                                        int parse_options, int* error) with gil:
 *     # call the Python document loaders
 */

static xmlDoc *__pyx_f_4lxml_5etree__xslt_resolve_from_python(const xmlChar *__pyx_v_c_uri, void *__pyx_v_c_context, CYTHON_UNUSED int __pyx_v_parse_options, int *__pyx_v_error) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *__pyx_v_resolvers = 0;
  struct __pyx_obj_4lxml_5etree__InputDocument *__pyx_v_doc_ref = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlDoc *__pyx_v_c_return_doc;
  PyObject *__pyx_v_uri = NULL;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xslt_resolve_from_python", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":76
 *     cdef _InputDocument doc_ref
 *     cdef xmlDoc* c_doc
 *     cdef xmlDoc* c_return_doc = NULL             # <<<<<<<<<<<<<<
 * 
 *     error[0] = 0
 */
  __pyx_v_c_return_doc = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":78
 *     cdef xmlDoc* c_return_doc = NULL
 * 
 *     error[0] = 0             # <<<<<<<<<<<<<<
 *     context = <_XSLTResolverContext>c_context
 * 
 */
  (__pyx_v_error[0]) = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":79
 * 
 *     error[0] = 0
 *     context = <_XSLTResolverContext>c_context             # <<<<<<<<<<<<<<
 * 
 *     # shortcut if we resolve the stylesheet itself
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_c_context);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":82
 * 
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc             # <<<<<<<<<<<<<<
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 */
  __pyx_t_2 = __pyx_v_context->_c_style_doc;
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":83
 *     # shortcut if we resolve the stylesheet itself
 *     c_doc = context._c_style_doc
 *     try:             # <<<<<<<<<<<<<<
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":84
 *     c_doc = context._c_style_doc
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:             # <<<<<<<<<<<<<<
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)
 */
        __pyx_t_6 = ((__pyx_v_c_doc != NULL) != 0);
        if (__pyx_t_6) {
          __pyx_t_7 = ((__pyx_v_c_doc->URL != NULL) != 0);
          __pyx_t_8 = __pyx_t_7;
        } else {
          __pyx_t_8 = __pyx_t_6;
        }
        if (__pyx_t_8) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":85
 *     try:
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _copyDoc(c_doc, 1)
 *                 return c_return_doc  # 'goto', see 'finally' below
 */
          __pyx_t_8 = ((xmlStrcmp(__pyx_v_c_uri, __pyx_v_c_doc->URL) == 0) != 0);
          if (__pyx_t_8) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":86
 *         if c_doc is not NULL and c_doc.URL is not NULL:
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *                 return c_return_doc  # 'goto', see 'finally' below
 * 
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __pyx_v_c_return_doc = __pyx_t_2;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":87
 *             if tree.xmlStrcmp(c_uri, c_doc.URL) == 0:
 *                 c_return_doc = _copyDoc(c_doc, 1)
 *                 return c_return_doc  # 'goto', see 'finally' below             # <<<<<<<<<<<<<<
 * 
 *         # delegate to the Python resolvers
 */
            __pyx_r = __pyx_v_c_return_doc;
            goto __pyx_L10_try_return;
          }
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":90
 * 
 *         # delegate to the Python resolvers
 *         resolvers = context._resolvers             # <<<<<<<<<<<<<<
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26
 */
        __pyx_t_1 = ((PyObject *)__pyx_v_context->__pyx_base._resolvers);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_v_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":91
 *         # delegate to the Python resolvers
 *         resolvers = context._resolvers
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:             # <<<<<<<<<<<<<<
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
 */
        __pyx_t_8 = ((xmlStrncmp(((unsigned char *)((unsigned char *)__pyx_k_string___STRING__XSLT_2)), __pyx_v_c_uri, 26) == 0) != 0);
        if (__pyx_t_8) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":92
 *         resolvers = context._resolvers
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26             # <<<<<<<<<<<<<<
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)
 */
          __pyx_v_c_uri = (__pyx_v_c_uri + 26);
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":93
 *         if tree.xmlStrncmp(<unsigned char*>'string://__STRING__XSLT__/', c_uri, 26) == 0:
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)             # <<<<<<<<<<<<<<
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_uri = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":94
 *             c_uri += 26
 *         uri = _decodeFilename(c_uri)
 *         doc_ref = resolvers.resolve(uri, None, context)             # <<<<<<<<<<<<<<
 * 
 *         if doc_ref is not None:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_resolvers), __pyx_n_s_resolve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_v_uri);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_uri);
        __Pyx_GIVEREF(__pyx_v_uri);
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_9, 1, Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_INCREF(((PyObject *)__pyx_v_context));
        PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_v_context));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_4lxml_5etree__InputDocument))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __pyx_v_doc_ref = ((struct __pyx_obj_4lxml_5etree__InputDocument *)__pyx_t_10);
        __pyx_t_10 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":96
 *         doc_ref = resolvers.resolve(uri, None, context)
 * 
 *         if doc_ref is not None:             # <<<<<<<<<<<<<<
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(
 */
        __pyx_t_8 = (((PyObject *)__pyx_v_doc_ref) != Py_None);
        __pyx_t_6 = (__pyx_t_8 != 0);
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":106
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 */
          switch (__pyx_v_doc_ref->_type) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":97
 * 
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 */
            case __pyx_e_4lxml_5etree_PARSER_DATA_STRING:

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":99
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_return_doc = _parseDocFromFile(
 */
            __pyx_t_10 = __pyx_v_doc_ref->_data_bytes;
            __Pyx_INCREF(__pyx_t_10);
            __pyx_t_9 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_9);
            __pyx_t_1 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_1);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":98
 *         if doc_ref is not None:
 *             if doc_ref._type == PARSER_DATA_STRING:
 *                 c_return_doc = _parseDoc(             # <<<<<<<<<<<<<<
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree__parseDoc(__pyx_t_10, __pyx_t_9, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;
            break;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":100
 *                 c_return_doc = _parseDoc(
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDocFromFile(
 *                     doc_ref._filename, context._parser)
 */
            case __pyx_e_4lxml_5etree_PARSER_DATA_FILENAME:

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":102
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_return_doc = _parseDocFromFile(
 *                     doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_return_doc = _parseDocFromFilelike(
 */
            __pyx_t_1 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_9 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_9);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":101
 *                     doc_ref._data_bytes, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILENAME:
 *                 c_return_doc = _parseDocFromFile(             # <<<<<<<<<<<<<<
 *                     doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree__parseDocFromFile(__pyx_t_1, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_9)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;
            break;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":103
 *                 c_return_doc = _parseDocFromFile(
 *                     doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
 */
            case __pyx_e_4lxml_5etree_PARSER_DATA_FILE:

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":105
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)             # <<<<<<<<<<<<<<
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()
 */
            __pyx_t_9 = __pyx_v_doc_ref->_file;
            __Pyx_INCREF(__pyx_t_9);
            __pyx_t_1 = __pyx_v_doc_ref->_filename;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_10 = ((PyObject *)__pyx_v_context->_parser);
            __Pyx_INCREF(__pyx_t_10);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":104
 *                     doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_FILE:
 *                 c_return_doc = _parseDocFromFilelike(             # <<<<<<<<<<<<<<
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree__parseDocFromFilelike(__pyx_t_9, __pyx_t_1, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_10)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_v_c_return_doc = __pyx_t_2;
            break;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":106
 *                 c_return_doc = _parseDocFromFilelike(
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:             # <<<<<<<<<<<<<<
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 */
            case __pyx_e_4lxml_5etree_PARSER_DATA_EMPTY:

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":107
 *                     doc_ref._file, doc_ref._filename, context._parser)
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()             # <<<<<<<<<<<<<<
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 */
            __pyx_t_2 = __pyx_f_4lxml_5etree__newXMLDoc(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __pyx_v_c_return_doc = __pyx_t_2;
            break;
            default: break;
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":108
 *             elif doc_ref._type == PARSER_DATA_EMPTY:
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:
 */
          __pyx_t_6 = ((__pyx_v_c_return_doc != NULL) != 0);
          if (__pyx_t_6) {
            __pyx_t_8 = ((__pyx_v_c_return_doc->URL == NULL) != 0);
            __pyx_t_7 = __pyx_t_8;
          } else {
            __pyx_t_7 = __pyx_t_6;
          }
          if (__pyx_t_7) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":109
 *                 c_return_doc = _newXMLDoc()
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)             # <<<<<<<<<<<<<<
 *     except:
 *         error[0] = 1
 */
            __pyx_v_c_return_doc->URL = xmlStrdup(__pyx_v_c_uri);
            goto __pyx_L18;
          }
          __pyx_L18:;
          goto __pyx_L17;
        }
        __pyx_L17:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":110
 *             if c_return_doc is not NULL and c_return_doc.URL is NULL:
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:             # <<<<<<<<<<<<<<
 *         error[0] = 1
 *         context._store_raised()
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._xslt_resolve_from_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_1, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_9);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":111
 *                 c_return_doc.URL = tree.xmlStrdup(c_uri)
 *     except:
 *         error[0] = 1             # <<<<<<<<<<<<<<
 *         context._store_raised()
 *     finally:
 */
        (__pyx_v_error[0]) = 1;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":112
 *     except:
 *         error[0] = 1
 *         context._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return c_return_doc  # and swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._store_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_context));
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_exception_handled;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L4_error;
      __pyx_L10_try_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L3_return;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L13_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":114
 *         context._store_raised()
 *     finally:
 *         return c_return_doc  # and swallow any further exceptions             # <<<<<<<<<<<<<<
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_r = __pyx_v_c_return_doc;
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      {
        __pyx_r = __pyx_v_c_return_doc;
        goto __pyx_L21_return;
      }
      __pyx_L21_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L0;
    }
    __pyx_L3_return: {
      __pyx_r = __pyx_v_c_return_doc;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":69
 *     context._c_style_doc = NULL
 * 
 * cdef xmlDoc* _xslt_resolve_from_python(const_xmlChar* c_uri, void* c_context,             # <<<<<<<<<<<<<<
 *                                        int parse_options, int* error) with gil:
 *     # call the Python document loaders
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_resolvers);
  __Pyx_XDECREF((PyObject *)__pyx_v_doc_ref);
  __Pyx_XDECREF(__pyx_v_uri);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":116
 *         return c_return_doc  # and swallow any further exceptions
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:
 */

static void __pyx_f_4lxml_5etree__xslt_store_resolver_exception(const xmlChar *__pyx_v_c_uri, void *__pyx_v_context, xsltLoadType __pyx_v_c_type) {
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_v_exception = NULL;
  PyObject *__pyx_v_e = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_xslt_store_resolver_exception", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":118
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:             # <<<<<<<<<<<<<<
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":119
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)             # <<<<<<<<<<<<<<
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__decodeFilename(__pyx_v_c_uri); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_Cannot_resolve_URI_s, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_message = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":120
 *     try:
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *             exception = XSLTApplyError(message)
 *         else:
 */
      __pyx_t_6 = ((__pyx_v_c_type == XSLT_LOAD_DOCUMENT) != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":121
 *         message = u"Cannot resolve URI %s" % _decodeFilename(c_uri)
 *         if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *             exception = XSLTApplyError(message)             # <<<<<<<<<<<<<<
 *         else:
 *             exception = XSLTParseError(message)
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTApplyError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_message);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_message);
        __Pyx_GIVEREF(__pyx_v_message);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_exception = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":123
 *             exception = XSLTApplyError(message)
 *         else:
 *             exception = XSLTParseError(message)             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTParseError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_message);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_message);
        __Pyx_GIVEREF(__pyx_v_message);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_exception = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __pyx_L11:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":124
 *         else:
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)             # <<<<<<<<<<<<<<
 *     except BaseException as e:
 *         (<_XSLTResolverContext>context)._store_exception(e)
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._store_exception(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)), __pyx_v_exception);
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":125
 *             exception = XSLTParseError(message)
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:             # <<<<<<<<<<<<<<
 *         (<_XSLTResolverContext>context)._store_exception(e)
 * 
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_BaseException);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("lxml.etree._xslt_store_resolver_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_e = __pyx_t_4;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":126
 *         (<_XSLTResolverContext>context)._store_exception(exception)
 *     except BaseException as e:
 *         (<_XSLTResolverContext>context)._store_exception(e)             # <<<<<<<<<<<<<<
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._store_exception(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_v_context)), __pyx_v_e);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":116
 *         return c_return_doc  # and swallow any further exceptions
 * 
 * cdef void _xslt_store_resolver_exception(const_xmlChar* c_uri, void* context,             # <<<<<<<<<<<<<<
 *                                          xslt.xsltLoadType c_type) with gil:
 *     try:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("lxml.etree._xslt_store_resolver_exception", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_exception);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":128
 *         (<_XSLTResolverContext>context)._store_exception(e)
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) nogil:
 */

static xmlDoc *__pyx_f_4lxml_5etree__xslt_doc_loader(const xmlChar *__pyx_v_c_uri, xmlDict *__pyx_v_c_dict, int __pyx_v_parse_options, void *__pyx_v_c_ctxt, xsltLoadType __pyx_v_c_type) {
  xmlDoc *__pyx_v_c_doc;
  void *__pyx_v_c_pcontext;
  int __pyx_v_error;
  xmlDoc *__pyx_r;
  void *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":135
 *     cdef xmlDoc* result
 *     cdef void* c_pcontext
 *     cdef int error = 0             # <<<<<<<<<<<<<<
 *     # find resolver contexts of stylesheet and transformed doc
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:
 */
  __pyx_v_error = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":140
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
 */
  switch (__pyx_v_c_type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":137
 *     cdef int error = 0
 *     # find resolver contexts of stylesheet and transformed doc
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:             # <<<<<<<<<<<<<<
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
 */
    case XSLT_LOAD_DOCUMENT:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":139
 *     if c_type == xslt.XSLT_LOAD_DOCUMENT:
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private             # <<<<<<<<<<<<<<
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         # include/import resolution while parsing
 */
    __pyx_t_1 = ((xsltTransformContext *)__pyx_v_c_ctxt)->_private;
    __pyx_v_c_pcontext = __pyx_t_1;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":140
 *         # transformation time
 *         c_pcontext = (<xslt.xsltTransformContext*>c_ctxt)._private
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
 */
    case XSLT_LOAD_STYLESHEET:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":142
 *     elif c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         # include/import resolution while parsing
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private             # <<<<<<<<<<<<<<
 *     else:
 *         c_pcontext = NULL
 */
    __pyx_t_1 = ((xsltStylesheet *)__pyx_v_c_ctxt)->doc->_private;
    __pyx_v_c_pcontext = __pyx_t_1;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":144
 *         c_pcontext = (<xslt.xsltStylesheet*>c_ctxt).doc._private
 *     else:
 *         c_pcontext = NULL             # <<<<<<<<<<<<<<
 * 
 *     if c_pcontext is NULL:
 */
    __pyx_v_c_pcontext = NULL;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":146
 *         c_pcontext = NULL
 * 
 *     if c_pcontext is NULL:             # <<<<<<<<<<<<<<
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(
 */
  __pyx_t_2 = ((__pyx_v_c_pcontext == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":148
 *     if c_pcontext is NULL:
 *         # can't call Python without context, fall back to default loader
 *         return XSLT_DOC_DEFAULT_LOADER(             # <<<<<<<<<<<<<<
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 * 
 */
    __pyx_r = __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER(__pyx_v_c_uri, __pyx_v_c_dict, __pyx_v_parse_options, __pyx_v_c_ctxt, __pyx_v_c_type);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":151
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)             # <<<<<<<<<<<<<<
 *     if c_doc is NULL and not error:
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 */
  __pyx_v_c_doc = __pyx_f_4lxml_5etree__xslt_resolve_from_python(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_parse_options, (&__pyx_v_error));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":152
 * 
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 *     if c_doc is NULL and not error:             # <<<<<<<<<<<<<<
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 */
  __pyx_t_2 = ((__pyx_v_c_doc == NULL) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((!(__pyx_v_error != 0)) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":153
 *     c_doc = _xslt_resolve_from_python(c_uri, c_pcontext, parse_options, &error)
 *     if c_doc is NULL and not error:
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(             # <<<<<<<<<<<<<<
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:
 */
    __pyx_v_c_doc = __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER(__pyx_v_c_uri, __pyx_v_c_dict, __pyx_v_parse_options, __pyx_v_c_ctxt, __pyx_v_c_type);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":155
 *         c_doc = XSLT_DOC_DEFAULT_LOADER(
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:             # <<<<<<<<<<<<<<
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
 */
    __pyx_t_4 = ((__pyx_v_c_doc == NULL) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":156
 *             c_uri, c_dict, parse_options, c_ctxt, c_type)
 *         if c_doc is NULL:
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)             # <<<<<<<<<<<<<<
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 */
      __pyx_f_4lxml_5etree__xslt_store_resolver_exception(__pyx_v_c_uri, __pyx_v_c_pcontext, __pyx_v_c_type);
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":158
 *             _xslt_store_resolver_exception(c_uri, c_pcontext, c_type)
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:             # <<<<<<<<<<<<<<
 *         c_doc._private = c_pcontext
 *     return c_doc
 */
  __pyx_t_4 = ((__pyx_v_c_doc != NULL) != 0);
  if (__pyx_t_4) {
    __pyx_t_2 = ((__pyx_v_c_type == XSLT_LOAD_STYLESHEET) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":159
 * 
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         c_doc._private = c_pcontext             # <<<<<<<<<<<<<<
 *     return c_doc
 * 
 */
    __pyx_v_c_doc->_private = __pyx_v_c_pcontext;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":160
 *     if c_doc is not NULL and c_type == xslt.XSLT_LOAD_STYLESHEET:
 *         c_doc._private = c_pcontext
 *     return c_doc             # <<<<<<<<<<<<<<
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader
 */
  __pyx_r = __pyx_v_c_doc;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":128
 *         (<_XSLTResolverContext>context)._store_exception(e)
 * 
 * cdef xmlDoc* _xslt_doc_loader(const_xmlChar* c_uri, tree.xmlDict* c_dict,             # <<<<<<<<<<<<<<
 *                               int parse_options, void* c_ctxt,
 *                               xslt.xsltLoadType c_type) nogil:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":190
 *     """
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":191
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self):
 *         self._prefs = xslt.xsltNewSecurityPrefs()             # <<<<<<<<<<<<<<
 *         if self._prefs is NULL:
 *             raise MemoryError()
 */
  __pyx_v_self->_prefs = xsltNewSecurityPrefs();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":192
 *     def __cinit__(self):
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_prefs == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":193
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":190
 *     """
 *     cdef xslt.xsltSecurityPrefs* _prefs
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._prefs = xslt.xsltNewSecurityPrefs()
 *         if self._prefs is NULL:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":195
 *             raise MemoryError()
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,             # <<<<<<<<<<<<<<
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_read_file;
  int __pyx_v_write_file;
  int __pyx_v_create_dir;
  int __pyx_v_read_network;
  int __pyx_v_write_network;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read_file,&__pyx_n_s_write_file,&__pyx_n_s_create_dir,&__pyx_n_s_read_network,&__pyx_n_s_write_network,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      if (kw_args > 0 && likely(kw_args <= 5)) {
        Py_ssize_t index;
        for (index = 0; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
      goto __pyx_L5_argtuple_error;
    } else {
    }
    if (values[0]) {
      __pyx_v_read_file = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_read_file == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_read_file = ((int)1);
    }
    if (values[1]) {
      __pyx_v_write_file = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_write_file == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_write_file = ((int)1);
    }
    if (values[2]) {
      __pyx_v_create_dir = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_create_dir == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_create_dir = ((int)1);
    }
    if (values[3]) {
      __pyx_v_read_network = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_read_network == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":196
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,
 *                  bint read_network=True, bint write_network=True):             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 */
      __pyx_v_read_network = ((int)1);
    }
    if (values[4]) {
      __pyx_v_write_network = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_write_network == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_write_network = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__init__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self), __pyx_v_read_file, __pyx_v_write_file, __pyx_v_create_dir, __pyx_v_read_network, __pyx_v_write_network);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":195
 *             raise MemoryError()
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,             # <<<<<<<<<<<<<<
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 */

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

static int __pyx_pf_4lxml_5etree_17XSLTAccessControl_2__init__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, int __pyx_v_read_file, int __pyx_v_write_file, int __pyx_v_create_dir, int __pyx_v_read_network, int __pyx_v_write_network) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":197
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_READ_FILE, __pyx_v_read_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":198
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_WRITE_FILE, __pyx_v_write_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":199
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_CREATE_DIRECTORY, __pyx_v_create_dir); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":200
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_FILE, write_file)
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)             # <<<<<<<<<<<<<<
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_READ_NETWORK, __pyx_v_read_network); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":201
 *         self._setAccess(xslt.XSLT_SECPREF_CREATE_DIRECTORY, create_dir)
 *         self._setAccess(xslt.XSLT_SECPREF_READ_NETWORK, read_network)
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)             # <<<<<<<<<<<<<<
 * 
 *     DENY_ALL = XSLTAccessControl(
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(__pyx_v_self, XSLT_SECPREF_WRITE_NETWORK, __pyx_v_write_network); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":195
 *             raise MemoryError()
 * 
 *     def __init__(self, *, bint read_file=True, bint write_file=True, bint create_dir=True,             # <<<<<<<<<<<<<<
 *                  bint read_network=True, bint write_network=True):
 *         self._setAccess(xslt.XSLT_SECPREF_READ_FILE, read_file)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":211
 *         read_network=True, write_network=False)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_17XSLTAccessControl_4__dealloc__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":212
 * 
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_prefs != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":213
 *     def __dealloc__(self):
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
    xsltFreeSecurityPrefs(__pyx_v_self->_prefs);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":211
 *         read_network=True, write_network=False)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._prefs is not NULL:
 *             xslt.xsltFreeSecurityPrefs(self._prefs)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":216
 * 
 *     @cython.final
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 */

static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option, int __pyx_v_allow) {
  xsltSecurityCheck __pyx_v_function;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_setAccess", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":218
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:             # <<<<<<<<<<<<<<
 *             function = xslt.xsltSecurityAllow
 *         else:
 */
  __pyx_t_1 = (__pyx_v_allow != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":219
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 *             function = xslt.xsltSecurityAllow             # <<<<<<<<<<<<<<
 *         else:
 *             function = xslt.xsltSecurityForbid
 */
    __pyx_v_function = xsltSecurityAllow;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":221
 *             function = xslt.xsltSecurityAllow
 *         else:
 *             function = xslt.xsltSecurityForbid             # <<<<<<<<<<<<<<
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)
 * 
 */
    __pyx_v_function = xsltSecurityForbid;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":222
 *         else:
 *             function = xslt.xsltSecurityForbid
 *         xslt.xsltSetSecurityPrefs(self._prefs, option, function)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */
  xsltSetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option, __pyx_v_function);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":216
 * 
 *     @cython.final
 *     cdef _setAccess(self, xslt.xsltSecurityOption option, bint allow):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltSecurityCheck function
 *         if allow:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":225
 * 
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt):             # <<<<<<<<<<<<<<
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 */

static void __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltTransformContext *__pyx_v_ctxt) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_register_in_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":226
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt):
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)             # <<<<<<<<<<<<<<
 * 
 *     property options:
 */
  xsltSetCtxtSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":225
 * 
 *     @cython.final
 *     cdef void _register_in_context(self, xslt.xsltTransformContext* ctxt):             # <<<<<<<<<<<<<<
 *         xslt.xsltSetCtxtSecurityPrefs(self._prefs, ctxt)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":230
 *     property options:
 *         u"The access control configuration as a map of options."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7options_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7options_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_7options___get__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":231
 *         u"The access control configuration as a map of options."
 *         def __get__(self):
 *             return {             # <<<<<<<<<<<<<<
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":232
 *         def __get__(self):
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),             # <<<<<<<<<<<<<<
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_READ_FILE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_file, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":233
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),             # <<<<<<<<<<<<<<
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_WRITE_FILE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_write_file, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":234
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),             # <<<<<<<<<<<<<<
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *                 u'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_CREATE_DIRECTORY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_create_dir, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":235
 *                 u'write_file': self._optval(xslt.XSLT_SECPREF_WRITE_FILE),
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),             # <<<<<<<<<<<<<<
 *                 u'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),
 *                 }
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_READ_NETWORK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_read_network, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":236
 *                 u'create_dir': self._optval(xslt.XSLT_SECPREF_CREATE_DIRECTORY),
 *                 u'read_network': self._optval(xslt.XSLT_SECPREF_READ_NETWORK),
 *                 u'write_network': self._optval(xslt.XSLT_SECPREF_WRITE_NETWORK),             # <<<<<<<<<<<<<<
 *                 }
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree_17XSLTAccessControl__optval(__pyx_v_self, XSLT_SECPREF_WRITE_NETWORK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_write_network, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":230
 *     property options:
 *         u"The access control configuration as a map of options."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return {
 *                 u'read_file': self._optval(xslt.XSLT_SECPREF_READ_FILE),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.options.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":240
 * 
 *     @cython.final
 *     cdef _optval(self, xslt.xsltSecurityOption option):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 */

static PyObject *__pyx_f_4lxml_5etree_17XSLTAccessControl__optval(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self, xsltSecurityOption __pyx_v_option) {
  xsltSecurityCheck __pyx_v_function;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_optval", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":242
 *     cdef _optval(self, xslt.xsltSecurityOption option):
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)             # <<<<<<<<<<<<<<
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 */
  __pyx_v_function = xsltGetSecurityPrefs(__pyx_v_self->_prefs, __pyx_v_option);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":243
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:             # <<<<<<<<<<<<<<
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 */
  __pyx_t_1 = ((__pyx_v_function == ((xsltSecurityCheck)xsltSecurityAllow)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":244
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True             # <<<<<<<<<<<<<<
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":245
 *         if function is <xslt.xsltSecurityCheck>xslt.xsltSecurityAllow:
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_function == ((xsltSecurityCheck)xsltSecurityForbid)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":246
 *             return True
 *         elif function is <xslt.xsltSecurityCheck>xslt.xsltSecurityForbid:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":248
 *             return False
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":240
 * 
 *     @cython.final
 *     cdef _optval(self, xslt.xsltSecurityOption option):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltSecurityCheck function
 *         function = xslt.xsltGetSecurityPrefs(self._prefs, option)
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":250
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = sorted(self.options.items())
 *         return u"%s(%s)" % (
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17XSLTAccessControl_6__repr__(((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17XSLTAccessControl_6__repr__(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *__pyx_v_self) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  const char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":251
 * 
 *     def __repr__(self):
 *         items = sorted(self.options.items())             # <<<<<<<<<<<<<<
 *         return u"%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split(u'.')[-1],
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_options); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __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(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __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 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_items = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":252
 *     def __repr__(self):
 *         items = sorted(self.options.items())
 *         return u"%s(%s)" % (             # <<<<<<<<<<<<<<
 *             python._fqtypename(self).decode('UTF-8').split(u'.')[-1],
 *             u', '.join([u"%s=%r" % item for item in items]))
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":253
 *         items = sorted(self.options.items())
 *         return u"%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split(u'.')[-1],             # <<<<<<<<<<<<<<
 *             u', '.join([u"%s=%r" % item for item in items]))
 * 
 */
  __pyx_t_3 = _fqtypename(((PyObject *)__pyx_v_self));
  __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_3, 0, strlen(__pyx_t_3), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "split");
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyUnicode_Split(__pyx_t_1, __pyx_kp_u__4, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __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_GetItemInt_List(__pyx_t_2, -1, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":254
 *         return u"%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split(u'.')[-1],
 *             u', '.join([u"%s=%r" % item for item in items]))             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_v_items) || PyTuple_CheckExact(__pyx_v_items)) {
    __pyx_t_4 = __pyx_v_items; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_s_r, __pyx_v_item); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__92, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":253
 *         items = sorted(self.options.items())
 *         return u"%s(%s)" % (
 *             python._fqtypename(self).decode('UTF-8').split(u'.')[-1],             # <<<<<<<<<<<<<<
 *             u', '.join([u"%s=%r" % item for item in items]))
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __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_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":252
 *     def __repr__(self):
 *         items = sorted(self.options.items())
 *         return u"%s(%s)" % (             # <<<<<<<<<<<<<<
 *             python._fqtypename(self).decode('UTF-8').split(u'.')[-1],
 *             u', '.join([u"%s=%r" % item for item in items]))
 */
  __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_s_s_4, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":250
 *             return None
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         items = sorted(self.options.items())
 *         return u"%s(%s)" % (
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree.XSLTAccessControl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":259
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
 */

static int __pyx_f_4lxml_5etree__register_xslt_function(void *__pyx_v_ctxt, PyObject *__pyx_v_name_utf, PyObject *__pyx_v_ns_utf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_register_xslt_function", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":260
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:             # <<<<<<<<<<<<<<
 *         return 0
 *     # libxml2 internalises the strings if ctxt has a dict
 */
  __pyx_t_1 = (__pyx_v_ns_utf == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":261
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):
 *     if ns_utf is None:
 *         return 0             # <<<<<<<<<<<<<<
 *     # libxml2 internalises the strings if ctxt has a dict
 *     return xslt.xsltRegisterExtFunction(
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":263
 *         return 0
 *     # libxml2 internalises the strings if ctxt has a dict
 *     return xslt.xsltRegisterExtFunction(             # <<<<<<<<<<<<<<
 *         <xslt.xsltTransformContext*>ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *         <xslt.xmlXPathFunction>_xpath_function_call)
 */
  __pyx_r = xsltRegisterExtFunction(((xsltTransformContext *)__pyx_v_ctxt), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), ((xmlXPathFunction)__pyx_f_4lxml_5etree__xpath_function_call));
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":259
 * # XSLT
 * 
 * cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):             # <<<<<<<<<<<<<<
 *     if ns_utf is None:
 *         return 0
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":275
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 *     cdef dict _extension_elements
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT
 */

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

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

static int __pyx_pf_4lxml_5etree_12_XSLTContext___cinit__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":276
 *     cdef dict _extension_elements
 *     def __cinit__(self):
 *         self._xsltCtxt = NULL             # <<<<<<<<<<<<<<
 *         self._extension_elements = EMPTY_DICT
 * 
 */
  __pyx_v_self->_xsltCtxt = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":277
 *     def __cinit__(self):
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
 */
  __Pyx_INCREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_GIVEREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_GOTREF(__pyx_v_self->_extension_elements);
  __Pyx_DECREF(__pyx_v_self->_extension_elements);
  __pyx_v_self->_extension_elements = __pyx_v_4lxml_5etree_EMPTY_DICT;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":275
 *     cdef _ReadOnlyElementProxy _extension_element_proxy
 *     cdef dict _extension_elements
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._xsltCtxt = NULL
 *         self._extension_elements = EMPTY_DICT
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":279
 *         self._extension_elements = EMPTY_DICT
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_12_XSLTContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_12_XSLTContext_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_namespaces = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_error_log = 0;
  PyObject *__pyx_v_enable_regexp = 0;
  PyObject *__pyx_v_build_smart_strings = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_namespaces,&__pyx_n_s_extensions,&__pyx_n_s_error_log,&__pyx_n_s_enable_regexp,&__pyx_n_s_build_smart_strings,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namespaces)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_extensions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_log)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enable_regexp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_build_smart_strings)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_namespaces = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_error_log = values[2];
    __pyx_v_enable_regexp = values[3];
    __pyx_v_build_smart_strings = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_12_XSLTContext_2__init__(((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_v_self), __pyx_v_namespaces, __pyx_v_extensions, __pyx_v_error_log, __pyx_v_enable_regexp, __pyx_v_build_smart_strings);

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

static int __pyx_pf_4lxml_5etree_12_XSLTContext_2__init__(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, PyObject *__pyx_v_namespaces, PyObject *__pyx_v_extensions, PyObject *__pyx_v_error_log, PyObject *__pyx_v_enable_regexp, PyObject *__pyx_v_build_smart_strings) {
  PyObject *__pyx_v_ns_name_tuple = NULL;
  PyObject *__pyx_v_extension = NULL;
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_extensions);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":281
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,
 *                  build_smart_strings):
 *         if extensions is not None and extensions:             # <<<<<<<<<<<<<<
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
 */
  __pyx_t_1 = (__pyx_v_extensions != Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extensions); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":282
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():             # <<<<<<<<<<<<<<
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_extensions, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_5 = __pyx_t_7(__pyx_t_4);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_ns_name_tuple, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_extension, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":283
 *         if extensions is not None and extensions:
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:             # <<<<<<<<<<<<<<
 *                     raise XSLTExtensionError, \
 *                         u"extensions must not have empty namespaces"
 */
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = (__pyx_t_5 == Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":284
 *             for ns_name_tuple, extension in extensions.items():
 *                 if ns_name_tuple[0] is None:
 *                     raise XSLTExtensionError, \             # <<<<<<<<<<<<<<
 *                         u"extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTExtensionError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_Raise(__pyx_t_5, __pyx_kp_u_extensions_must_not_have_empty_n, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":286
 *                     raise XSLTExtensionError, \
 *                         u"extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):             # <<<<<<<<<<<<<<
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
 */
      __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_extension, ((PyObject*)__pyx_ptype_4lxml_5etree_XSLTExtension)); 
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":287
 *                         u"extensions must not have empty namespaces"
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:             # <<<<<<<<<<<<<<
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
 */
        __pyx_t_3 = (__pyx_v_self->_extension_elements == __pyx_v_4lxml_5etree_EMPTY_DICT);
        __pyx_t_1 = (__pyx_t_3 != 0);
        if (__pyx_t_1) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":288
 *                 if isinstance(extension, XSLTExtension):
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}             # <<<<<<<<<<<<<<
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 */
          __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_v_self->_extension_elements);
          __Pyx_DECREF(__pyx_v_self->_extension_elements);
          __pyx_v_self->_extension_elements = ((PyObject*)__pyx_t_5);
          __pyx_t_5 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":289
 *                     if self._extension_elements is EMPTY_DICT:
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()             # <<<<<<<<<<<<<<
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_extensions, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF_SET(__pyx_v_extensions, __pyx_t_9);
          __pyx_t_9 = 0;
          goto __pyx_L10;
        }
        __pyx_L10:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":290
 *                         self._extension_elements = {}
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])             # <<<<<<<<<<<<<<
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 */
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_5 = __pyx_f_4lxml_5etree__utf8(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF_SET(__pyx_v_ns_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":291
 *                         extensions = extensions.copy()
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])             # <<<<<<<<<<<<<<
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
 */
        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ns_name_tuple, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = __pyx_f_4lxml_5etree__utf8(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name_utf, ((PyObject*)__pyx_t_9));
        __pyx_t_9 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":292
 *                     ns_utf   = _utf8(ns_name_tuple[0])
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension             # <<<<<<<<<<<<<<
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 */
        if (unlikely(__pyx_v_self->_extension_elements == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_v_ns_utf);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ns_utf);
        __Pyx_GIVEREF(__pyx_v_ns_utf);
        __Pyx_INCREF(__pyx_v_name_utf);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_name_utf);
        __Pyx_GIVEREF(__pyx_v_name_utf);
        if (unlikely(PyDict_SetItem(__pyx_v_self->_extension_elements, __pyx_t_9, __pyx_v_extension) < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":293
 *                     name_utf = _utf8(ns_name_tuple[1])
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]             # <<<<<<<<<<<<<<
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)
 */
        if (PyObject_DelItem(__pyx_v_extensions, __pyx_v_ns_name_tuple) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":294
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__BaseContext)), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":295
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,
 *                               build_smart_strings)             # <<<<<<<<<<<<<<
 * 
 *     cdef _BaseContext _copy(self):
 */
  __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_namespaces);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_namespaces);
  __Pyx_GIVEREF(__pyx_v_namespaces);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(__pyx_v_error_log);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_error_log);
  __Pyx_GIVEREF(__pyx_v_error_log);
  __Pyx_INCREF(__pyx_v_enable_regexp);
  PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_v_enable_regexp);
  __Pyx_GIVEREF(__pyx_v_enable_regexp);
  __Pyx_INCREF(__pyx_v_build_smart_strings);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_v_build_smart_strings);
  __Pyx_GIVEREF(__pyx_v_build_smart_strings);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":294
 *                     self._extension_elements[(ns_utf, name_utf)] = extension
 *                     del extensions[ns_name_tuple]
 *         _BaseContext.__init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                               build_smart_strings)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":279
 *         self._extension_elements = EMPTY_DICT
 * 
 *     def __init__(self, namespaces, extensions, error_log, enable_regexp,             # <<<<<<<<<<<<<<
 *                  build_smart_strings):
 *         if extensions is not None and extensions:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_name_tuple);
  __Pyx_XDECREF(__pyx_v_extension);
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XDECREF(__pyx_v_extensions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":297
 *                               build_smart_strings)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
 */

static struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_f_4lxml_5etree_12_XSLTContext__copy(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__BaseContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":299
 *     cdef _BaseContext _copy(self):
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)             # <<<<<<<<<<<<<<
 *         context._extension_elements = self._extension_elements
 *         return context
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_4lxml_5etree__BaseContext->_copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":300
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
 *         context._extension_elements = self._extension_elements             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
  __pyx_t_2 = __pyx_v_self->_extension_elements;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_context->_extension_elements);
  __Pyx_DECREF(__pyx_v_context->_extension_elements);
  __pyx_v_context->_extension_elements = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":301
 *         context = <_XSLTContext>_BaseContext._copy(self)
 *         context._extension_elements = self._extension_elements
 *         return context             # <<<<<<<<<<<<<<
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_context);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":297
 *                               build_smart_strings)
 * 
 *     cdef _BaseContext _copy(self):             # <<<<<<<<<<<<<<
 *         cdef _XSLTContext context
 *         context = <_XSLTContext>_BaseContext._copy(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTContext._copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":303
 *         return context
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,             # <<<<<<<<<<<<<<
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
 */

static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_register_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self, xsltTransformContext *__pyx_v_xsltCtxt, struct LxmlDocument *__pyx_v_doc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":305
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt             # <<<<<<<<<<<<<<
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)
 */
  __pyx_v_self->_xsltCtxt = __pyx_v_xsltCtxt;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":306
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)             # <<<<<<<<<<<<<<
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_xpath_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt->xpathCtxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":307
 *         self._xsltCtxt = xsltCtxt
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)             # <<<<<<<<<<<<<<
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__register_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":308
 *         self._set_xpath_context(xsltCtxt.xpathCtxt)
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)             # <<<<<<<<<<<<<<
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerLocalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt, __pyx_f_4lxml_5etree__register_xslt_function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":309
 *         self._register_context(doc)
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)             # <<<<<<<<<<<<<<
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTContext *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.registerGlobalFunctions(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self), __pyx_v_xsltCtxt, __pyx_f_4lxml_5etree__register_xslt_function); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":310
 *         self.registerLocalFunctions(xsltCtxt, _register_xslt_function)
 *         self.registerGlobalFunctions(xsltCtxt, _register_xslt_function)
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)             # <<<<<<<<<<<<<<
 * 
 *     cdef free_context(self):
 */
  __pyx_t_1 = __pyx_v_self->_extension_elements;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_4lxml_5etree__registerXSLTExtensions(__pyx_v_xsltCtxt, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 310; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":303
 *         return context
 * 
 *     cdef register_context(self, xslt.xsltTransformContext* xsltCtxt,             # <<<<<<<<<<<<<<
 *                                _Document doc):
 *         self._xsltCtxt = xsltCtxt
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.register_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":312
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 *     cdef free_context(self):             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 *         self._release_context()
 */

static PyObject *__pyx_f_4lxml_5etree_12_XSLTContext_free_context(struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("free_context", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":313
 * 
 *     cdef free_context(self):
 *         self._cleanup_context()             # <<<<<<<<<<<<<<
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__cleanup_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":314
 *     cdef free_context(self):
 *         self._cleanup_context()
 *         self._release_context()             # <<<<<<<<<<<<<<
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__release_context(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":315
 *         self._cleanup_context()
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
 */
  __pyx_t_2 = ((__pyx_v_self->_xsltCtxt != NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":316
 *         self._release_context()
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)             # <<<<<<<<<<<<<<
 *             self._xsltCtxt = NULL
 *         self._release_temp_refs()
 */
    xsltFreeTransformContext(__pyx_v_self->_xsltCtxt);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":317
 *         if self._xsltCtxt is not NULL:
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL             # <<<<<<<<<<<<<<
 *         self._release_temp_refs()
 * 
 */
    __pyx_v_self->_xsltCtxt = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":318
 *             xslt.xsltFreeTransformContext(self._xsltCtxt)
 *             self._xsltCtxt = NULL
 *         self._release_temp_refs()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":312
 *         _registerXSLTExtensions(xsltCtxt, self._extension_elements)
 * 
 *     cdef free_context(self):             # <<<<<<<<<<<<<<
 *         self._cleanup_context()
 *         self._release_context()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTContext.free_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":329
 *     """
 *     cdef bytes strval
 *     def __cinit__(self, strval):             # <<<<<<<<<<<<<<
 *         self.strval = _utf8(strval)
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_22_XSLTQuotedStringParam_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_22_XSLTQuotedStringParam_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_strval = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_strval,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_strval)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_strval = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_self), __pyx_v_strval);

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

static int __pyx_pf_4lxml_5etree_22_XSLTQuotedStringParam___cinit__(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_v_self, PyObject *__pyx_v_strval) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":330
 *     cdef bytes strval
 *     def __cinit__(self, strval):
 *         self.strval = _utf8(strval)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_strval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->strval);
  __Pyx_DECREF(__pyx_v_self->strval);
  __pyx_v_self->strval = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":329
 *     """
 *     cdef bytes strval
 *     def __cinit__(self, strval):             # <<<<<<<<<<<<<<
 *         self.strval = _utf8(strval)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTQuotedStringParam.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":366
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_style = NULL
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_4XSLT___cinit__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":367
 * 
 *     def __cinit__(self):
 *         self._c_style = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 */
  __pyx_v_self->_c_style = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":366
 *     cdef _ErrorLog _error_log
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_style = NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":369
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_4XSLT_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_4XSLT_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xslt_input = 0;
  PyObject *__pyx_v_extensions = 0;
  PyObject *__pyx_v_regexp = 0;
  PyObject *__pyx_v_access_control = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xslt_input,&__pyx_n_s_extensions,&__pyx_n_s_regexp,&__pyx_n_s_access_control,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_True);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":370
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,
 *                  access_control=None):             # <<<<<<<<<<<<<<
 *         cdef xslt.xsltStylesheet* c_style
 *         cdef xmlDoc* c_doc
 */
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xslt_input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args > 0 && likely(kw_args <= 3)) {
        Py_ssize_t index;
        for (index = 1; index < 4 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_xslt_input = values[0];
    __pyx_v_extensions = values[1];
    __pyx_v_regexp = values[2];
    __pyx_v_access_control = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLT.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_2__init__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v_xslt_input, __pyx_v_extensions, __pyx_v_regexp, __pyx_v_access_control);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":369
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style
 */

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

static int __pyx_pf_4lxml_5etree_4XSLT_2__init__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v_xslt_input, PyObject *__pyx_v_extensions, PyObject *__pyx_v_regexp, PyObject *__pyx_v_access_control) {
  xsltStylesheet *__pyx_v_c_style;
  xmlDoc *__pyx_v_c_doc;
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  PyObject *__pyx_v_doc_url_utf = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":376
 *         cdef _Element root_node
 * 
 *         doc = _documentOrRaise(xslt_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(xslt_input)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_xslt_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":377
 * 
 *         doc = _documentOrRaise(xslt_input)
 *         root_node = _rootNodeOrRaise(xslt_input)             # <<<<<<<<<<<<<<
 * 
 *         # set access control or raise TypeError
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_xslt_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":380
 * 
 *         # set access control or raise TypeError
 *         self._access_control = access_control             # <<<<<<<<<<<<<<
 * 
 *         # make a copy of the document as stylesheet parsing modifies it
 */
  if (!(likely(((__pyx_v_access_control) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_access_control, __pyx_ptype_4lxml_5etree_XSLTAccessControl))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_access_control;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_access_control);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_access_control));
  __pyx_v_self->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":383
 * 
 *         # make a copy of the document as stylesheet parsing modifies it
 *         c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 * 
 *         # make sure we always have a stylesheet URL
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":386
 * 
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:             # <<<<<<<<<<<<<<
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))
 */
  __pyx_t_3 = ((__pyx_v_c_doc->URL == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":388
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))             # <<<<<<<<<<<<<<
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 * 
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_string___STRING__XSLT___d_xslt, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":387
 *         # make sure we always have a stylesheet URL
 *         if c_doc.URL is NULL:
 *             doc_url_utf = python.PyUnicode_AsASCIIString(             # <<<<<<<<<<<<<<
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 */
    __pyx_t_4 = PyUnicode_AsASCIIString(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_doc_url_utf = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":389
 *             doc_url_utf = python.PyUnicode_AsASCIIString(
 *                 u"string://__STRING__XSLT__/%d.xslt" % id(self))
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))             # <<<<<<<<<<<<<<
 * 
 *         self._error_log = _ErrorLog()
 */
    __pyx_v_c_doc->URL = xmlStrdup((const xmlChar*)PyBytes_AS_STRING(__pyx_v_doc_url_utf));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":391
 *             c_doc.URL = tree.xmlStrdup(_xcstr(doc_url_utf))
 * 
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 *         self._xslt_resolver_context = _XSLTResolverContext()
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":392
 * 
 *         self._error_log = _ErrorLog()
 *         self._xslt_resolver_context = _XSLTResolverContext()             # <<<<<<<<<<<<<<
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 */
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTResolverContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_xslt_resolver_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_xslt_resolver_context));
  __pyx_v_self->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":393
 *         self._error_log = _ErrorLog()
 *         self._xslt_resolver_context = _XSLTResolverContext()
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)             # <<<<<<<<<<<<<<
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->_xslt_resolver_context);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = ((PyObject *)__pyx_v_doc->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __pyx_f_4lxml_5etree__initXSLTResolverContext(((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_4), ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":395
 *         _initXSLTResolverContext(self._xslt_resolver_context, doc._parser)
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)             # <<<<<<<<<<<<<<
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_c_doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_xslt_resolver_context->_c_style_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":396
 *         # keep a copy in case we need to access the stylesheet via 'document()'
 *         self._xslt_resolver_context._c_style_doc = _copyDoc(c_doc, 1)
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context             # <<<<<<<<<<<<<<
 * 
 *         with self._error_log:
 */
  __pyx_v_c_doc->_private = ((PyObject *)__pyx_v_self->_xslt_resolver_context);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":398
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 * 
 */
  /*with:*/ {
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->_error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->_error_log); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    /*try:*/ {
      {
        if (__pyx_t_8||__pyx_t_9||__pyx_t_10); else {/*mark used*/};
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":399
 * 
 *         with self._error_log:
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 * 
 *         if c_style is NULL or c_style.errors:
 */
          __pyx_v_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);
        }
      }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":398
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 * 
 */
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__93, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L16;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":401
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 * 
 *         if c_style is NULL or c_style.errors:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
 */
  __pyx_t_3 = (__pyx_v_c_style == NULL);
  if (!__pyx_t_3) {
    __pyx_t_11 = (__pyx_v_c_style->errors != 0);
  } else {
    __pyx_t_11 = __pyx_t_3;
  }
  if (__pyx_t_11) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":402
 * 
 *         if c_style is NULL or c_style.errors:
 *             tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *             if c_style is not NULL:
 *                 xslt.xsltFreeStylesheet(c_style)
 */
    xmlFreeDoc(__pyx_v_c_doc);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":403
 *         if c_style is NULL or c_style.errors:
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:             # <<<<<<<<<<<<<<
 *                 xslt.xsltFreeStylesheet(c_style)
 *             self._xslt_resolver_context._raise_if_stored()
 */
    __pyx_t_11 = ((__pyx_v_c_style != NULL) != 0);
    if (__pyx_t_11) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":404
 *             tree.xmlFreeDoc(c_doc)
 *             if c_style is not NULL:
 *                 xslt.xsltFreeStylesheet(c_style)             # <<<<<<<<<<<<<<
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 */
      xsltFreeStylesheet(__pyx_v_c_style);
      goto __pyx_L18;
    }
    __pyx_L18:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":405
 *             if c_style is not NULL:
 *                 xslt.xsltFreeStylesheet(c_style)
 *             self._xslt_resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_self->_xslt_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_self->_xslt_resolver_context)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":407
 *             self._xslt_resolver_context._raise_if_stored()
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \             # <<<<<<<<<<<<<<
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
 */
    __pyx_t_11 = (__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error != Py_None);
    if (__pyx_t_11) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":408
 *             # last error seems to be the most accurate here
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:             # <<<<<<<<<<<<<<
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = __pyx_t_3;
    } else {
      __pyx_t_12 = __pyx_t_11;
    }
    if (__pyx_t_12) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":409
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,             # <<<<<<<<<<<<<<
 *                                      self._error_log)
 *             else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTParseError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":410
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,
 *                                      self._error_log)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise XSLTParseError(
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":409
 *             if self._error_log.last_error is not None and \
 *                     self._error_log.last_error.message:
 *                 raise XSLTParseError(self._error_log.last_error.message,             # <<<<<<<<<<<<<<
 *                                      self._error_log)
 *             else:
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":412
 *                                      self._error_log)
 *             else:
 *                 raise XSLTParseError(             # <<<<<<<<<<<<<<
 *                     self._error_log._buildExceptionMessage(
 *                         u"Cannot parse stylesheet"),
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTParseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":413
 *             else:
 *                 raise XSLTParseError(
 *                     self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                         u"Cannot parse stylesheet"),
 *                     self._error_log)
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_kp_u_Cannot_parse_stylesheet); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":412
 *                                      self._error_log)
 *             else:
 *                 raise XSLTParseError(             # <<<<<<<<<<<<<<
 *                     self._error_log._buildExceptionMessage(
 *                         u"Cannot parse stylesheet"),
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":417
 *                     self._error_log)
 * 
 *         c_doc._private = NULL # no longer used!             # <<<<<<<<<<<<<<
 *         self._c_style = c_style
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 */
  __pyx_v_c_doc->_private = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":418
 * 
 *         c_doc._private = NULL # no longer used!
 *         self._c_style = c_style             # <<<<<<<<<<<<<<
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 * 
 */
  __pyx_v_self->_c_style = __pyx_v_c_style;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":419
 *         c_doc._private = NULL # no longer used!
 *         self._c_style = c_style
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_v_extensions);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
  PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_self->_error_log));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
  __Pyx_INCREF(__pyx_v_regexp);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_regexp);
  __Pyx_GIVEREF(__pyx_v_regexp);
  __Pyx_INCREF(Py_True);
  PyTuple_SET_ITEM(__pyx_t_4, 4, Py_True);
  __Pyx_GIVEREF(Py_True);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTContext)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_context));
  __pyx_v_self->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":369
 *         self._c_style = NULL
 * 
 *     def __init__(self, xslt_input, *, extensions=None, regexp=True,             # <<<<<<<<<<<<<<
 *                  access_control=None):
 *         cdef xslt.xsltStylesheet* c_style
 */

  /* function exit code */
  __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_AddTraceback("lxml.etree.XSLT.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_doc_url_utf);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":421
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_4XSLT_4__dealloc__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_4XSLT_4__dealloc__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":422
 * 
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \             # <<<<<<<<<<<<<<
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_xslt_resolver_context) != Py_None);
  if ((__pyx_t_1 != 0)) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":423
 *     def __dealloc__(self):
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:             # <<<<<<<<<<<<<<
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
 */
    __pyx_t_2 = ((__pyx_v_self->_xslt_resolver_context->_c_style_doc != NULL) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":424
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)             # <<<<<<<<<<<<<<
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
 */
    xmlFreeDoc(__pyx_v_self->_xslt_resolver_context->_c_style_doc);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":426
 *             tree.xmlFreeDoc(self._xslt_resolver_context._c_style_doc)
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:             # <<<<<<<<<<<<<<
 *             xslt.xsltFreeStylesheet(self._c_style)
 * 
 */
  __pyx_t_3 = ((__pyx_v_self->_c_style != NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":427
 *         # this cleans up the doc copy as well
 *         if self._c_style is not NULL:
 *             xslt.xsltFreeStylesheet(self._c_style)             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
    xsltFreeStylesheet(__pyx_v_self->_c_style);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":421
 *         self._context = _XSLTContext(None, extensions, self._error_log, regexp, True)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._xslt_resolver_context is not None and \
 *                self._xslt_resolver_context._c_style_doc is not NULL:
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":431
 *     property error_log:
 *         u"The log of errors and warnings of an XSLT execution."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_9error_log___get__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":432
 *         u"The log of errors and warnings of an XSLT execution."
 *         def __get__(self):
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":431
 *     property error_log:
 *         u"The log of errors and warnings of an XSLT execution."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLT.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":435
 * 
 *     @staticmethod
 *     def strparam(strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_7strparam(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_6strparam[] = "strparam(strval)\n\n        Mark an XSLT string parameter that requires quote escaping\n        before passing it into the transformation.  Use it like this::\n\n            result = transform(doc, some_strval = XSLT.strparam(\n                '''it's \"Monty Python's\" ...'''))\n\n        Escaped string parameters can be reused without restriction.\n        ";
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_7strparam = {__Pyx_NAMESTR("strparam"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_7strparam, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_6strparam)};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_7strparam(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_strval = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strparam (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_strval,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_strval)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strparam") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_strval = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strparam", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLT.strparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_6strparam(__pyx_v_strval);

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_6strparam(PyObject *__pyx_v_strval) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("strparam", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":446
 *         Escaped string parameters can be reused without restriction.
 *         """
 *         return _XSLTQuotedStringParam(strval)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_strval);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_strval);
  __Pyx_GIVEREF(__pyx_v_strval);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 446; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":435
 * 
 *     @staticmethod
 *     def strparam(strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.strparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":449
 * 
 *     @staticmethod
 *     def set_global_max_depth(int max_depth):             # <<<<<<<<<<<<<<
 *         u"""set_global_max_depth(max_depth)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth[] = "set_global_max_depth(max_depth)\n\n        The maximum traversal depth that the stylesheet engine will allow.\n        This does not only count the template recursion depth but also takes\n        the number of variables/parameters into account.  The required setting\n        for a run depends on both the stylesheet and the input data.\n\n        Example::\n\n            XSLT.set_global_max_depth(5000)\n\n        Note that this is currently a global, module-wide setting because\n        libxslt does not support it at a per-stylesheet level.\n        ";
static PyMethodDef __pyx_mdef_4lxml_5etree_4XSLT_9set_global_max_depth = {__Pyx_NAMESTR("set_global_max_depth"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth)};
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_max_depth;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_global_max_depth (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_depth,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_depth)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_global_max_depth") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_max_depth = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_max_depth == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_global_max_depth", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLT.set_global_max_depth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_8set_global_max_depth(__pyx_v_max_depth);

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_8set_global_max_depth(int __pyx_v_max_depth) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_global_max_depth", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":464
 *         libxslt does not support it at a per-stylesheet level.
 *         """
 *         if max_depth < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")
 *         xslt.xsltMaxDepth = max_depth
 */
  __pyx_t_1 = ((__pyx_v_max_depth < 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":465
 *         """
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")             # <<<<<<<<<<<<<<
 *         xslt.xsltMaxDepth = max_depth
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":466
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")
 *         xslt.xsltMaxDepth = max_depth             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, _input, *, profile_run=False, **kw):
 */
  xsltMaxDepth = __pyx_v_max_depth;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":449
 * 
 *     @staticmethod
 *     def set_global_max_depth(int max_depth):             # <<<<<<<<<<<<<<
 *         u"""set_global_max_depth(max_depth)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.set_global_max_depth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":468
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def apply(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""apply(self, _input,  profile_run=False, **kw)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_11apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_10apply[] = "apply(self, _input,  profile_run=False, **kw)\n        \n        :deprecated: call the object, not this method.";
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_11apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__input = 0;
  PyObject *__pyx_v_profile_run = 0;
  PyObject *__pyx_v_kw = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input,&__pyx_n_s_profile_run,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__input = values[0];
    __pyx_v_profile_run = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0;
  __Pyx_AddTraceback("lxml.etree.XSLT.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_10apply(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v__input, __pyx_v_profile_run, __pyx_v_kw);

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_10apply(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v__input, PyObject *__pyx_v_profile_run, PyObject *__pyx_v_kw) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":472
 * 
 *         :deprecated: call the object, not this method."""
 *         return self(_input, profile_run=profile_run, **kw)             # <<<<<<<<<<<<<<
 * 
 *     def tostring(self, _ElementTree result_tree):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v__input);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__input);
  __Pyx_GIVEREF(__pyx_v__input);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyDict_GetItem(__pyx_t_2, __pyx_n_s_profile_run))) {
    __Pyx_RaiseDoubleKeywordsError("function", __pyx_n_s_profile_run); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_profile_run, __pyx_v_profile_run) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":468
 *         xslt.xsltMaxDepth = max_depth
 * 
 *     def apply(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""apply(self, _input,  profile_run=False, **kw)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":474
 *         return self(_input, profile_run=profile_run, **kw)
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         u"""tostring(self, result_tree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_13tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_result_tree); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_12tostring[] = "tostring(self, result_tree)\n\n        Save result doc to string based on stylesheet output method.\n\n        :deprecated: use str(result_tree) instead.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_13tostring(PyObject *__pyx_v_self, PyObject *__pyx_v_result_tree) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostring (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result_tree), __pyx_ptype_4lxml_5etree__ElementTree, 1, "result_tree", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_12tostring(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), ((struct LxmlElementTree *)__pyx_v_result_tree));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_12tostring(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, struct LxmlElementTree *__pyx_v_result_tree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":481
 *         :deprecated: use str(result_tree) instead.
 *         """
 *         return str(result_tree)             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, memo):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result_tree));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result_tree));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result_tree));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 481; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":474
 *         return self(_input, profile_run=profile_run, **kw)
 * 
 *     def tostring(self, _ElementTree result_tree):             # <<<<<<<<<<<<<<
 *         u"""tostring(self, result_tree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":483
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_15__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_15__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_14__deepcopy__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), ((PyObject *)__pyx_v_memo));

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_14__deepcopy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__deepcopy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":484
 * 
 *     def __deepcopy__(self, memo):
 *         return self.__copy__()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":483
 *         return str(result_tree)
 * 
 *     def __deepcopy__(self, memo):             # <<<<<<<<<<<<<<
 *         return self.__copy__()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.XSLT.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":486
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_17__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_17__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_16__copy__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_16__copy__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":487
 * 
 *     def __copy__(self):
 *         return _copyXSLT(self)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__copyXSLT(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":486
 *         return self.__copy__()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return _copyXSLT(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XSLT.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":489
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _input, profile_run=False, **kw)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_19__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_4XSLT_18__call__[] = "__call__(self, _input, profile_run=False, **kw)\n\n        Execute the XSL transformation on a tree or Element.\n\n        Pass the ``profile_run`` option to get profile information\n        about the XSLT.  The result of the XSLT will have a property\n        xslt_profile that holds an XML tree with profiling data.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_4XSLT_18__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_4XSLT_19__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v__input = 0;
  PyObject *__pyx_v_profile_run = 0;
  PyObject *__pyx_v_kw = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input,&__pyx_n_s_profile_run,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v__input = values[0];
    __pyx_v_profile_run = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0;
  __Pyx_AddTraceback("lxml.etree.XSLT.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_4XSLT_18__call__(((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_v_self), __pyx_v__input, __pyx_v_profile_run, __pyx_v_kw);

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

static PyObject *__pyx_pf_4lxml_5etree_4XSLT_18__call__(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, PyObject *__pyx_v__input, PyObject *__pyx_v_profile_run, PyObject *__pyx_v_kw) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *__pyx_v_resolver_context = 0;
  struct LxmlDocument *__pyx_v_input_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  struct LxmlDocument *__pyx_v_result_doc = 0;
  struct LxmlDocument *__pyx_v_profile_doc = 0;
  xmlDoc *__pyx_v_c_profile_doc;
  xsltTransformContext *__pyx_v_transform_ctxt;
  xmlDoc *__pyx_v_c_result;
  xmlDoc *__pyx_v_c_doc;
  xmlDict *__pyx_v_c_dict;
  const char **__pyx_v_params;
  PyObject *__pyx_v_error = NULL;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  xmlDict *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  char const *__pyx_t_18;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":498
 *         xslt_profile that holds an XML tree with profiling data.
 *         """
 *         cdef _XSLTContext context = None             # <<<<<<<<<<<<<<
 *         cdef _XSLTResolverContext resolver_context
 *         cdef _Document input_doc
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":503
 *         cdef _Element root_node
 *         cdef _Document result_doc
 *         cdef _Document profile_doc = None             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_profile_doc
 *         cdef xslt.xsltTransformContext* transform_ctxt
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_profile_doc = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":506
 *         cdef xmlDoc* c_profile_doc
 *         cdef xslt.xsltTransformContext* transform_ctxt
 *         cdef xmlDoc* c_result = NULL             # <<<<<<<<<<<<<<
 *         cdef xmlDoc* c_doc
 *         cdef tree.xmlDict* c_dict
 */
  __pyx_v_c_result = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":509
 *         cdef xmlDoc* c_doc
 *         cdef tree.xmlDict* c_dict
 *         cdef const_char** params = NULL             # <<<<<<<<<<<<<<
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 */
  __pyx_v_params = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":511
 *         cdef const_char** params = NULL
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"             # <<<<<<<<<<<<<<
 *         input_doc = _documentOrRaise(_input)
 *         root_node = _rootNodeOrRaise(_input)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_style != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XSLT_stylesheet_not_initialised);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":512
 * 
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(_input)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_input_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":513
 *         assert self._c_style is not NULL, "XSLT stylesheet not initialised"
 *         input_doc = _documentOrRaise(_input)
 *         root_node = _rootNodeOrRaise(_input)             # <<<<<<<<<<<<<<
 * 
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v__input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":515
 *         root_node = _rootNodeOrRaise(_input)
 * 
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_input_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":517
 *         c_doc = _fakeRootDoc(input_doc._c_doc, root_node._c_node)
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)             # <<<<<<<<<<<<<<
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
  __pyx_v_transform_ctxt = xsltNewTransformContext(__pyx_v_self->_c_style, __pyx_v_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":518
 * 
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             raise MemoryError()
 */
  __pyx_t_3 = ((__pyx_v_transform_ctxt == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":519
 *         transform_ctxt = xslt.xsltNewTransformContext(self._c_style, c_doc)
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":520
 *         if transform_ctxt is NULL:
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         # using the stylesheet dict is safer than using a possibly
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":526
 *         # non-input tag/attr names will come from the stylesheet
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         if kw:
 */
  __pyx_t_3 = ((__pyx_v_transform_ctxt->dict != NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":527
 *         # anyway.
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 *         if kw:
 *             # parameter values are stored in the dict
 */
    xmlDictFree(__pyx_v_transform_ctxt->dict);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":528
 *         if transform_ctxt.dict is not NULL:
 *             xmlparser.xmlDictFree(transform_ctxt.dict)
 *         if kw:             # <<<<<<<<<<<<<<
 *             # parameter values are stored in the dict
 *             # => avoid unnecessarily cluttering the global dict
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_kw); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":531
 *             # parameter values are stored in the dict
 *             # => avoid unnecessarily cluttering the global dict
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)             # <<<<<<<<<<<<<<
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 */
    __pyx_v_transform_ctxt->dict = xmlDictCreateSub(__pyx_v_self->_c_style->doc->dict);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":532
 *             # => avoid unnecessarily cluttering the global dict
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)
 *             if transform_ctxt.dict is NULL:             # <<<<<<<<<<<<<<
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 *                 raise MemoryError()
 */
    __pyx_t_3 = ((__pyx_v_transform_ctxt->dict == NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":533
 *             transform_ctxt.dict = xmlparser.xmlDictCreateSub(self._c_style.doc.dict)
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *         else:
 */
      xsltFreeTransformContext(__pyx_v_transform_ctxt);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":534
 *             if transform_ctxt.dict is NULL:
 *                 xslt.xsltFreeTransformContext(transform_ctxt)
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":536
 *                 raise MemoryError()
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict             # <<<<<<<<<<<<<<
 *             xmlparser.xmlDictReference(transform_ctxt.dict)
 * 
 */
    __pyx_t_4 = __pyx_v_self->_c_style->doc->dict;
    __pyx_v_transform_ctxt->dict = __pyx_t_4;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":537
 *         else:
 *             transform_ctxt.dict = self._c_style.doc.dict
 *             xmlparser.xmlDictReference(transform_ctxt.dict)             # <<<<<<<<<<<<<<
 * 
 *         xslt.xsltSetCtxtParseOptions(
 */
    xmlDictReference(__pyx_v_transform_ctxt->dict);
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":539
 *             xmlparser.xmlDictReference(transform_ctxt.dict)
 * 
 *         xslt.xsltSetCtxtParseOptions(             # <<<<<<<<<<<<<<
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 */
  xsltSetCtxtParseOptions(__pyx_v_transform_ctxt, __pyx_v_input_doc->_parser->_parse_options);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":542
 *             transform_ctxt, input_doc._parser._parse_options)
 * 
 *         if profile_run:             # <<<<<<<<<<<<<<
 *             transform_ctxt.profile = 1
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_profile_run); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":543
 * 
 *         if profile_run:
 *             transform_ctxt.profile = 1             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_v_transform_ctxt->profile = 1;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":545
 *             transform_ctxt.profile = 1
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":546
 * 
 *         try:
 *             context = self._context._copy()             # <<<<<<<<<<<<<<
 *             context.register_context(transform_ctxt, input_doc)
 * 
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_self->_context))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTContext))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_DECREF_SET(__pyx_v_context, ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":547
 *         try:
 *             context = self._context._copy()
 *             context.register_context(transform_ctxt, input_doc)             # <<<<<<<<<<<<<<
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_12_XSLTContext_register_context(__pyx_v_context, __pyx_v_transform_ctxt, __pyx_v_input_doc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":549
 *             context.register_context(transform_ctxt, input_doc)
 * 
 *             resolver_context = self._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(__pyx_v_self->_xslt_resolver_context)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":550
 * 
 *             resolver_context = self._xslt_resolver_context._copy()
 *             transform_ctxt._private = <python.PyObject*>resolver_context             # <<<<<<<<<<<<<<
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)
 */
    __pyx_v_transform_ctxt->_private = ((PyObject *)__pyx_v_resolver_context);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":552
 *             transform_ctxt._private = <python.PyObject*>resolver_context
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)             # <<<<<<<<<<<<<<
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__convert_xslt_parameters(__pyx_v_transform_ctxt, __pyx_v_kw, (&__pyx_v_params)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":553
 * 
 *             _convert_xslt_parameters(transform_ctxt, kw, &params)
 *             c_result = self._run_transform(             # <<<<<<<<<<<<<<
 *                 c_doc, params, context, transform_ctxt)
 *             if params is not NULL:
 */
    __pyx_v_c_result = ((struct __pyx_vtabstruct_4lxml_5etree_XSLT *)__pyx_v_self->__pyx_vtab)->_run_transform(__pyx_v_self, __pyx_v_c_doc, __pyx_v_params, __pyx_v_context, __pyx_v_transform_ctxt);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":555
 *             c_result = self._run_transform(
 *                 c_doc, params, context, transform_ctxt)
 *             if params is not NULL:             # <<<<<<<<<<<<<<
 *                 # deallocate space for parameters
 *                 python.PyMem_Free(params)
 */
    __pyx_t_3 = ((__pyx_v_params != NULL) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":557
 *             if params is not NULL:
 *                 # deallocate space for parameters
 *                 python.PyMem_Free(params)             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 */
      PyMem_Free(__pyx_v_params);
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":559
 *                 python.PyMem_Free(params)
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_3 = ((__pyx_v_transform_ctxt->state != XSLT_STATE_OK) != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":560
 * 
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_3 = ((__pyx_v_c_result != NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":561
 *             if transform_ctxt.state != xslt.XSLT_STATE_OK:
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 * 
 */
        xmlFreeDoc(__pyx_v_c_result);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":562
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 * 
 *             if transform_ctxt.profile:
 */
        __pyx_v_c_result = NULL;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":564
 *                     c_result = NULL
 * 
 *             if transform_ctxt.profile:             # <<<<<<<<<<<<<<
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
 */
    __pyx_t_3 = (__pyx_v_transform_ctxt->profile != 0);
    if (__pyx_t_3) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":565
 * 
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)             # <<<<<<<<<<<<<<
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
 */
      __pyx_v_c_profile_doc = xsltGetProfileInformation(__pyx_v_transform_ctxt);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":566
 *             if transform_ctxt.profile:
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:             # <<<<<<<<<<<<<<
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)
 */
      __pyx_t_3 = ((__pyx_v_c_profile_doc != NULL) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":568
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(
 *                         c_profile_doc, input_doc._parser)             # <<<<<<<<<<<<<<
 *         finally:
 *             if context is not None:
 */
        __pyx_t_1 = ((PyObject *)__pyx_v_input_doc->_parser);
        __Pyx_INCREF(__pyx_t_1);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":567
 *                 c_profile_doc = xslt.xsltGetProfileInformation(transform_ctxt)
 *                 if c_profile_doc is not NULL:
 *                     profile_doc = _documentFactory(             # <<<<<<<<<<<<<<
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 */
        __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_profile_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_profile_doc, ((struct LxmlDocument *)__pyx_t_5));
        __pyx_t_5 = 0;
        goto __pyx_L15;
      }
      __pyx_L15:;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":570
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = (((PyObject *)__pyx_v_context) != Py_None);
      __pyx_t_6 = (__pyx_t_3 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":571
 *         finally:
 *             if context is not None:
 *                 context.free_context()             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 * 
 */
        __pyx_t_5 = __pyx_f_4lxml_5etree_12_XSLTContext_free_context(__pyx_v_context); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":572
 *             if context is not None:
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);
      goto __pyx_L10;
    }
    /*exception exit:*/{
      __pyx_L9_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":570
 *                         c_profile_doc, input_doc._parser)
 *         finally:
 *             if context is not None:             # <<<<<<<<<<<<<<
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 */
        __pyx_t_6 = (((PyObject *)__pyx_v_context) != Py_None);
        __pyx_t_3 = (__pyx_t_6 != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":571
 *         finally:
 *             if context is not None:
 *                 context.free_context()             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 * 
 */
          __pyx_t_5 = __pyx_f_4lxml_5etree_12_XSLTContext_free_context(__pyx_v_context); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L19;
        }
        __pyx_L19:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":572
 *             if context is not None:
 *                 context.free_context()
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
        __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_input_doc->_c_doc, __pyx_v_c_doc);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L18_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L10:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":574
 *             _destroyFakeDoc(input_doc._c_doc, c_doc)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":575
 * 
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_3 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
    if ((__pyx_t_3 != 0)) {
      __pyx_t_6 = (((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._has_raised(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context)) != 0);
      __pyx_t_16 = __pyx_t_6;
    } else {
      __pyx_t_16 = (__pyx_t_3 != 0);
    }
    if (__pyx_t_16) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":576
 *         try:
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_16 = ((__pyx_v_c_result != NULL) != 0);
      if (__pyx_t_16) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":577
 *             if resolver_context is not None and resolver_context._has_raised():
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()
 */
        xmlFreeDoc(__pyx_v_c_result);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":578
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 resolver_context._raise_if_stored()
 * 
 */
        __pyx_v_c_result = NULL;
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":579
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 resolver_context._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if context._exc._has_raised():
 */
      __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._raise_if_stored(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
      goto __pyx_L23;
    }
    __pyx_L23:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":581
 *                 resolver_context._raise_if_stored()
 * 
 *             if context._exc._has_raised():             # <<<<<<<<<<<<<<
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 */
    __pyx_t_16 = (((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_has_raised(__pyx_v_context->__pyx_base._exc) != 0);
    if (__pyx_t_16) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":582
 * 
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:             # <<<<<<<<<<<<<<
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 */
      __pyx_t_16 = ((__pyx_v_c_result != NULL) != 0);
      if (__pyx_t_16) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":583
 *             if context._exc._has_raised():
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)             # <<<<<<<<<<<<<<
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()
 */
        xmlFreeDoc(__pyx_v_c_result);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":584
 *                 if c_result is not NULL:
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL             # <<<<<<<<<<<<<<
 *                 context._exc._raise_if_stored()
 * 
 */
        __pyx_v_c_result = NULL;
        goto __pyx_L26;
      }
      __pyx_L26:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":585
 *                     tree.xmlFreeDoc(c_result)
 *                     c_result = NULL
 *                 context._exc._raise_if_stored()             # <<<<<<<<<<<<<<
 * 
 *             if c_result is NULL:
 */
      __pyx_t_8 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_raise_if_stored(__pyx_v_context->__pyx_base._exc); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
      goto __pyx_L25;
    }
    __pyx_L25:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":587
 *                 context._exc._raise_if_stored()
 * 
 *             if c_result is NULL:             # <<<<<<<<<<<<<<
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
 */
    __pyx_t_16 = ((__pyx_v_c_result == NULL) != 0);
    if (__pyx_t_16) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":589
 *             if c_result is NULL:
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error             # <<<<<<<<<<<<<<
 *                 if error is not None and error.message:
 *                     if error.line > 0:
 */
      __pyx_t_5 = __pyx_v_self->_error_log->__pyx_base.__pyx_base.last_error;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_error = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":590
 *                 # last error seems to be the most accurate here
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:             # <<<<<<<<<<<<<<
 *                     if error.line > 0:
 *                         message = u"%s, line %d" % (error.message, error.line)
 */
      __pyx_t_16 = (__pyx_v_error != Py_None);
      if (__pyx_t_16) {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = __pyx_t_3;
      } else {
        __pyx_t_6 = __pyx_t_16;
      }
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":591
 *                 error = self._error_log.last_error
 *                 if error is not None and error.message:
 *                     if error.line > 0:             # <<<<<<<<<<<<<<
 *                         message = u"%s, line %d" % (error.message, error.line)
 *                     else:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":592
 *                 if error is not None and error.message:
 *                     if error.line > 0:
 *                         message = u"%s, line %d" % (error.message, error.line)             # <<<<<<<<<<<<<<
 *                     else:
 *                         message = error.message
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
          __Pyx_GOTREF(__pyx_t_17);
          PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_5);
          __pyx_t_1 = 0;
          __pyx_t_5 = 0;
          __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_s_line_d, __pyx_t_17); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_v_message = __pyx_t_5;
          __pyx_t_5 = 0;
          goto __pyx_L29;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":594
 *                         message = u"%s, line %d" % (error.message, error.line)
 *                     else:
 *                         message = error.message             # <<<<<<<<<<<<<<
 *                 elif error is not None and error.line > 0:
 *                     message = u"Error applying stylesheet, line %d" % error.line
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_v_message = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        __pyx_L29:;
        goto __pyx_L28;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":595
 *                     else:
 *                         message = error.message
 *                 elif error is not None and error.line > 0:             # <<<<<<<<<<<<<<
 *                     message = u"Error applying stylesheet, line %d" % error.line
 *                 else:
 */
      __pyx_t_6 = (__pyx_v_error != Py_None);
      if (__pyx_t_6) {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_17 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_3 = __pyx_t_16;
      } else {
        __pyx_t_3 = __pyx_t_6;
      }
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":596
 *                         message = error.message
 *                 elif error is not None and error.line > 0:
 *                     message = u"Error applying stylesheet, line %d" % error.line             # <<<<<<<<<<<<<<
 *                 else:
 *                     message = u"Error applying stylesheet"
 */
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_error, __pyx_n_s_line); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_Error_applying_stylesheet_line_d, __pyx_t_17); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_v_message = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L28;
      }
      /*else*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":598
 *                     message = u"Error applying stylesheet, line %d" % error.line
 *                 else:
 *                     message = u"Error applying stylesheet"             # <<<<<<<<<<<<<<
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 */
        __Pyx_INCREF(__pyx_kp_u_Error_applying_stylesheet);
        __pyx_v_message = __pyx_kp_u_Error_applying_stylesheet;
      }
      __pyx_L28:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":599
 *                 else:
 *                     message = u"Error applying stylesheet"
 *                 raise XSLTApplyError(message, self._error_log)             # <<<<<<<<<<<<<<
 *         finally:
 *             if resolver_context is not None:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTApplyError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
      PyTuple_SET_ITEM(__pyx_t_17, 1, ((PyObject *)__pyx_v_self->_error_log));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":601
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
      __pyx_t_6 = (__pyx_t_3 != 0);
      if (__pyx_t_6) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":602
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context));
        goto __pyx_L30;
      }
      __pyx_L30:;
      goto __pyx_L22;
    }
    /*exception exit:*/{
      __pyx_L21_error:;
      __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __pyx_t_8 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
      {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":601
 *                 raise XSLTApplyError(message, self._error_log)
 *         finally:
 *             if resolver_context is not None:             # <<<<<<<<<<<<<<
 *                 resolver_context.clear()
 * 
 */
        __pyx_t_6 = (((PyObject *)__pyx_v_resolver_context) != Py_None);
        __pyx_t_3 = (__pyx_t_6 != 0);
        if (__pyx_t_3) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":602
 *         finally:
 *             if resolver_context is not None:
 *                 resolver_context.clear()             # <<<<<<<<<<<<<<
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 */
          ((struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext *)__pyx_v_resolver_context->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.clear(((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_v_resolver_context));
          goto __pyx_L33;
        }
        __pyx_L33:;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_18;
      goto __pyx_L1_error;
    }
    __pyx_L22:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":604
 *                 resolver_context.clear()
 * 
 *         result_doc = _documentFactory(c_result, input_doc._parser)             # <<<<<<<<<<<<<<
 * 
 *         c_dict = c_result.dict
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_input_doc->_parser);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_17 = ((PyObject *)__pyx_f_4lxml_5etree__documentFactory(__pyx_v_c_result, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_1))); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_17);
  __pyx_t_17 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":606
 *         result_doc = _documentFactory(c_result, input_doc._parser)
 * 
 *         c_dict = c_result.dict             # <<<<<<<<<<<<<<
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 */
  __pyx_t_4 = __pyx_v_c_result->dict;
  __pyx_v_c_dict = __pyx_t_4;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":607
 * 
 *         c_dict = c_result.dict
 *         xmlparser.xmlDictReference(c_dict)             # <<<<<<<<<<<<<<
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \
 */
  xmlDictReference(__pyx_v_c_dict);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":608
 *         c_dict = c_result.dict
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)             # <<<<<<<<<<<<<<
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, (&__pyx_v_c_result->dict));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":609
 *         xmlparser.xmlDictReference(c_dict)
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 */
  __pyx_t_3 = ((__pyx_v_c_dict != __pyx_v_c_result->dict) != 0);
  if (!__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":610
 *         __GLOBAL_PARSER_CONTEXT.initThreadDictRef(&c_result.dict)
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \             # <<<<<<<<<<<<<<
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
 */
    __pyx_t_6 = ((__pyx_v_self->_c_style->doc->dict != __pyx_v_c_result->dict) != 0);
    if (!__pyx_t_6) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":611
 *         if c_dict is not c_result.dict or \
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 if c_dict is not c_result.dict:
 */
      __pyx_t_16 = ((__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict) != 0);
      __pyx_t_19 = __pyx_t_16;
    } else {
      __pyx_t_19 = __pyx_t_6;
    }
    __pyx_t_6 = __pyx_t_19;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (__pyx_t_6) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":612
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":613
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:
 *                 if c_dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
 */
          __pyx_t_6 = ((__pyx_v_c_dict != __pyx_v_c_result->dict) != 0);
          if (__pyx_t_6) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":614
 *             with nogil:
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,             # <<<<<<<<<<<<<<
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:
 */
            __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_c_dict, __pyx_v_c_result->dict);
            goto __pyx_L38;
          }
          __pyx_L38:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":616
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
 */
          __pyx_t_6 = ((__pyx_v_self->_c_style->doc->dict != __pyx_v_c_result->dict) != 0);
          if (__pyx_t_6) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":617
 *                                        c_dict, c_result.dict)
 *                 if self._c_style.doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,             # <<<<<<<<<<<<<<
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:
 */
            __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_self->_c_style->doc->dict, __pyx_v_c_result->dict);
            goto __pyx_L39;
          }
          __pyx_L39:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":619
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:             # <<<<<<<<<<<<<<
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)
 */
          __pyx_t_6 = ((__pyx_v_input_doc->_c_doc->dict != __pyx_v_c_result->dict) != 0);
          if (__pyx_t_6) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":620
 *                                        self._c_style.doc.dict, c_result.dict)
 *                 if input_doc._c_doc.dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,             # <<<<<<<<<<<<<<
 *                                        input_doc._c_doc.dict, c_result.dict)
 *         xmlparser.xmlDictFree(c_dict)
 */
            __pyx_f_4lxml_5etree_fixThreadDictNames(((xmlNode *)__pyx_v_c_result), __pyx_v_input_doc->_c_doc->dict, __pyx_v_c_result->dict);
            goto __pyx_L40;
          }
          __pyx_L40:;
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":612
 *                 self._c_style.doc.dict is not c_result.dict or \
 *                 input_doc._c_doc.dict is not c_result.dict:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 if c_dict is not c_result.dict:
 *                     fixThreadDictNames(<xmlNode*>c_result,
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L37;
          }
          __pyx_L37:;
        }
    }
    goto __pyx_L34;
  }
  __pyx_L34:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":622
 *                     fixThreadDictNames(<xmlNode*>c_result,
 *                                        input_doc._c_doc.dict, c_result.dict)
 *         xmlparser.xmlDictFree(c_dict)             # <<<<<<<<<<<<<<
 * 
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 */
  xmlDictFree(__pyx_v_c_dict);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":624
 *         xmlparser.xmlDictFree(c_dict)
 * 
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_17 = __pyx_f_4lxml_5etree__xsltResultTreeFactory(__pyx_v_result_doc, __pyx_v_self, __pyx_v_profile_doc); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_r = __pyx_t_17;
  __pyx_t_17 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":489
 *         return _copyXSLT(self)
 * 
 *     def __call__(self, _input, *, profile_run=False, **kw):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, _input, profile_run=False, **kw)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("lxml.etree.XSLT.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_resolver_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_input_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_profile_doc);
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":626
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,             # <<<<<<<<<<<<<<
 *                                 const_char** params, _XSLTContext context,
 *                                 xslt.xsltTransformContext* transform_ctxt):
 */

static xmlDoc *__pyx_f_4lxml_5etree_4XSLT__run_transform(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_self, xmlDoc *__pyx_v_c_input_doc, const char **__pyx_v_params, CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xsltTransformContext *__pyx_v_transform_ctxt) {
  xmlDoc *__pyx_v_c_result;
  xmlDoc *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_run_transform", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":630
 *                                 xslt.xsltTransformContext* transform_ctxt):
 *         cdef xmlDoc* c_result
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,             # <<<<<<<<<<<<<<
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:
 */
  xsltSetTransformErrorFunc(__pyx_v_transform_ctxt, ((void *)__pyx_v_self->_error_log), ((xmlGenericErrorFunc)__pyx_f_4lxml_5etree__receiveXSLTError));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":632
 *         xslt.xsltSetTransformErrorFunc(transform_ctxt, <void*>self._error_log,
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:             # <<<<<<<<<<<<<<
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_access_control) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":633
 *                                        <xmlerror.xmlGenericErrorFunc>_receiveXSLTError)
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             c_result = xslt.xsltApplyStylesheetUser(
 */
    __pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context(__pyx_v_self->_access_control, __pyx_v_transform_ctxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":634
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":635
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:
 *             c_result = xslt.xsltApplyStylesheetUser(             # <<<<<<<<<<<<<<
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *         return c_result
 */
        __pyx_v_c_result = xsltApplyStylesheetUser(__pyx_v_self->_c_style, __pyx_v_c_input_doc, __pyx_v_params, NULL, NULL, __pyx_v_transform_ctxt);
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":634
 *         if self._access_control is not None:
 *             self._access_control._register_in_context(transform_ctxt)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":637
 *             c_result = xslt.xsltApplyStylesheetUser(
 *                 self._c_style, c_input_doc, params, NULL, NULL, transform_ctxt)
 *         return c_result             # <<<<<<<<<<<<<<
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,
 */
  __pyx_r = __pyx_v_c_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":626
 *         return _xsltResultTreeFactory(result_doc, self, profile_doc)
 * 
 *     cdef xmlDoc* _run_transform(self, xmlDoc* c_input_doc,             # <<<<<<<<<<<<<<
 *                                 const_char** params, _XSLTContext context,
 *                                 xslt.xsltTransformContext* transform_ctxt):
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":639
 *         return c_result
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,             # <<<<<<<<<<<<<<
 *                               dict parameters, const_char*** params_ptr):
 *     cdef Py_ssize_t i, parameter_count
 */

static PyObject *__pyx_f_4lxml_5etree__convert_xslt_parameters(xsltTransformContext *__pyx_v_transform_ctxt, PyObject *__pyx_v_parameters, const char ***__pyx_v_params_ptr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_parameter_count;
  const char **__pyx_v_params;
  xmlDict *__pyx_v_c_dict;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlDict *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_xslt_parameters", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":643
 *     cdef Py_ssize_t i, parameter_count
 *     cdef const_char** params
 *     cdef tree.xmlDict* c_dict = transform_ctxt.dict             # <<<<<<<<<<<<<<
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
 */
  __pyx_t_1 = __pyx_v_transform_ctxt->dict;
  __pyx_v_c_dict = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":644
 *     cdef const_char** params
 *     cdef tree.xmlDict* c_dict = transform_ctxt.dict
 *     params_ptr[0] = NULL             # <<<<<<<<<<<<<<
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:
 */
  (__pyx_v_params_ptr[0]) = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":645
 *     cdef tree.xmlDict* c_dict = transform_ctxt.dict
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)             # <<<<<<<<<<<<<<
 *     if parameter_count == 0:
 *         return
 */
  if (unlikely(__pyx_v_parameters == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyDict_Size(__pyx_v_parameters); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_parameter_count = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":646
 *     params_ptr[0] = NULL
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:             # <<<<<<<<<<<<<<
 *         return
 *     # allocate space for parameters
 */
  __pyx_t_3 = ((__pyx_v_parameter_count == 0) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":647
 *     parameter_count = len(parameters)
 *     if parameter_count == 0:
 *         return             # <<<<<<<<<<<<<<
 *     # allocate space for parameters
 *     # * 2 as we want an entry for both key and value,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":651
 *     # * 2 as we want an entry for both key and value,
 *     # and + 1 as array is NULL terminated
 *     params = <const_char**>python.PyMem_Malloc(             # <<<<<<<<<<<<<<
 *         sizeof(const_char*) * (parameter_count * 2 + 1))
 *     try:
 */
  __pyx_v_params = ((const char **)PyMem_Malloc(((sizeof(const char *)) * ((__pyx_v_parameter_count * 2) + 1))));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":653
 *     params = <const_char**>python.PyMem_Malloc(
 *         sizeof(const_char*) * (parameter_count * 2 + 1))
 *     try:             # <<<<<<<<<<<<<<
 *         i = 0
 *         for key, value in parameters.iteritems():
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":654
 *         sizeof(const_char*) * (parameter_count * 2 + 1))
 *     try:
 *         i = 0             # <<<<<<<<<<<<<<
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 */
      __pyx_v_i = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":655
 *     try:
 *         i = 0
 *         for key, value in parameters.iteritems():             # <<<<<<<<<<<<<<
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):
 */
      __pyx_t_2 = 0;
      if (unlikely(__pyx_v_parameters == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      }
      __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_parameters, 1, __pyx_n_s_iteritems, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_7);
      __pyx_t_7 = __pyx_t_10;
      __pyx_t_10 = 0;
      while (1) {
        __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_8, &__pyx_t_2, &__pyx_t_10, &__pyx_t_11, NULL, __pyx_t_9);
        if (unlikely(__pyx_t_12 == 0)) break;
        if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_10);
        __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":656
 *         i = 0
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)             # <<<<<<<<<<<<<<
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval
 */
        __pyx_t_11 = __pyx_f_4lxml_5etree__utf8(__pyx_v_key); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_11));
        __pyx_t_11 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":657
 *         for key, value in parameters.iteritems():
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):             # <<<<<<<<<<<<<<
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(
 */
        __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree__XSLTQuotedStringParam)); 
        __pyx_t_13 = (__pyx_t_3 != 0);
        if (__pyx_t_13) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":658
 *             k = _utf8(key)
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval             # <<<<<<<<<<<<<<
 *                 xslt.xsltQuoteOneUserParam(
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 */
          __pyx_t_11 = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)__pyx_v_value)->strval;
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
          __pyx_t_11 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":659
 *             if isinstance(value, _XSLTQuotedStringParam):
 *                 v = (<_XSLTQuotedStringParam>value).strval
 *                 xslt.xsltQuoteOneUserParam(             # <<<<<<<<<<<<<<
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 */
          xsltQuoteOneUserParam(__pyx_v_transform_ctxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_k), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_v));
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":662
 *                     transform_ctxt, _xcstr(k), _xcstr(v))
 *             else:
 *                 if isinstance(value, XPath):             # <<<<<<<<<<<<<<
 *                     v = (<XPath>value)._path
 *                 else:
 */
          __pyx_t_13 = __Pyx_TypeCheck(__pyx_v_value, ((PyObject*)__pyx_ptype_4lxml_5etree_XPath)); 
          __pyx_t_3 = (__pyx_t_13 != 0);
          if (__pyx_t_3) {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":663
 *             else:
 *                 if isinstance(value, XPath):
 *                     v = (<XPath>value)._path             # <<<<<<<<<<<<<<
 *                 else:
 *                     v = _utf8(value)
 */
            __pyx_t_11 = ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_v_value)->_path;
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;
            goto __pyx_L15;
          }
          /*else*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":665
 *                     v = (<XPath>value)._path
 *                 else:
 *                     v = _utf8(value)             # <<<<<<<<<<<<<<
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(k), len(k))
 *                 i += 1
 */
            __pyx_t_11 = __pyx_f_4lxml_5etree__utf8(__pyx_v_value); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_XDECREF_SET(__pyx_v_v, ((PyObject*)__pyx_t_11));
            __pyx_t_11 = 0;
          }
          __pyx_L15:;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":666
 *                 else:
 *                     v = _utf8(value)
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(k), len(k))             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))
 */
          if (unlikely(__pyx_v_k == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          }
          __pyx_t_14 = PyBytes_GET_SIZE(__pyx_v_k); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          (__pyx_v_params[__pyx_v_i]) = ((const char *)xmlDictLookup(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_k), __pyx_t_14));

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":667
 *                     v = _utf8(value)
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(k), len(k))
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))
 *                 i += 1
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":668
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(k), len(k))
 *                 i += 1
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))             # <<<<<<<<<<<<<<
 *                 i += 1
 *     except:
 */
          if (unlikely(__pyx_v_v == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          }
          __pyx_t_14 = PyBytes_GET_SIZE(__pyx_v_v); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
          (__pyx_v_params[__pyx_v_i]) = ((const char *)xmlDictLookup(__pyx_v_c_dict, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_v), __pyx_t_14));

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":669
 *                 i += 1
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))
 *                 i += 1             # <<<<<<<<<<<<<<
 *     except:
 *         python.PyMem_Free(params)
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }
        __pyx_L14:;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":670
 *                 params[i] = <const_char*>tree.xmlDictLookup(c_dict, _xcstr(v), len(v))
 *                 i += 1
 *     except:             # <<<<<<<<<<<<<<
 *         python.PyMem_Free(params)
 *         raise
 */
    /*except:*/ {
      __Pyx_AddTraceback("lxml.etree._convert_xslt_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GOTREF(__pyx_t_10);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":671
 *                 i += 1
 *     except:
 *         python.PyMem_Free(params)             # <<<<<<<<<<<<<<
 *         raise
 *     params[i] = NULL
 */
      PyMem_Free(__pyx_v_params);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":672
 *     except:
 *         python.PyMem_Free(params)
 *         raise             # <<<<<<<<<<<<<<
 *     params[i] = NULL
 *     params_ptr[0] = params
 */
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_11, __pyx_t_10);
      __pyx_t_7 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; 
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L11_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":673
 *         python.PyMem_Free(params)
 *         raise
 *     params[i] = NULL             # <<<<<<<<<<<<<<
 *     params_ptr[0] = params
 * 
 */
  (__pyx_v_params[__pyx_v_i]) = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":674
 *         raise
 *     params[i] = NULL
 *     params_ptr[0] = params             # <<<<<<<<<<<<<<
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):
 */
  (__pyx_v_params_ptr[0]) = __pyx_v_params;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":639
 *         return c_result
 * 
 * cdef _convert_xslt_parameters(xslt.xsltTransformContext* transform_ctxt,             # <<<<<<<<<<<<<<
 *                               dict parameters, const_char*** params_ptr):
 *     cdef Py_ssize_t i, parameter_count
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree._convert_xslt_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":676
 *     params_ptr[0] = params
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):             # <<<<<<<<<<<<<<
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
 */

static struct __pyx_obj_4lxml_5etree_XSLT *__pyx_f_4lxml_5etree__copyXSLT(struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_stylesheet) {
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_new_xslt = 0;
  xmlDoc *__pyx_v_c_doc;
  struct __pyx_obj_4lxml_5etree_XSLT *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlDoc *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyXSLT", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":679
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"             # <<<<<<<<<<<<<<
 *     new_xslt = XSLT.__new__(XSLT)
 *     new_xslt._access_control = stylesheet._access_control
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_stylesheet->_c_style != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XSLT_stylesheet_not_initialised);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":680
 *     cdef xmlDoc* c_doc
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"
 *     new_xslt = XSLT.__new__(XSLT)             # <<<<<<<<<<<<<<
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()
 */
  __pyx_t_1 = __pyx_tp_new_4lxml_5etree_XSLT(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLT)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree_XSLT)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_new_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":681
 *     assert stylesheet._c_style is not NULL, "XSLT stylesheet not initialised"
 *     new_xslt = XSLT.__new__(XSLT)
 *     new_xslt._access_control = stylesheet._access_control             # <<<<<<<<<<<<<<
 *     new_xslt._error_log = _ErrorLog()
 *     new_xslt._context = stylesheet._context._copy()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_stylesheet->_access_control);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_access_control);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_access_control));
  __pyx_v_new_xslt->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":682
 *     new_xslt = XSLT.__new__(XSLT)
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 *     new_xslt._context = stylesheet._context._copy()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_error_log));
  __pyx_v_new_xslt->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":683
 *     new_xslt._access_control = stylesheet._access_control
 *     new_xslt._error_log = _ErrorLog()
 *     new_xslt._context = stylesheet._context._copy()             # <<<<<<<<<<<<<<
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy(((struct __pyx_obj_4lxml_5etree__BaseContext *)__pyx_v_stylesheet->_context))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__XSLTContext))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_context));
  __pyx_v_new_xslt->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":685
 *     new_xslt._context = stylesheet._context._copy()
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()             # <<<<<<<<<<<<<<
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy(__pyx_v_stylesheet->_xslt_resolver_context)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_new_xslt->_xslt_resolver_context);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_xslt->_xslt_resolver_context));
  __pyx_v_new_xslt->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":686
 * 
 *     new_xslt._xslt_resolver_context = stylesheet._xslt_resolver_context._copy()
 *     new_xslt._xslt_resolver_context._c_style_doc = _copyDoc(             # <<<<<<<<<<<<<<
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 * 
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_xslt_resolver_context->_c_style_doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_new_xslt->_xslt_resolver_context->_c_style_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":689
 *         stylesheet._xslt_resolver_context._c_style_doc, 1)
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)             # <<<<<<<<<<<<<<
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__copyDoc(__pyx_v_stylesheet->_c_style->doc, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_doc = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":690
 * 
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)             # <<<<<<<<<<<<<<
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
 */
  __pyx_v_new_xslt->_c_style = xsltParseStylesheetDoc(__pyx_v_c_doc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":691
 *     c_doc = _copyDoc(stylesheet._c_style.doc, 1)
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()
 */
  __pyx_t_3 = ((__pyx_v_new_xslt->_c_style == NULL) != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":692
 *     new_xslt._c_style = xslt.xsltParseStylesheetDoc(c_doc)
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)             # <<<<<<<<<<<<<<
 *         raise MemoryError()
 * 
 */
    xmlFreeDoc(__pyx_v_c_doc);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":693
 *     if new_xslt._c_style is NULL:
 *         tree.xmlFreeDoc(c_doc)
 *         raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     return new_xslt
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":695
 *         raise MemoryError()
 * 
 *     return new_xslt             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_new_xslt));
  __pyx_r = __pyx_v_new_xslt;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":676
 *     params_ptr[0] = params
 * 
 * cdef XSLT _copyXSLT(XSLT stylesheet):             # <<<<<<<<<<<<<<
 *     cdef XSLT new_xslt
 *     cdef xmlDoc* c_doc
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._copyXSLT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_xslt);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":704
 *     cdef Py_ssize_t _buffer_len
 *     cdef Py_ssize_t _buffer_refcnt
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._buffer = NULL
 *         self._buffer_len = 0
 */

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

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

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree___cinit__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":705
 *     cdef Py_ssize_t _buffer_refcnt
 *     def __cinit__(self):
 *         self._buffer = NULL             # <<<<<<<<<<<<<<
 *         self._buffer_len = 0
 *         self._buffer_refcnt = 0
 */
  __pyx_v_self->_buffer = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":706
 *     def __cinit__(self):
 *         self._buffer = NULL
 *         self._buffer_len = 0             # <<<<<<<<<<<<<<
 *         self._buffer_refcnt = 0
 * 
 */
  __pyx_v_self->_buffer_len = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":707
 *         self._buffer = NULL
 *         self._buffer_len = 0
 *         self._buffer_refcnt = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):
 */
  __pyx_v_self->_buffer_refcnt = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":704
 *     cdef Py_ssize_t _buffer_len
 *     cdef Py_ssize_t _buffer_refcnt
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._buffer = NULL
 *         self._buffer_len = 0
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":709
 *         self._buffer_refcnt = 0
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r
 */

static PyObject *__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, xmlChar **__pyx_v_s, int *__pyx_v_l) {
  struct LxmlDocument *__pyx_v_doc = 0;
  int __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_saveToStringAndSize", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":712
 *         cdef _Document doc
 *         cdef int r
 *         if self._context_node is not None:             # <<<<<<<<<<<<<<
 *             doc = self._context_node._doc
 *         else:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._context_node) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":713
 *         cdef int r
 *         if self._context_node is not None:
 *             doc = self._context_node._doc             # <<<<<<<<<<<<<<
 *         else:
 *             doc = None
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base._context_node->_doc);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":715
 *             doc = self._context_node._doc
 *         else:
 *             doc = None             # <<<<<<<<<<<<<<
 *         if doc is None:
 *             doc = self._doc
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_doc = ((struct LxmlDocument *)Py_None);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":716
 *         else:
 *             doc = None
 *         if doc is None:             # <<<<<<<<<<<<<<
 *             doc = self._doc
 *             if doc is None:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_doc) == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":717
 *             doc = None
 *         if doc is None:
 *             doc = self._doc             # <<<<<<<<<<<<<<
 *             if doc is None:
 *                 s[0] = NULL
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_doc, ((struct LxmlDocument *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":718
 *         if doc is None:
 *             doc = self._doc
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 s[0] = NULL
 *                 return
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":719
 *             doc = self._doc
 *             if doc is None:
 *                 s[0] = NULL             # <<<<<<<<<<<<<<
 *                 return
 *         with nogil:
 */
      (__pyx_v_s[0]) = NULL;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":720
 *             if doc is None:
 *                 s[0] = NULL
 *                 return             # <<<<<<<<<<<<<<
 *         with nogil:
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":721
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":722
 *                 return
 *         with nogil:
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,             # <<<<<<<<<<<<<<
 *                                             self._xslt._c_style)
 *         if r == -1:
 */
        __pyx_v_r = xsltSaveResultToString(__pyx_v_s, __pyx_v_l, __pyx_v_doc->_c_doc, __pyx_v_self->_xslt->_c_style);
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":721
 *                 s[0] = NULL
 *                 return
 *         with nogil:             # <<<<<<<<<<<<<<
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L8;
        }
        __pyx_L8:;
      }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":724
 *             r = xslt.xsltSaveResultToString(s, l, doc._c_doc,
 *                                             self._xslt._c_style)
 *         if r == -1:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_2 = ((__pyx_v_r == -1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":725
 *                                             self._xslt._c_style)
 *         if r == -1:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":709
 *         self._buffer_refcnt = 0
 * 
 *     cdef _saveToStringAndSize(self, xmlChar** s, int* l):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef int r
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree._saveToStringAndSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":727
 *             raise MemoryError()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_2__str__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  xmlChar *__pyx_v_s;
  int __pyx_v_l;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":728
 * 
 *     def __str__(self):
 *         cdef xmlChar* s = NULL             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         if python.IS_PYTHON3:
 */
  __pyx_v_s = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":729
 *     def __str__(self):
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         if python.IS_PYTHON3:
 *             return self.__unicode__()
 */
  __pyx_v_l = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":730
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0
 *         if python.IS_PYTHON3:             # <<<<<<<<<<<<<<
 *             return self.__unicode__()
 *         self._saveToStringAndSize(&s, &l)
 */
  __pyx_t_1 = (IS_PYTHON3 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":731
 *         cdef int l = 0
 *         if python.IS_PYTHON3:
 *             return self.__unicode__()             # <<<<<<<<<<<<<<
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unicode_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 731; __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;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":732
 *         if python.IS_PYTHON3:
 *             return self.__unicode__()
 *         self._saveToStringAndSize(&s, &l)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             return ''
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(__pyx_v_self, (&__pyx_v_s), (&__pyx_v_l)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":733
 *             return self.__unicode__()
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         # we must not use 'funicode' here as this is not always UTF-8
 */
  __pyx_t_1 = ((__pyx_v_s == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":734
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 *             return ''             # <<<<<<<<<<<<<<
 *         # we must not use 'funicode' here as this is not always UTF-8
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s__15);
    __pyx_r = __pyx_kp_s__15;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":736
 *             return ''
 *         # we must not use 'funicode' here as this is not always UTF-8
 *         try:             # <<<<<<<<<<<<<<
 *             result = <bytes>s[:l]
 *         finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":737
 *         # we must not use 'funicode' here as this is not always UTF-8
 *         try:
 *             result = <bytes>s[:l]             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
    __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_s) + 0, __pyx_v_l - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":739
 *             result = <bytes>s[:l]
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_s);
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlFree(__pyx_v_s);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":740
 *         finally:
 *             tree.xmlFree(s)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def __unicode__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":727
 *             raise MemoryError()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":742
 *         return result
 * 
 *     def __unicode__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_5__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_5__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__unicode__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_4__unicode__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_4__unicode__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  xmlChar *__pyx_v_encoding;
  xmlChar *__pyx_v_s;
  int __pyx_v_l;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlChar *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__unicode__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":744
 *     def __unicode__(self):
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 */
  __pyx_v_s = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":745
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 */
  __pyx_v_l = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":746
 *         cdef xmlChar* s = NULL
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)             # <<<<<<<<<<<<<<
 *         if s is NULL:
 *             return u''
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(__pyx_v_self, (&__pyx_v_s), (&__pyx_v_l)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":747
 *         cdef int l = 0
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:             # <<<<<<<<<<<<<<
 *             return u''
 *         encoding = self._xslt._c_style.encoding
 */
  __pyx_t_2 = ((__pyx_v_s == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":748
 *         self._saveToStringAndSize(&s, &l)
 *         if s is NULL:
 *             return u''             # <<<<<<<<<<<<<<
 *         encoding = self._xslt._c_style.encoding
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_u__15);
    __pyx_r = __pyx_kp_u__15;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":749
 *         if s is NULL:
 *             return u''
 *         encoding = self._xslt._c_style.encoding             # <<<<<<<<<<<<<<
 *         try:
 *             if encoding is NULL:
 */
  __pyx_t_3 = __pyx_v_self->_xslt->_c_style->encoding;
  __pyx_v_encoding = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":750
 *             return u''
 *         encoding = self._xslt._c_style.encoding
 *         try:             # <<<<<<<<<<<<<<
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":751
 *         encoding = self._xslt._c_style.encoding
 *         try:
 *             if encoding is NULL:             # <<<<<<<<<<<<<<
 *                 result = s[:l].decode('UTF-8')
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_encoding == NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":752
 *         try:
 *             if encoding is NULL:
 *                 result = s[:l].decode('UTF-8')             # <<<<<<<<<<<<<<
 *             else:
 *                 result = s[:l].decode(encoding)
 */
      __pyx_t_1 = __Pyx_decode_c_string(((char *)__pyx_v_s), 0, __pyx_v_l, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":754
 *                 result = s[:l].decode('UTF-8')
 *             else:
 *                 result = s[:l].decode(encoding)             # <<<<<<<<<<<<<<
 *         finally:
 *             tree.xmlFree(s)
 */
      __pyx_t_1 = __Pyx_decode_c_string(((char *)__pyx_v_s), 0, __pyx_v_l, ((char *)__pyx_v_encoding), NULL, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":756
 *                 result = s[:l].decode(encoding)
 *         finally:
 *             tree.xmlFree(s)             # <<<<<<<<<<<<<<
 *         return _stripEncodingDeclaration(result)
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFree(__pyx_v_s);
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlFree(__pyx_v_s);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":757
 *         finally:
 *             tree.xmlFree(s)
 *         return _stripEncodingDeclaration(result)             # <<<<<<<<<<<<<<
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__stripEncodingDeclaration(__pyx_v_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":742
 *         return result
 * 
 *     def __unicode__(self):             # <<<<<<<<<<<<<<
 *         cdef xmlChar* encoding
 *         cdef xmlChar* s = NULL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__unicode__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":759
 *         return _stripEncodingDeclaration(result)
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         if buffer is NULL:
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__getbuffer__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer), ((int)__pyx_v_flags));

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

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_6__getbuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  int __pyx_v_l;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  xmlChar *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_buffer != NULL) {
    __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_buffer->obj);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":760
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l = 0             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */
  __pyx_v_l = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":761
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):
 *         cdef int l = 0
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 */
  __pyx_t_1 = ((__pyx_v_buffer == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":762
 *         cdef int l = 0
 *         if buffer is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":763
 *         if buffer is NULL:
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
 */
  __pyx_t_1 = (__pyx_v_self->_buffer == NULL);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":764
 *             return
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)             # <<<<<<<<<<<<<<
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize(__pyx_v_self, ((xmlChar **)(&__pyx_v_buffer->buf)), (&__pyx_v_l)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":765
 *         if self._buffer is NULL or flags & python.PyBUF_WRITABLE:
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l             # <<<<<<<<<<<<<<
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <xmlChar*>buffer.buf
 */
    __pyx_v_buffer->len = __pyx_v_l;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":766
 *             self._saveToStringAndSize(<xmlChar**>&buffer.buf, &l)
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l
 */
    __pyx_t_2 = ((__pyx_v_self->_buffer == NULL) != 0);
    if (__pyx_t_2) {
      __pyx_t_1 = ((!((__pyx_v_flags & PyBUF_WRITABLE) != 0)) != 0);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":767
 *             buffer.len = l
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <xmlChar*>buffer.buf             # <<<<<<<<<<<<<<
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1
 */
      __pyx_v_self->_buffer = ((xmlChar *)__pyx_v_buffer->buf);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":768
 *             if self._buffer is NULL and not flags & python.PyBUF_WRITABLE:
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l             # <<<<<<<<<<<<<<
 *                 self._buffer_refcnt = 1
 *         else:
 */
      __pyx_v_self->_buffer_len = __pyx_v_l;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":769
 *                 self._buffer = <xmlChar*>buffer.buf
 *                 self._buffer_len = l
 *                 self._buffer_refcnt = 1             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.buf = self._buffer
 */
      __pyx_v_self->_buffer_refcnt = 1;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":771
 *                 self._buffer_refcnt = 1
 *         else:
 *             buffer.buf = self._buffer             # <<<<<<<<<<<<<<
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 */
    __pyx_t_5 = __pyx_v_self->_buffer;
    __pyx_v_buffer->buf = __pyx_t_5;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":772
 *         else:
 *             buffer.buf = self._buffer
 *             buffer.len = self._buffer_len             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 */
    __pyx_t_6 = __pyx_v_self->_buffer_len;
    __pyx_v_buffer->len = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":773
 *             buffer.buf = self._buffer
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0
 */
    __pyx_v_self->_buffer_refcnt = (__pyx_v_self->_buffer_refcnt + 1);
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":774
 *             buffer.len = self._buffer_len
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *             buffer.readonly = 0
 *         else:
 */
  __pyx_t_4 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":775
 *             self._buffer_refcnt += 1
 *         if flags & python.PyBUF_WRITABLE:
 *             buffer.readonly = 0             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.readonly = 1
 */
    __pyx_v_buffer->readonly = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":777
 *             buffer.readonly = 0
 *         else:
 *             buffer.readonly = 1             # <<<<<<<<<<<<<<
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"
 */
    __pyx_v_buffer->readonly = 1;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":778
 *         else:
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             buffer.format = "B"
 *         else:
 */
  __pyx_t_4 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":779
 *             buffer.readonly = 1
 *         if flags & python.PyBUF_FORMAT:
 *             buffer.format = "B"             # <<<<<<<<<<<<<<
 *         else:
 *             buffer.format = NULL
 */
    __pyx_v_buffer->format = __pyx_k_B;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":781
 *             buffer.format = "B"
 *         else:
 *             buffer.format = NULL             # <<<<<<<<<<<<<<
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 */
    __pyx_v_buffer->format = NULL;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":782
 *         else:
 *             buffer.format = NULL
 *         buffer.ndim = 0             # <<<<<<<<<<<<<<
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 */
  __pyx_v_buffer->ndim = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":783
 *             buffer.format = NULL
 *         buffer.ndim = 0
 *         buffer.shape = NULL             # <<<<<<<<<<<<<<
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
 */
  __pyx_v_buffer->shape = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":784
 *         buffer.ndim = 0
 *         buffer.shape = NULL
 *         buffer.strides = NULL             # <<<<<<<<<<<<<<
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
 */
  __pyx_v_buffer->strides = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":785
 *         buffer.shape = NULL
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 */
  __pyx_v_buffer->suboffsets = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":786
 *         buffer.strides = NULL
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1             # <<<<<<<<<<<<<<
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?
 */
  __pyx_v_buffer->itemsize = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":787
 *         buffer.suboffsets = NULL
 *         buffer.itemsize = 1
 *         buffer.internal = NULL             # <<<<<<<<<<<<<<
 *         if buffer.obj is not self: # set by Cython?
 *             buffer.obj = self
 */
  __pyx_v_buffer->internal = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":788
 *         buffer.itemsize = 1
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?             # <<<<<<<<<<<<<<
 *             buffer.obj = self
 * 
 */
  __pyx_t_4 = (__pyx_v_buffer->obj != ((PyObject *)__pyx_v_self));
  __pyx_t_2 = (__pyx_t_4 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":789
 *         buffer.internal = NULL
 *         if buffer.obj is not self: # set by Cython?
 *             buffer.obj = self             # <<<<<<<<<<<<<<
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj);
    __pyx_v_buffer->obj = ((PyObject *)__pyx_v_self);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":759
 *         return _stripEncodingDeclaration(result)
 * 
 *     def __getbuffer__(self, Py_buffer* buffer, int flags):             # <<<<<<<<<<<<<<
 *         cdef int l = 0
 *         if buffer is NULL:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_buffer != NULL && __pyx_v_buffer->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_buffer != NULL && __pyx_v_buffer->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_buffer->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":791
 *             buffer.obj = self
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_4lxml_5etree_15_XSLTResultTree_9__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/
static CYTHON_UNUSED void __pyx_pw_4lxml_5etree_15_XSLTResultTree_9__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_15_XSLTResultTree_8__releasebuffer__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer));

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

static void __pyx_pf_4lxml_5etree_15_XSLTResultTree_8__releasebuffer__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":792
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:             # <<<<<<<<<<<<<<
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:
 */
  __pyx_t_1 = ((__pyx_v_buffer == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":793
 *     def __releasebuffer__(self, Py_buffer* buffer):
 *         if buffer is NULL:
 *             return             # <<<<<<<<<<<<<<
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":794
 *         if buffer is NULL:
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:             # <<<<<<<<<<<<<<
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 */
  __pyx_t_1 = ((((xmlChar *)__pyx_v_buffer->buf) == __pyx_v_self->_buffer) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":795
 *             return
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1             # <<<<<<<<<<<<<<
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)
 */
    __pyx_v_self->_buffer_refcnt = (__pyx_v_self->_buffer_refcnt - 1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":796
 *         if <xmlChar*>buffer.buf is self._buffer:
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:             # <<<<<<<<<<<<<<
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL
 */
    __pyx_t_1 = ((__pyx_v_self->_buffer_refcnt == 0) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":797
 *             self._buffer_refcnt -= 1
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)             # <<<<<<<<<<<<<<
 *                 self._buffer = NULL
 *         else:
 */
      xmlFree(((char *)__pyx_v_self->_buffer));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":798
 *             if self._buffer_refcnt == 0:
 *                 tree.xmlFree(<char*>self._buffer)
 *                 self._buffer = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 */
      __pyx_v_self->_buffer = NULL;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":800
 *                 self._buffer = NULL
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)             # <<<<<<<<<<<<<<
 *         buffer.buf = NULL
 * 
 */
    xmlFree(((char *)__pyx_v_buffer->buf));
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":801
 *         else:
 *             tree.xmlFree(<char*>buffer.buf)
 *         buffer.buf = NULL             # <<<<<<<<<<<<<<
 * 
 *     property xslt_profile:
 */
  __pyx_v_buffer->buf = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":791
 *             buffer.obj = self
 * 
 *     def __releasebuffer__(self, Py_buffer* buffer):             # <<<<<<<<<<<<<<
 *         if buffer is NULL:
 *             return
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":806
 *         u"""Return an ElementTree with profiling data for the stylesheet run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object root
 *             if self._profile is None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile___get__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  PyObject *__pyx_v_root = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":808
 *         def __get__(self):
 *             cdef object root
 *             if self._profile is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             root = self._profile.getroot()
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_profile) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":809
 *             cdef object root
 *             if self._profile is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             root = self._profile.getroot()
 *             if root is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":810
 *             if self._profile is None:
 *                 return None
 *             root = self._profile.getroot()             # <<<<<<<<<<<<<<
 *             if root is None:
 *                 return None
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document_getroot(__pyx_v_self->_profile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_root = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":811
 *                 return None
 *             root = self._profile.getroot()
 *             if root is None:             # <<<<<<<<<<<<<<
 *                 return None
 *             return ElementTree(root)
 */
  __pyx_t_2 = (__pyx_v_root == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":812
 *             root = self._profile.getroot()
 *             if root is None:
 *                 return None             # <<<<<<<<<<<<<<
 *             return ElementTree(root)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":813
 *             if root is None:
 *                 return None
 *             return ElementTree(root)             # <<<<<<<<<<<<<<
 * 
 *         def __del__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ElementTree); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_root);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_root);
  __Pyx_GIVEREF(__pyx_v_root);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":806
 *         u"""Return an ElementTree with profiling data for the stylesheet run.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object root
 *             if self._profile is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._XSLTResultTree.xslt_profile.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":815
 *             return ElementTree(root)
 * 
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._profile = None
 * 
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_3__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_3__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_2__del__(((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_v_self));

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

static int __pyx_pf_4lxml_5etree_15_XSLTResultTree_12xslt_profile_2__del__(struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":816
 * 
 *         def __del__(self):
 *             self._profile = None             # <<<<<<<<<<<<<<
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_profile);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_profile));
  __pyx_v_self->_profile = ((struct LxmlDocument *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":815
 *             return ElementTree(root)
 * 
 *         def __del__(self):             # <<<<<<<<<<<<<<
 *             self._profile = None
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":818
 *             self._profile = None
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):             # <<<<<<<<<<<<<<
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 */

static PyObject *__pyx_f_4lxml_5etree__xsltResultTreeFactory(struct LxmlDocument *__pyx_v_doc, struct __pyx_obj_4lxml_5etree_XSLT *__pyx_v_xslt, struct LxmlDocument *__pyx_v_profile) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_xsltResultTreeFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":820
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)             # <<<<<<<<<<<<<<
 *     result._xslt = xslt
 *     result._profile = profile
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(__pyx_v_doc, ((struct LxmlElement *)Py_None), ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__XSLTResultTree)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":821
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 *     result._xslt = xslt             # <<<<<<<<<<<<<<
 *     result._profile = profile
 *     return result
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_xslt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_xslt));
  __Pyx_GOTREF(__pyx_v_result->_xslt);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_xslt));
  __pyx_v_result->_xslt = __pyx_v_xslt;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":822
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 *     result._xslt = xslt
 *     result._profile = profile             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_profile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_profile));
  __Pyx_GOTREF(__pyx_v_result->_profile);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->_profile));
  __pyx_v_result->_profile = __pyx_v_profile;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":823
 *     result._xslt = xslt
 *     result._profile = profile
 *     return result             # <<<<<<<<<<<<<<
 * 
 * # functions like "output" and "write" are a potential security risk, but we
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":818
 *             self._profile = None
 * 
 * cdef _xsltResultTreeFactory(_Document doc, XSLT xslt, _Document profile):             # <<<<<<<<<<<<<<
 *     cdef _XSLTResultTree result
 *     result = <_XSLTResultTree>_newElementTree(doc, None, _XSLTResultTree)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._xsltResultTreeFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":841
 * cdef XPath __findStylesheetByID = None
 * 
 * cdef _findStylesheetByID(_Document doc, id):             # <<<<<<<<<<<<<<
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 */

static PyObject *__pyx_f_4lxml_5etree__findStylesheetByID(struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_findStylesheetByID", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":843
 * cdef _findStylesheetByID(_Document doc, id):
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:             # <<<<<<<<<<<<<<
 *         __findStylesheetByID = XPath(
 *             u"//xsl:stylesheet[@xml:id = $id]",
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":844
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":846
 *         __findStylesheetByID = XPath(
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})             # <<<<<<<<<<<<<<
 *     return __findStylesheetByID(doc, id=id)
 * 
 */
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_xsl, __pyx_kp_u_http_www_w3_org_1999_XSL_Transfo) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_namespaces, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":844
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), __pyx_tuple__95, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID));
    __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___findStylesheetByID, ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_4));
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":847
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 *     return __findStylesheetByID(doc, id=id)             # <<<<<<<<<<<<<<
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_doc));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_doc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID), __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":841
 * cdef XPath __findStylesheetByID = None
 * 
 * cdef _findStylesheetByID(_Document doc, id):             # <<<<<<<<<<<<<<
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._findStylesheetByID", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":850
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         u"""parseXSL(self, parser=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL[] = "parseXSL(self, parser=None)\n\n        Try to parse the stylesheet referenced by this PI and return\n        an ElementTree for it.  If the stylesheet is embedded in the\n        same document (referenced via xml:id), find and return an\n        ElementTree for the stylesheet Element.\n\n        The optional ``parser`` keyword argument can be passed to specify the\n        parser used to read from external stylesheet URLs.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_parser = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parseXSL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parser,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parseXSL") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_parser = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parseXSL", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self), __pyx_v_parser);

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

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_parser) {
  struct LxmlDocument *__pyx_v_result_doc = 0;
  struct LxmlElement *__pyx_v_result_node = 0;
  PyObject *__pyx_v_href_utf = 0;
  const xmlChar *__pyx_v_c_href;
  xmlAttr *__pyx_v_c_attr;
  PyObject *__pyx_v_hrefs = NULL;
  PyObject *__pyx_v_root = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  unsigned char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parseXSL", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":866
 *         cdef const_xmlChar* c_href
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)             # <<<<<<<<<<<<<<
 *         if self._c_node.content is NULL:
 *             raise ValueError, u"PI lacks content"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(((struct LxmlElement *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":867
 *         cdef xmlAttr* c_attr
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"PI lacks content"
 *         hrefs = _FIND_PI_HREF(u' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 */
  __pyx_t_2 = ((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":868
 *         _assertValidNode(self)
 *         if self._c_node.content is NULL:
 *             raise ValueError, u"PI lacks content"             # <<<<<<<<<<<<<<
 *         hrefs = _FIND_PI_HREF(u' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_PI_lacks_content, 0, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":869
 *         if self._c_node.content is NULL:
 *             raise ValueError, u"PI lacks content"
 *         hrefs = _FIND_PI_HREF(u' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))             # <<<<<<<<<<<<<<
 *         if len(hrefs) != 1:
 *             raise ValueError, u"malformed PI attributes"
 */
  __pyx_t_3 = ((unsigned char *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->content);
  __pyx_t_4 = __Pyx_decode_c_string(((char *)__pyx_t_3), 0, strlen(((char *)__pyx_t_3)), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_ConcatSafe(__pyx_kp_u__14, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_HREF, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_hrefs = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":870
 *             raise ValueError, u"PI lacks content"
 *         hrefs = _FIND_PI_HREF(u' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"malformed PI attributes"
 *         hrefs = hrefs[0]
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_hrefs); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((__pyx_t_6 != 1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":871
 *         hrefs = _FIND_PI_HREF(u' ' + (<unsigned char*>self._c_node.content).decode('UTF-8'))
 *         if len(hrefs) != 1:
 *             raise ValueError, u"malformed PI attributes"             # <<<<<<<<<<<<<<
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_malformed_PI_attributes, 0, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":872
 *         if len(hrefs) != 1:
 *             raise ValueError, u"malformed PI attributes"
 *         hrefs = hrefs[0]             # <<<<<<<<<<<<<<
 *         href_utf = utf8(hrefs[0] or hrefs[1])
 *         c_href = _xcstr(href_utf)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_hrefs, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":873
 *             raise ValueError, u"malformed PI attributes"
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])             # <<<<<<<<<<<<<<
 *         c_href = _xcstr(href_utf)
 * 
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_hrefs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_hrefs, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_7 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_t_5 = utf8(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_href_utf = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":874
 *         hrefs = hrefs[0]
 *         href_utf = utf8(hrefs[0] or hrefs[1])
 *         c_href = _xcstr(href_utf)             # <<<<<<<<<<<<<<
 * 
 *         if c_href[0] != c'#':
 */
  __pyx_v_c_href = (const xmlChar*)PyBytes_AS_STRING(__pyx_v_href_utf);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":876
 *         c_href = _xcstr(href_utf)
 * 
 *         if c_href[0] != c'#':             # <<<<<<<<<<<<<<
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(
 */
  __pyx_t_2 = (((__pyx_v_c_href[0]) != '#') != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":878
 *         if c_href[0] != c'#':
 *             # normal URL, try to parse from it
 *             c_href = tree.xmlBuildURI(             # <<<<<<<<<<<<<<
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 */
    __pyx_v_c_href = xmlBuildURI(__pyx_v_c_href, xmlNodeGetBase(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":881
 *                 c_href,
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:             # <<<<<<<<<<<<<<
 *                 try:
 *                     href_utf = <unsigned char*>c_href
 */
    __pyx_t_2 = ((__pyx_v_c_href != NULL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":882
 *                 tree.xmlNodeGetBase(self._c_node.doc, self._c_node))
 *             if c_href is not NULL:
 *                 try:             # <<<<<<<<<<<<<<
 *                     href_utf = <unsigned char*>c_href
 *                 finally:
 */
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":883
 *             if c_href is not NULL:
 *                 try:
 *                     href_utf = <unsigned char*>c_href             # <<<<<<<<<<<<<<
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)
 */
        __pyx_t_5 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_href)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_href_utf, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":885
 *                     href_utf = <unsigned char*>c_href
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)             # <<<<<<<<<<<<<<
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 *             return _elementTreeFactory(result_doc, None)
 */
      /*finally:*/ {
        /*normal exit:*/{
          xmlFree(((char *)__pyx_v_c_href));
          goto __pyx_L9;
        }
        /*exception exit:*/{
          __pyx_L8_error:;
          __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __pyx_t_1 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
          {
            xmlFree(((char *)__pyx_v_c_href));
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          }
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
          __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
          goto __pyx_L1_error;
        }
        __pyx_L9:;
      }
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":886
 *                 finally:
 *                     tree.xmlFree(<char*>c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(result_doc, None)
 * 
 */
    if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocumentFromURL(__pyx_v_href_utf, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_result_doc = ((struct LxmlDocument *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":887
 *                     tree.xmlFree(<char*>c_href)
 *             result_doc = _parseDocumentFromURL(href_utf, parser)
 *             return _elementTreeFactory(result_doc, None)             # <<<<<<<<<<<<<<
 * 
 *         # ID reference to embedded stylesheet
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(__pyx_v_result_doc, ((struct LxmlElement *)Py_None))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":891
 *         # ID reference to embedded stylesheet
 *         # try XML:ID lookup
 *         _assertValidDoc(self._doc)             # <<<<<<<<<<<<<<
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_8 = __pyx_f_4lxml_5etree__assertValidDoc(((struct LxmlDocument *)__pyx_t_5)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":892
 *         # try XML:ID lookup
 *         _assertValidDoc(self._doc)
 *         c_href += 1 # skip leading '#'             # <<<<<<<<<<<<<<
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 */
  __pyx_v_c_href = (__pyx_v_c_href + 1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":893
 *         _assertValidDoc(self._doc)
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)             # <<<<<<<<<<<<<<
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 */
  __pyx_v_c_attr = xmlGetID(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc, __pyx_v_c_href);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":894
 *         c_href += 1 # skip leading '#'
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:             # <<<<<<<<<<<<<<
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)
 */
  __pyx_t_2 = ((__pyx_v_c_attr != NULL) != 0);
  if (__pyx_t_2) {
    __pyx_t_16 = ((__pyx_v_c_attr->doc == __pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._c_node->doc) != 0);
    __pyx_t_17 = __pyx_t_16;
  } else {
    __pyx_t_17 = __pyx_t_2;
  }
  if (__pyx_t_17) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":895
 *         c_attr = tree.xmlGetID(self._c_node.doc, c_href)
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)             # <<<<<<<<<<<<<<
 *             return _elementTreeFactory(result_node._doc, result_node)
 * 
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(((struct LxmlDocument *)__pyx_t_5), __pyx_v_c_attr->parent)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":896
 *         if c_attr is not NULL and c_attr.doc is self._c_node.doc:
 *             result_node = _elementFactory(self._doc, c_attr.parent)
 *             return _elementTreeFactory(result_node._doc, result_node)             # <<<<<<<<<<<<<<
 * 
 *         # try XPath search
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = ((PyObject *)__pyx_v_result_node->_doc);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_7), __pyx_v_result_node)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":899
 * 
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))             # <<<<<<<<<<<<<<
 *         if not root:
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base._doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_7 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_href); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __pyx_f_4lxml_5etree__findStylesheetByID(((struct LxmlDocument *)__pyx_t_5), __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_root = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":900
 *         # try XPath search
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 */
  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_root); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_17) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":901
 *         root = _findStylesheetByID(self._doc, funicode(c_href))
 *         if not root:
 *             raise ValueError, u"reference to non-existing embedded stylesheet"             # <<<<<<<<<<<<<<
 *         elif len(root) > 1:
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_reference_to_non_existing_embedd, 0, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":902
 *         if not root:
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_root); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((__pyx_t_6 > 1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":903
 *             raise ValueError, u"reference to non-existing embedded stylesheet"
 *         elif len(root) > 1:
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"             # <<<<<<<<<<<<<<
 *         result_node = root[0]
 *         return _elementTreeFactory(result_node._doc, result_node)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_ambiguous_reference_to_embedded, 0, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":904
 *         elif len(root) > 1:
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 *         result_node = root[0]             # <<<<<<<<<<<<<<
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 */
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_root, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4lxml_5etree__Element))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_result_node = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":905
 *             raise ValueError, u"ambiguous reference to embedded stylesheet"
 *         result_node = root[0]
 *         return _elementTreeFactory(result_node._doc, result_node)             # <<<<<<<<<<<<<<
 * 
 *     def set(self, key, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_result_node->_doc);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = ((PyObject *)__pyx_f_4lxml_5etree__elementTreeFactory(((struct LxmlDocument *)__pyx_t_4), __pyx_v_result_node)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":850
 * 
 * cdef class _XSLTProcessingInstruction(PIBase):
 *     def parseXSL(self, parser=None):             # <<<<<<<<<<<<<<
 *         u"""parseXSL(self, parser=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.parseXSL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_result_node);
  __Pyx_XDECREF(__pyx_v_href_utf);
  __Pyx_XDECREF(__pyx_v_hrefs);
  __Pyx_XDECREF(__pyx_v_root);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":907
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"""set(self, key, value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set[] = "set(self, key, value)\n\n        Supports setting the 'href' pseudo-attribute in the text of\n        the processing instruction.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_key = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2set(((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)__pyx_v_self), __pyx_v_key, __pyx_v_value);

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

static PyObject *__pyx_pf_4lxml_5etree_26_XSLTProcessingInstruction_2set(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_attrib = NULL;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":913
 *         the processing instruction.
 *         """
 *         if key != u"href":             # <<<<<<<<<<<<<<
 *             raise AttributeError, \
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_n_u_href, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":914
 *         """
 *         if key != u"href":
 *             raise AttributeError, \             # <<<<<<<<<<<<<<
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
 */
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_kp_u_only_setting_the_href_attribute, 0, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":916
 *             raise AttributeError, \
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:             # <<<<<<<<<<<<<<
 *             attrib = u""
 *         elif u'"' in value or u'>' in value:
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":917
 *                 u"only setting the 'href' attribute is supported on XSLT-PIs"
 *         if value is None:
 *             attrib = u""             # <<<<<<<<<<<<<<
 *         elif u'"' in value or u'>' in value:
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"
 */
    __Pyx_INCREF(__pyx_kp_u__15);
    __pyx_v_attrib = __pyx_kp_u__15;
    goto __pyx_L4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":918
 *         if value is None:
 *             attrib = u""
 *         elif u'"' in value or u'>' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"
 *         else:
 */
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_kp_u__53, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(__pyx_t_2 != 0)) {
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_kp_u__63, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (__pyx_t_1 != 0);
  } else {
    __pyx_t_3 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":919
 *             attrib = u""
 *         elif u'"' in value or u'>' in value:
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"             # <<<<<<<<<<<<<<
 *         else:
 *             attrib = u' href="%s"' % value
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_u_Invalid_URL_must_not_contain_or, 0, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":921
 *             raise ValueError, u"Invalid URL, must not contain '\"' or '>'"
 *         else:
 *             attrib = u' href="%s"' % value             # <<<<<<<<<<<<<<
 *         text = u' ' + self.text
 *         if _FIND_PI_HREF(text):
 */
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_href_s, __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_attrib = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":922
 *         else:
 *             attrib = u' href="%s"' % value
 *         text = u' ' + self.text             # <<<<<<<<<<<<<<
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Add(__pyx_kp_u__14, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_text = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":923
 *             attrib = u' href="%s"' % value
 *         text = u' ' + self.text
 *         if _FIND_PI_HREF(text):             # <<<<<<<<<<<<<<
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_text);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_text);
  __Pyx_GIVEREF(__pyx_v_text);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__FIND_PI_HREF, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":924
 *         text = u' ' + self.text
 *         if _FIND_PI_HREF(text):
 *             self.text = _REPLACE_PI_HREF(attrib, text)             # <<<<<<<<<<<<<<
 *         else:
 *             self.text = text + attrib
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_attrib);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_attrib);
    __Pyx_GIVEREF(__pyx_v_attrib);
    __Pyx_INCREF(__pyx_v_text);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_text);
    __Pyx_GIVEREF(__pyx_v_text);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_4lxml_5etree__REPLACE_PI_HREF, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":926
 *             self.text = _REPLACE_PI_HREF(attrib, text)
 *         else:
 *             self.text = text + attrib             # <<<<<<<<<<<<<<
 */
    __pyx_t_5 = PyNumber_Add(__pyx_v_text, __pyx_v_attrib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_text, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":907
 *         return _elementTreeFactory(result_node._doc, result_node)
 * 
 *     def set(self, key, value):             # <<<<<<<<<<<<<<
 *         u"""set(self, key, value)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._XSLTProcessingInstruction.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attrib);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":6
 *     u"""Base class of an XSLT extension element.
 *     """
 *     def execute(self, context, self_node, input_node, output_parent):             # <<<<<<<<<<<<<<
 *         u"""execute(self, context, self_node, input_node, output_parent)
 *         Execute this extension element.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_1execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_13XSLTExtension_execute[] = "execute(self, context, self_node, input_node, output_parent)\n        Execute this extension element.\n\n        Subclasses must override this method.  They may append\n        elements to the `output_parent` element here, or set its text\n        content.  To this end, the `input_node` provides read-only\n        access to the current node in the input document, and the\n        `self_node` points to the extension element in the stylesheet.\n\n        Note that the `output_parent` parameter may be `None` if there\n        is no parent element in the current context (e.g. no content\n        was added to the output tree yet).\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_1execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_self_node = 0;
  CYTHON_UNUSED PyObject *__pyx_v_input_node = 0;
  CYTHON_UNUSED PyObject *__pyx_v_output_parent = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_self_node,&__pyx_n_s_input_node,&__pyx_n_s_output_parent,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self_node)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 1); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_node)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 2); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output_parent)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, 3); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "execute") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_context = values[0];
    __pyx_v_self_node = values[1];
    __pyx_v_input_node = values[2];
    __pyx_v_output_parent = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_13XSLTExtension_execute(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_self_node, __pyx_v_input_node, __pyx_v_output_parent);

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

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_execute(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_self_node, CYTHON_UNUSED PyObject *__pyx_v_input_node, CYTHON_UNUSED PyObject *__pyx_v_output_parent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute", 0);

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         u"""apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates[] = "apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)\n\n        Call this method to retrieve the result of applying templates\n        to an element.\n\n        The return value is a list of elements or text strings that\n        were generated by the XSLT processor.  If you pass\n        ``elements_only=True``, strings will be discarded from the result\n        list.  The option ``remove_blank_text=True`` will only discard\n        strings that consist entirely of whitespace (e.g. formatting).\n        These options do not apply to Elements, only to bare string results.\n\n        If you pass an Element as `output_parent` parameter, the result\n        will instead be appended to the element (including attributes\n        etc.) and the return value will be `None`.  This is a safe way\n        to generate content into the output document directly, without\n        having to take care of special values like text or attributes.\n        Note that the string discarding options will be ignored in this\n        case.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  PyObject *__pyx_v_node = 0;
  PyObject *__pyx_v_output_parent = 0;
  PyObject *__pyx_v_elements_only = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_templates (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_node,&__pyx_n_s_output_parent,&__pyx_n_s_elements_only,&__pyx_n_s_remove_blank_text,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":23
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
 *                         *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         u"""apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
 */
    values[3] = ((PyObject *)Py_False);
    values[4] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, 1); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output_parent);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 3; index < 5 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_templates") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]);
    __pyx_v_node = values[1];
    __pyx_v_output_parent = values[2];
    __pyx_v_elements_only = values[3];
    __pyx_v_remove_blank_text = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_templates", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_13XSLTExtension_2apply_templates(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_node, __pyx_v_output_parent, __pyx_v_elements_only, __pyx_v_remove_blank_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         u"""apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_2apply_templates(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_node, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text) {
  xmlNode *__pyx_v_c_parent;
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_context_node;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_templates", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":47
 *         cdef xmlNode* c_node
 *         cdef xmlNode* c_context_node
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"             # <<<<<<<<<<<<<<
 *         c_context_node = _roNodeOf(node)
 *         #assert c_context_node.doc is context._xsltContext.node.doc, \
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_context->_xsltCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XSLT_context_not_initialised);
      {__pyx_filename = __pyx_f[19]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":48
 *         cdef xmlNode* c_context_node
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 *         c_context_node = _roNodeOf(node)             # <<<<<<<<<<<<<<
 *         #assert c_context_node.doc is context._xsltContext.node.doc, \
 *         #    "switching input documents during transformation is not currently supported"
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__roNodeOf(__pyx_v_node); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_context_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":52
 *         #    "switching input documents during transformation is not currently supported"
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 */
  __pyx_t_2 = (__pyx_v_output_parent != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":53
 * 
 *         if output_parent is not None:
 *             c_parent = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_parent = __pyx_t_1;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":55
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 *             c_parent = tree.xmlNewDocNode(             # <<<<<<<<<<<<<<
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 */
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, ((unsigned char *)((unsigned char *)__pyx_k_fake_parent)), NULL);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":58
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 *         c_node = context._xsltCtxt.insert             # <<<<<<<<<<<<<<
 *         context._xsltCtxt.insert = c_parent
 *         xslt.xsltProcessOneNode(
 */
  __pyx_t_1 = __pyx_v_context->_xsltCtxt->insert;
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":59
 * 
 *         c_node = context._xsltCtxt.insert
 *         context._xsltCtxt.insert = c_parent             # <<<<<<<<<<<<<<
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)
 */
  __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_parent;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":60
 *         c_node = context._xsltCtxt.insert
 *         context._xsltCtxt.insert = c_parent
 *         xslt.xsltProcessOneNode(             # <<<<<<<<<<<<<<
 *             context._xsltCtxt, c_context_node, NULL)
 *         context._xsltCtxt.insert = c_node
 */
  xsltProcessOneNode(__pyx_v_context->_xsltCtxt, __pyx_v_c_context_node, NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":62
 *         xslt.xsltProcessOneNode(
 *             context._xsltCtxt, c_context_node, NULL)
 *         context._xsltCtxt.insert = c_node             # <<<<<<<<<<<<<<
 * 
 *         if output_parent is not None:
 */
  __pyx_v_context->_xsltCtxt->insert = __pyx_v_c_node;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":64
 *         context._xsltCtxt.insert = c_node
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_3 = (__pyx_v_output_parent != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":65
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":67
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":68
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":69
 *         try:
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)             # <<<<<<<<<<<<<<
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_elements_only); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L6_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":68
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *)__pyx_v_self->__pyx_vtab)->_collectXSLTResultContent(__pyx_v_self, __pyx_v_context, __pyx_v_c_parent, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5_return;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":72
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 *             tree.xmlFreeNode(c_parent)             # <<<<<<<<<<<<<<
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
      {
        xmlFreeNode(__pyx_v_c_parent);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
      goto __pyx_L1_error;
    }
    __pyx_L5_return: {
      __pyx_t_13 = __pyx_r;
      __pyx_r = 0;
      xmlFreeNode(__pyx_v_c_parent);
      __pyx_r = __pyx_t_13;
      __pyx_t_13 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":22
 *         pass
 * 
 *     def apply_templates(self, _XSLTContext context not None, node, output_parent=None,             # <<<<<<<<<<<<<<
 *                         *, elements_only=False, remove_blank_text=False):
 *         u"""apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.apply_templates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         u"""process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_13XSLTExtension_4process_children[] = "process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)\n\n        Call this method to process the XSLT content of the extension\n        element itself.\n\n        The return value is a list of elements or text strings that\n        were generated by the XSLT processor.  If you pass\n        ``elements_only=True``, strings will be discarded from the result\n        list.  The option ``remove_blank_text=True`` will only discard\n        strings that consist entirely of whitespace (e.g. formatting).\n        These options do not apply to Elements, only to bare string results.\n\n        If you pass an Element as `output_parent` parameter, the result\n        will instead be appended to the element (including attributes\n        etc.) and the return value will be `None`.  This is a safe way\n        to generate content into the output document directly, without\n        having to take care of special values like text or attributes.\n        Note that the string discarding options will be ignored in this\n        case.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  PyObject *__pyx_v_output_parent = 0;
  PyObject *__pyx_v_elements_only = 0;
  PyObject *__pyx_v_remove_blank_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process_children (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_output_parent,&__pyx_n_s_elements_only,&__pyx_n_s_remove_blank_text,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":75
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,
 *                          *, elements_only=False, remove_blank_text=False):             # <<<<<<<<<<<<<<
 *         u"""process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 * 
 */
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output_parent);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 2; index < 4 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "process_children") < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)values[0]);
    __pyx_v_output_parent = values[1];
    __pyx_v_elements_only = values[2];
    __pyx_v_remove_blank_text = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("process_children", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[19]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.process_children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_4lxml_5etree__XSLTContext, 0, "context", 0))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_4lxml_5etree_13XSLTExtension_4process_children(((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_v_self), __pyx_v_context, __pyx_v_output_parent, __pyx_v_elements_only, __pyx_v_remove_blank_text);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         u"""process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_13XSLTExtension_4process_children(struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, PyObject *__pyx_v_output_parent, PyObject *__pyx_v_elements_only, PyObject *__pyx_v_remove_blank_text) {
  xmlNode *__pyx_v_c_parent;
  xsltTransformContext *__pyx_v_c_ctxt;
  xmlNode *__pyx_v_c_old_output_parent;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xsltTransformContext *__pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  char const *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process_children", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":97
 *         """
 *         cdef xmlNode* c_parent
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt             # <<<<<<<<<<<<<<
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 */
  __pyx_t_1 = __pyx_v_context->_xsltCtxt;
  __pyx_v_c_ctxt = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":98
 *         cdef xmlNode* c_parent
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert             # <<<<<<<<<<<<<<
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"
 * 
 */
  __pyx_t_2 = __pyx_v_c_ctxt->insert;
  __pyx_v_c_old_output_parent = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":99
 *         cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
 *         cdef xmlNode* c_old_output_parent = c_ctxt.insert
 *         assert context._xsltCtxt is not NULL, "XSLT context not initialised"             # <<<<<<<<<<<<<<
 * 
 *         # output_parent node is used for adding results instead of
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_context->_xsltCtxt != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XSLT_context_not_initialised);
      {__pyx_filename = __pyx_f[19]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":105
 *         # use attributes added to extension element with <xsl:attribute>.
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 */
  __pyx_t_3 = (__pyx_v_output_parent != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":106
 * 
 *         if output_parent is not None:
 *             c_parent = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         else:
 *             c_parent = tree.xmlNewDocNode(
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c_parent = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":108
 *             c_parent = _nonRoNodeOf(output_parent)
 *         else:
 *             c_parent = tree.xmlNewDocNode(             # <<<<<<<<<<<<<<
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 */
    __pyx_v_c_parent = xmlNewDocNode(__pyx_v_context->_xsltCtxt->output, NULL, ((unsigned char *)((unsigned char *)__pyx_k_fake_parent)), NULL);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":111
 *                 context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
 * 
 *         c_ctxt.insert = _nonRoNodeOf(output_parent)             # <<<<<<<<<<<<<<
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__nonRoNodeOf(__pyx_v_output_parent); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_ctxt->insert = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":112
 * 
 *         c_ctxt.insert = _nonRoNodeOf(output_parent)
 *         xslt.xsltApplyOneTemplate(c_ctxt,             # <<<<<<<<<<<<<<
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 *         c_ctxt.insert = c_old_output_parent
 */
  xsltApplyOneTemplate(__pyx_v_c_ctxt, __pyx_v_c_ctxt->node, __pyx_v_c_ctxt->inst->children, NULL, NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":114
 *         xslt.xsltApplyOneTemplate(c_ctxt,
 *             c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
 *         c_ctxt.insert = c_old_output_parent             # <<<<<<<<<<<<<<
 * 
 *         if output_parent is not None:
 */
  __pyx_v_c_ctxt->insert = __pyx_v_c_old_output_parent;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":116
 *         c_ctxt.insert = c_old_output_parent
 * 
 *         if output_parent is not None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_4 = (__pyx_v_output_parent != Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":117
 * 
 *         if output_parent is not None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":119
 *             return None
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":120
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":121
 *         try:
 *             return self._collectXSLTResultContent(
 *                 context, c_parent, elements_only, remove_blank_text)             # <<<<<<<<<<<<<<
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_elements_only); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_remove_blank_text); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L6_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":120
 * 
 *         try:
 *             return self._collectXSLTResultContent(             # <<<<<<<<<<<<<<
 *                 context, c_parent, elements_only, remove_blank_text)
 *         finally:
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension *)__pyx_v_self->__pyx_vtab)->_collectXSLTResultContent(__pyx_v_self, __pyx_v_context, __pyx_v_c_parent, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5_return;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":124
 *         finally:
 *             # free all intermediate nodes that will not be freed by proxies
 *             tree.xmlFreeNode(c_parent)             # <<<<<<<<<<<<<<
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,
 */
  /*finally:*/ {
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        xmlFreeNode(__pyx_v_c_parent);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
    }
    __pyx_L5_return: {
      __pyx_t_14 = __pyx_r;
      __pyx_r = 0;
      xmlFreeNode(__pyx_v_c_parent);
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":74
 *             tree.xmlFreeNode(c_parent)
 * 
 *     def process_children(self, _XSLTContext context not None, output_parent=None,             # <<<<<<<<<<<<<<
 *                          *, elements_only=False, remove_blank_text=False):
 *         u"""process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension.process_children", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":126
 *             tree.xmlFreeNode(c_parent)
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,             # <<<<<<<<<<<<<<
 *                                    bint elements_only, bint remove_blank_text):
 *         cdef xmlNode* c_node
 */

static PyObject *__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_self, struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context, xmlNode *__pyx_v_c_parent, int __pyx_v_elements_only, int __pyx_v_remove_blank_text) {
  xmlNode *__pyx_v_c_node;
  xmlNode *__pyx_v_c_next;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_proxy = 0;
  PyObject *__pyx_v_results = 0;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  xmlNode *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_collectXSLTResultContent", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":131
 *         cdef xmlNode* c_next
 *         cdef _ReadOnlyProxy proxy
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?             # <<<<<<<<<<<<<<
 *         c_node = c_parent.children
 *         while c_node is not NULL:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":132
 *         cdef _ReadOnlyProxy proxy
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
 *         c_node = c_parent.children             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             c_next = c_node.next
 */
  __pyx_t_2 = __pyx_v_c_parent->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":133
 *         cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
 *         c_node = c_parent.children
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":134
 *         c_node = c_parent.children
 *         while c_node is not NULL:
 *             c_next = c_node.next             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_next = __pyx_t_2;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":141
 *                         results.append(s)
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
 */
    switch (__pyx_v_c_node->type) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":135
 *         while c_node is not NULL:
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:             # <<<<<<<<<<<<<<
 *                 if not elements_only:
 *                     s = funicode(c_node.content)
 */
      case XML_TEXT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":136
 *             c_next = c_node.next
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:             # <<<<<<<<<<<<<<
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():
 */
      __pyx_t_3 = ((!(__pyx_v_elements_only != 0)) != 0);
      if (__pyx_t_3) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":137
 *             if c_node.type == tree.XML_TEXT_NODE:
 *                 if not elements_only:
 *                     s = funicode(c_node.content)             # <<<<<<<<<<<<<<
 *                     if not remove_blank_text or s.strip():
 *                         results.append(s)
 */
        __pyx_t_1 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_node->content); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":138
 *                 if not elements_only:
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():             # <<<<<<<<<<<<<<
 *                         results.append(s)
 *                     s = None
 */
        __pyx_t_3 = (!(__pyx_v_remove_blank_text != 0));
        if (!__pyx_t_3) {
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 138; __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;
        }
        if (__pyx_t_6) {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":139
 *                     s = funicode(c_node.content)
 *                     if not remove_blank_text or s.strip():
 *                         results.append(s)             # <<<<<<<<<<<<<<
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 */
          __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_results, __pyx_v_s); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L6;
        }
        __pyx_L6:;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":140
 *                     if not remove_blank_text or s.strip():
 *                         results.append(s)
 *                     s = None             # <<<<<<<<<<<<<<
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF_SET(__pyx_v_s, Py_None);
        goto __pyx_L5;
      }
      __pyx_L5:;
      break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":141
 *                         results.append(s)
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:             # <<<<<<<<<<<<<<
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
 */
      case XML_ELEMENT_NODE:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":143
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)             # <<<<<<<<<<<<<<
 *                 results.append(proxy)
 *                 # unlink node and make sure it will be freed later on
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_context->_extension_element_proxy);
      __Pyx_INCREF(__pyx_t_4);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":142
 *                     s = None
 *             elif c_node.type == tree.XML_ELEMENT_NODE:
 *                 proxy = _newReadOnlyProxy(             # <<<<<<<<<<<<<<
 *                     context._extension_element_proxy, c_node)
 *                 results.append(proxy)
 */
      __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_4), __pyx_v_c_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_proxy, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":144
 *                 proxy = _newReadOnlyProxy(
 *                     context._extension_element_proxy, c_node)
 *                 results.append(proxy)             # <<<<<<<<<<<<<<
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)
 */
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_proxy)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":146
 *                 results.append(proxy)
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)             # <<<<<<<<<<<<<<
 *                 proxy.free_after_use()
 *             else:
 */
      xmlUnlinkNode(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":147
 *                 # unlink node and make sure it will be freed later on
 *                 tree.xmlUnlinkNode(c_node)
 *                 proxy.free_after_use()             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError, \
 */
      ((struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy *)__pyx_v_proxy->__pyx_vtab)->free_after_use(__pyx_v_proxy);
      break;
      default:

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":150
 *             else:
 *                 raise TypeError, \
 *                     u"unsupported XSLT result type: %d" % c_node.type             # <<<<<<<<<<<<<<
 *             c_node = c_next
 *         return results
 */
      __pyx_t_1 = PyInt_FromLong(__pyx_v_c_node->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_unsupported_XSLT_result_type_d, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[19]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":151
 *                 raise TypeError, \
 *                     u"unsupported XSLT result type: %d" % c_node.type
 *             c_node = c_next             # <<<<<<<<<<<<<<
 *         return results
 * 
 */
    __pyx_v_c_node = __pyx_v_c_next;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":152
 *                     u"unsupported XSLT result type: %d" % c_node.type
 *             c_node = c_next
 *         return results             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_results);
  __pyx_r = __pyx_v_results;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":126
 *             tree.xmlFreeNode(c_parent)
 * 
 *     cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,             # <<<<<<<<<<<<<<
 *                                    bint elements_only, bint remove_blank_text):
 *         cdef xmlNode* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.XSLTExtension._collectXSLTResultContent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_proxy);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":155
 * 
 * 
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
 */

static PyObject *__pyx_f_4lxml_5etree__registerXSLTExtensions(xsltTransformContext *__pyx_v_c_ctxt, PyObject *__pyx_v_extension_dict) {
  PyObject *__pyx_v_ns_utf = NULL;
  PyObject *__pyx_v_name_utf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_registerXSLTExtensions", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":157
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:             # <<<<<<<<<<<<<<
 *         xslt.xsltRegisterExtElement(
 *             c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 */
  if (PyList_CheckExact(__pyx_v_extension_dict) || PyTuple_CheckExact(__pyx_v_extension_dict)) {
    __pyx_t_1 = __pyx_v_extension_dict; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_extension_dict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[19]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_ns_utf, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_name_utf, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":158
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
 *         xslt.xsltRegisterExtElement(             # <<<<<<<<<<<<<<
 *             c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
 *             <xslt.xsltTransformFunction>_callExtensionElement)
 */
    xsltRegisterExtElement(__pyx_v_c_ctxt, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_name_utf), (const xmlChar*)PyBytes_AS_STRING(__pyx_v_ns_utf), ((xsltTransformFunction)__pyx_f_4lxml_5etree__callExtensionElement));
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":155
 * 
 * 
 * cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                              extension_dict):
 *     for ns_utf, name_utf in extension_dict:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._registerXSLTExtensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ns_utf);
  __Pyx_XDECREF(__pyx_v_name_utf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":162
 *             <xslt.xsltTransformFunction>_callExtensionElement)
 * 
 * cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                                 xmlNode* c_context_node,
 *                                 xmlNode* c_inst_node,
 */

static void __pyx_f_4lxml_5etree__callExtensionElement(xsltTransformContext *__pyx_v_c_ctxt, xmlNode *__pyx_v_c_context_node, xmlNode *__pyx_v_c_inst_node, CYTHON_UNUSED void *__pyx_v_dummy) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree_XSLTExtension *__pyx_v_extension = 0;
  PyObject *__pyx_v_dict_result;
  xmlNode *__pyx_v_c_node;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_context_node = 0;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *__pyx_v_self_node = 0;
  PyObject *__pyx_v_output_parent = 0;
  const xmlChar *__pyx_v_c_uri;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_message = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  char const *__pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  char *__pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_callExtensionElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":170
 *     cdef python.PyObject* dict_result
 *     cdef xmlNode* c_node
 *     cdef _ReadOnlyProxy context_node = None, self_node = None             # <<<<<<<<<<<<<<
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_context_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);
  __Pyx_INCREF(Py_None);
  __pyx_v_self_node = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":172
 *     cdef _ReadOnlyProxy context_node = None, self_node = None
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)             # <<<<<<<<<<<<<<
 *     if c_uri is NULL:
 *         # not allowed, and should never happen
 */
  __pyx_v_c_uri = _getNs(__pyx_v_c_inst_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":173
 *     cdef object output_parent # not restricted to ro-nodes
 *     c_uri = _getNs(c_inst_node)
 *     if c_uri is NULL:             # <<<<<<<<<<<<<<
 *         # not allowed, and should never happen
 *         return
 */
  __pyx_t_1 = ((__pyx_v_c_uri == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":175
 *     if c_uri is NULL:
 *         # not allowed, and should never happen
 *         return             # <<<<<<<<<<<<<<
 *     if c_ctxt.xpathCtxt.userData is NULL:
 *         # just for safety, should never happen
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":176
 *         # not allowed, and should never happen
 *         return
 *     if c_ctxt.xpathCtxt.userData is NULL:             # <<<<<<<<<<<<<<
 *         # just for safety, should never happen
 *         return
 */
  __pyx_t_1 = ((__pyx_v_c_ctxt->xpathCtxt->userData == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":178
 *     if c_ctxt.xpathCtxt.userData is NULL:
 *         # just for safety, should never happen
 *         return             # <<<<<<<<<<<<<<
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":179
 *         # just for safety, should never happen
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData             # <<<<<<<<<<<<<<
 *     try:
 *         try:
 */
  __pyx_t_2 = ((PyObject *)__pyx_v_c_ctxt->xpathCtxt->userData);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":180
 *         return
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             dict_result = python.PyDict_GetItem(
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":181
 *     context = <_XSLTContext>c_ctxt.xpathCtxt.userData
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (<unsigned char*>c_uri, <unsigned char*>c_inst_node.name))
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":183
 *         try:
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (<unsigned char*>c_uri, <unsigned char*>c_inst_node.name))             # <<<<<<<<<<<<<<
 *             if dict_result is NULL:
 *                 raise KeyError, \
 */
            __pyx_t_2 = __pyx_v_context->_extension_elements;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_9 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_uri)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_10 = __Pyx_PyBytes_FromUString(((unsigned char *)__pyx_v_c_inst_node->name)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_11);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
            __Pyx_GIVEREF(__pyx_t_10);
            __pyx_t_9 = 0;
            __pyx_t_10 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":182
 *     try:
 *         try:
 *             dict_result = python.PyDict_GetItem(             # <<<<<<<<<<<<<<
 *                 context._extension_elements, (<unsigned char*>c_uri, <unsigned char*>c_inst_node.name))
 *             if dict_result is NULL:
 */
            __pyx_v_dict_result = PyDict_GetItem(__pyx_t_2, __pyx_t_11);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":184
 *             dict_result = python.PyDict_GetItem(
 *                 context._extension_elements, (<unsigned char*>c_uri, <unsigned char*>c_inst_node.name))
 *             if dict_result is NULL:             # <<<<<<<<<<<<<<
 *                 raise KeyError, \
 *                     u"extension element %s not found" % funicode(c_inst_node.name)
 */
            __pyx_t_1 = ((__pyx_v_dict_result == NULL) != 0);
            if (__pyx_t_1) {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":186
 *             if dict_result is NULL:
 *                 raise KeyError, \
 *                     u"extension element %s not found" % funicode(c_inst_node.name)             # <<<<<<<<<<<<<<
 *             extension = <object>dict_result
 * 
 */
              __pyx_t_11 = __pyx_f_4lxml_5etree_funicode(__pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_extension_element_s_not_found, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_Raise(__pyx_builtin_KeyError, __pyx_t_2, 0, 0);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              {__pyx_filename = __pyx_f[19]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            }

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":187
 *                 raise KeyError, \
 *                     u"extension element %s not found" % funicode(c_inst_node.name)
 *             extension = <object>dict_result             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
            if (!(likely(((((PyObject *)__pyx_v_dict_result)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_dict_result), __pyx_ptype_4lxml_5etree_XSLTExtension))))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __pyx_t_2 = ((PyObject *)__pyx_v_dict_result);
            __Pyx_INCREF(__pyx_t_2);
            __pyx_v_extension = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)__pyx_t_2);
            __pyx_t_2 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":189
 *             extension = <object>dict_result
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 */
            /*try:*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":191
 *             try:
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)             # <<<<<<<<<<<<<<
 *                 if _isElement(c_ctxt.insert):
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
 */
              __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None), __pyx_v_c_inst_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF_SET(__pyx_v_self_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2));
              __pyx_t_2 = 0;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":192
 *                 # build the context proxy nodes
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):             # <<<<<<<<<<<<<<
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
 *                 else:
 */
              __pyx_t_1 = (_isElement(__pyx_v_c_ctxt->insert) != 0);
              if (__pyx_t_1) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":193
 *                 self_node = _newReadOnlyProxy(None, c_inst_node)
 *                 if _isElement(c_ctxt.insert):
 *                     output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)             # <<<<<<<<<<<<<<
 *                 else:
 *                     # may be the document node or other stuff
 */
                __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newAppendOnlyProxy(__pyx_v_self_node, __pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_v_output_parent = __pyx_t_2;
                __pyx_t_2 = 0;
                goto __pyx_L30;
              }
              /*else*/ {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":196
 *                 else:
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)             # <<<<<<<<<<<<<<
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 */
                __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newOpaqueAppendOnlyNodeWrapper(__pyx_v_c_ctxt->insert)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_v_output_parent = __pyx_t_2;
                __pyx_t_2 = 0;
              }
              __pyx_L30:;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":204
 *                     else:
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):
 */
              switch (__pyx_v_c_context_node->type) {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":197
 *                     # may be the document node or other stuff
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,             # <<<<<<<<<<<<<<
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 */
                case XML_DOCUMENT_NODE:

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":198
 *                     output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):             # <<<<<<<<<<<<<<
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:
 */
                case XML_HTML_DOCUMENT_NODE:

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":199
 *                 if c_context_node.type in (tree.XML_DOCUMENT_NODE,
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)             # <<<<<<<<<<<<<<
 *                     if c_node is not NULL:
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 */
                __pyx_v_c_node = xmlDocGetRootElement(((xmlDoc *)__pyx_v_c_context_node));

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":200
 *                                            tree.XML_HTML_DOCUMENT_NODE):
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:             # <<<<<<<<<<<<<<
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
 */
                __pyx_t_1 = ((__pyx_v_c_node != NULL) != 0);
                if (__pyx_t_1) {

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":201
 *                     c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
 *                     if c_node is not NULL:
 *                         context_node = _newReadOnlyProxy(self_node, c_node)             # <<<<<<<<<<<<<<
 *                     else:
 *                         context_node = None
 */
                  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                  __Pyx_GOTREF(__pyx_t_2);
                  __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_2));
                  __pyx_t_2 = 0;
                  goto __pyx_L31;
                }
                /*else*/ {

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":203
 *                         context_node = _newReadOnlyProxy(self_node, c_node)
 *                     else:
 *                         context_node = None             # <<<<<<<<<<<<<<
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,
 */
                  __Pyx_INCREF(Py_None);
                  __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None));
                }
                __pyx_L31:;
                break;

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":204
 *                     else:
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):
 */
                case XML_ATTRIBUTE_NODE:

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":205
 *                         context_node = None
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,             # <<<<<<<<<<<<<<
 *                                              tree.XML_CDATA_SECTION_NODE):
 *                     # this isn't easy to support using read-only
 */
                case XML_TEXT_NODE:

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":206
 *                 elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
 *                                              tree.XML_TEXT_NODE,
 *                                              tree.XML_CDATA_SECTION_NODE):             # <<<<<<<<<<<<<<
 *                     # this isn't easy to support using read-only
 *                     # nodes, as the smart-string factory must
 */
                case XML_CDATA_SECTION_NODE:

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":210
 *                     # nodes, as the smart-string factory must
 *                     # instantiate the parent proxy somehow...
 *                     raise TypeError("Unsupported element type: %d" % c_context_node.type)             # <<<<<<<<<<<<<<
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)
 */
                __pyx_t_2 = PyInt_FromLong(__pyx_v_c_context_node->type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Unsupported_element_type_d, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_2);
                PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_11);
                __Pyx_GIVEREF(__pyx_t_11);
                __pyx_t_11 = 0;
                __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_Raise(__pyx_t_11, 0, 0, 0);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                {__pyx_filename = __pyx_f[19]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                break;
                default:

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":212
 *                     raise TypeError("Unsupported element type: %d" % c_context_node.type)
 *                 else:
 *                     context_node  = _newReadOnlyProxy(self_node, c_context_node)             # <<<<<<<<<<<<<<
 * 
 *                 # run the XSLT extension
 */
                __pyx_t_11 = ((PyObject *)__pyx_f_4lxml_5etree__newReadOnlyProxy(__pyx_v_self_node, __pyx_v_c_context_node)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF_SET(__pyx_v_context_node, ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)__pyx_t_11));
                __pyx_t_11 = 0;
                break;
              }

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":215
 * 
 *                 # run the XSLT extension
 *                 context._extension_element_proxy = self_node             # <<<<<<<<<<<<<<
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 */
              if (!(likely(((((PyObject *)__pyx_v_self_node)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_self_node), __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy))))) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
              __pyx_t_11 = ((PyObject *)__pyx_v_self_node);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_11);
              __Pyx_GOTREF(__pyx_v_context->_extension_element_proxy);
              __Pyx_DECREF(((PyObject *)__pyx_v_context->_extension_element_proxy));
              __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)__pyx_t_11);
              __pyx_t_11 = 0;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":216
 *                 # run the XSLT extension
 *                 context._extension_element_proxy = self_node
 *                 extension.execute(context, self_node, context_node, output_parent)             # <<<<<<<<<<<<<<
 *             finally:
 *                 context._extension_element_proxy = None
 */
              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_extension), __pyx_n_s_execute); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_INCREF(((PyObject *)__pyx_v_context));
              PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_context));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
              __Pyx_INCREF(((PyObject *)__pyx_v_self_node));
              PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self_node));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_self_node));
              __Pyx_INCREF(((PyObject *)__pyx_v_context_node));
              PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_context_node));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_context_node));
              __Pyx_INCREF(__pyx_v_output_parent);
              PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_output_parent);
              __Pyx_GIVEREF(__pyx_v_output_parent);
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":218
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 *                 context._extension_element_proxy = None             # <<<<<<<<<<<<<<
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 */
            /*finally:*/ {
              /*normal exit:*/{
                __Pyx_INCREF(Py_None);
                __Pyx_GIVEREF(Py_None);
                __Pyx_GOTREF(__pyx_v_context->_extension_element_proxy);
                __Pyx_DECREF(((PyObject *)__pyx_v_context->_extension_element_proxy));
                __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":219
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:
 */
                __pyx_t_1 = (((PyObject *)__pyx_v_self_node) != Py_None);
                __pyx_t_12 = (__pyx_t_1 != 0);
                if (__pyx_t_12) {

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":220
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             try:
 */
                  __pyx_t_10 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_10);
                  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                  goto __pyx_L32;
                }
                __pyx_L32:;
                goto __pyx_L29;
              }
              /*exception exit:*/{
                __pyx_L28_error:;
                __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
                __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
                __Pyx_XGOTREF(__pyx_t_16);
                __Pyx_XGOTREF(__pyx_t_17);
                __Pyx_XGOTREF(__pyx_t_18);
                __Pyx_XGOTREF(__pyx_t_19);
                __Pyx_XGOTREF(__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_21);
                __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
                {

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":218
 *                 extension.execute(context, self_node, context_node, output_parent)
 *             finally:
 *                 context._extension_element_proxy = None             # <<<<<<<<<<<<<<
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 */
                  __Pyx_INCREF(Py_None);
                  __Pyx_GIVEREF(Py_None);
                  __Pyx_GOTREF(__pyx_v_context->_extension_element_proxy);
                  __Pyx_DECREF(((PyObject *)__pyx_v_context->_extension_element_proxy));
                  __pyx_v_context->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None);

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":219
 *             finally:
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:             # <<<<<<<<<<<<<<
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:
 */
                  __pyx_t_12 = (((PyObject *)__pyx_v_self_node) != Py_None);
                  __pyx_t_1 = (__pyx_t_12 != 0);
                  if (__pyx_t_1) {

                    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":220
 *                 context._extension_element_proxy = None
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             try:
 */
                    __pyx_t_10 = __pyx_f_4lxml_5etree__freeReadOnlyProxies(__pyx_v_self_node); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L36_error;}
                    __Pyx_GOTREF(__pyx_t_10);
                    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                    goto __pyx_L37;
                  }
                  __pyx_L37:;
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_19);
                  __Pyx_XGIVEREF(__pyx_t_20);
                  __Pyx_XGIVEREF(__pyx_t_21);
                  __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
                }
                __Pyx_XGIVEREF(__pyx_t_16);
                __Pyx_XGIVEREF(__pyx_t_17);
                __Pyx_XGIVEREF(__pyx_t_18);
                __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
                __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
                __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
                goto __pyx_L16_error;
                __pyx_L36_error:;
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_19);
                  __Pyx_XGIVEREF(__pyx_t_20);
                  __Pyx_XGIVEREF(__pyx_t_21);
                  __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
                }
                __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
                __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
                goto __pyx_L16_error;
              }
              __pyx_L29:;
            }
          }
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L23_try_end;
          __pyx_L16_error:;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":221
 *                 if self_node is not None:
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             try:
 *                 e = unicode(e).encode(u"UTF-8")
 */
          __pyx_t_14 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
          if (__pyx_t_14) {
            __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_2);
            __pyx_v_e = __pyx_t_2;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":222
 *                     _freeReadOnlyProxies(self_node)
 *         except Exception, e:
 *             try:             # <<<<<<<<<<<<<<
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:
 */
            {
              __Pyx_ExceptionSave(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
              __Pyx_XGOTREF(__pyx_t_21);
              __Pyx_XGOTREF(__pyx_t_20);
              __Pyx_XGOTREF(__pyx_t_19);
              /*try:*/ {

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":223
 *         except Exception, e:
 *             try:
 *                 e = unicode(e).encode(u"UTF-8")             # <<<<<<<<<<<<<<
 *             except:
 *                 e = repr(e).encode(u"UTF-8")
 */
                __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L40_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_INCREF(__pyx_v_e);
                PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_e);
                __Pyx_GIVEREF(__pyx_v_e);
                __pyx_t_22 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_9, NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L40_error;}
                __Pyx_GOTREF(__pyx_t_22);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __pyx_t_9 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_22)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L40_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
                __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_9);
                __pyx_t_9 = 0;
              }
              __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
              __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
              __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
              goto __pyx_L47_try_end;
              __pyx_L40_error:;
              __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":224
 *             try:
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:             # <<<<<<<<<<<<<<
 *                 e = repr(e).encode(u"UTF-8")
 *             message = python.PyBytes_FromFormat(
 */
              /*except:*/ {
                __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_22, &__pyx_t_23) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L42_except_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_GOTREF(__pyx_t_22);
                __Pyx_GOTREF(__pyx_t_23);

                /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":225
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:
 *                 e = repr(e).encode(u"UTF-8")             # <<<<<<<<<<<<<<
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
 */
                __pyx_t_24 = PyObject_Repr(__pyx_v_e); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L42_except_error;}
                __Pyx_GOTREF(__pyx_t_24);
                __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_24, __pyx_n_s_encode); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L42_except_error;}
                __Pyx_GOTREF(__pyx_t_25);
                __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_25, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L42_except_error;}
                __Pyx_GOTREF(__pyx_t_24);
                __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
                __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_24);
                __pyx_t_24 = 0;
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
                goto __pyx_L41_exception_handled;
              }
              __pyx_L42_except_error:;
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_XGIVEREF(__pyx_t_20);
              __Pyx_XGIVEREF(__pyx_t_19);
              __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_20, __pyx_t_19);
              goto __pyx_L18_except_error;
              __pyx_L41_exception_handled:;
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_XGIVEREF(__pyx_t_20);
              __Pyx_XGIVEREF(__pyx_t_19);
              __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_20, __pyx_t_19);
              __pyx_L47_try_end:;
            }

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":226
 *             except:
 *                 e = repr(e).encode(u"UTF-8")
 *             message = python.PyBytes_FromFormat(             # <<<<<<<<<<<<<<
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
 */
            __pyx_t_23 = PyBytes_FromFormat(__pyx_k_Error_executing_extension_elemen, __pyx_v_c_inst_node->name, PyBytes_AS_STRING(__pyx_v_e)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
            __Pyx_GOTREF(__pyx_t_23);
            __pyx_v_message = ((PyObject*)__pyx_t_23);
            __pyx_t_23 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":229
 *                 "Error executing extension element '%s': %s",
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *         except:
 */
            __pyx_t_26 = __Pyx_PyObject_AsString(__pyx_v_message); if (unlikely((!__pyx_t_26) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
            xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_t_26);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":230
 *                 c_inst_node.name, _cstr(e))
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()             # <<<<<<<<<<<<<<
 *         except:
 *             # just in case
 */
            ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_store_raised(__pyx_v_context->__pyx_base._exc);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L17_exception_handled;
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":231
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()
 *         except:             # <<<<<<<<<<<<<<
 *             # just in case
 *             message = python.PyBytes_FromFormat(
 */
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_10);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":233
 *         except:
 *             # just in case
 *             message = python.PyBytes_FromFormat(             # <<<<<<<<<<<<<<
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 */
            __pyx_t_23 = PyBytes_FromFormat(__pyx_k_Error_executing_extension_elemen_2, __pyx_v_c_inst_node->name); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
            __Pyx_GOTREF(__pyx_t_23);
            __pyx_v_message = ((PyObject*)__pyx_t_23);
            __pyx_t_23 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":235
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)             # <<<<<<<<<<<<<<
 *             context._exc._store_raised()
 *     except:
 */
            __pyx_t_26 = __Pyx_PyObject_AsString(__pyx_v_message); if (unlikely((!__pyx_t_26) && PyErr_Occurred())) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
            xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_t_26);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":236
 *                 "Error executing extension element '%s'", c_inst_node.name)
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     except:
 *         # no Python functions here - everything can fail...
 */
            ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_store_raised(__pyx_v_context->__pyx_base._exc);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L17_exception_handled;
          }
          __pyx_L18_except_error:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          goto __pyx_L8_error;
          __pyx_L17_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          __pyx_L23_try_end:;
        }
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L15_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":237
 *             xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, message)
 *             context._exc._store_raised()
 *     except:             # <<<<<<<<<<<<<<
 *         # no Python functions here - everything can fail...
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
 */
      /*except:*/ {
        __Pyx_AddTraceback("lxml.etree._callExtensionElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_11);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":239
 *     except:
 *         # no Python functions here - everything can fail...
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,             # <<<<<<<<<<<<<<
 *                                 "Error during XSLT extension element evaluation")
 *         context._exc._store_raised()
 */
        xsltTransformError(__pyx_v_c_ctxt, NULL, __pyx_v_c_inst_node, __pyx_k_Error_during_XSLT_extension_elem);

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":241
 *         xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
 *                                 "Error during XSLT extension element evaluation")
 *         context._exc._store_raised()             # <<<<<<<<<<<<<<
 *     finally:
 *         return  # swallow any further exceptions
 */
        ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_context->__pyx_base._exc->__pyx_vtab)->_store_raised(__pyx_v_context->__pyx_base._exc);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L9_exception_handled;
      }
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L6_error;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L15_try_end:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":243
 *         context._exc._store_raised()
 *     finally:
 *         return  # swallow any further exceptions             # <<<<<<<<<<<<<<
 */
  /*finally:*/ {
    /*normal exit:*/{
      goto __pyx_L0;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      {
        goto __pyx_L54_return;
      }
      __pyx_L54_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
      goto __pyx_L0;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":162
 *             <xslt.xsltTransformFunction>_callExtensionElement)
 * 
 * cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,             # <<<<<<<<<<<<<<
 *                                 xmlNode* c_context_node,
 *                                 xmlNode* c_inst_node,
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_extension);
  __Pyx_XDECREF((PyObject *)__pyx_v_context_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_self_node);
  __Pyx_XDECREF(__pyx_v_output_parent);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3285
 *     u"Base class for XML validators."
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */

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

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3286
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):
 *         self._error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     def validate(self, etree):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_error_log);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_error_log));
  __pyx_v_self->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3285
 *     u"Base class for XML validators."
 *     cdef _ErrorLog _error_log
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._error_log = _ErrorLog()
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3288
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         u"""validate(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_3validate(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/
static char __pyx_doc_4lxml_5etree_10_Validator_2validate[] = "validate(self, etree)\n\n        Validate the document using this schema.\n\n        Returns true if document is valid, false if not.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_3validate(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("validate (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_2validate(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), ((PyObject *)__pyx_v_etree));

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

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_2validate(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("validate", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3295
 *         Returns true if document is valid, false if not.
 *         """
 *         return self(etree)             # <<<<<<<<<<<<<<
 * 
 *     def assertValid(self, etree):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_etree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_etree);
  __Pyx_GIVEREF(__pyx_v_etree);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3295; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3288
 *         self._error_log = _ErrorLog()
 * 
 *     def validate(self, etree):             # <<<<<<<<<<<<<<
 *         u"""validate(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3297
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         u"""assertValid(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_5assertValid(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/
static char __pyx_doc_4lxml_5etree_10_Validator_4assertValid[] = "assertValid(self, etree)\n\n        Raises `DocumentInvalid` if the document does not comply with the schema.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_5assertValid(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assertValid (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_4assertValid(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), ((PyObject *)__pyx_v_etree));

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

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_4assertValid(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assertValid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3302
 *         Raises `DocumentInvalid` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     u"Document does not comply with schema"),
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_etree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_etree);
  __Pyx_GIVEREF(__pyx_v_etree);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3303
 *         """
 *         if not self(etree):
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document does not comply with schema"),
 *                                   self._error_log)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DocumentInvalid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_kp_u_Document_does_not_comply_with_sc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3305
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(
 *                     u"Document does not comply with schema"),
 *                                   self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def assert_(self, etree):
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->_error_log));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->_error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_error_log));
    __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3303
 *         """
 *         if not self(etree):
 *             raise DocumentInvalid(self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document does not comply with schema"),
 *                                   self._error_log)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3297
 *         return self(etree)
 * 
 *     def assertValid(self, etree):             # <<<<<<<<<<<<<<
 *         u"""assertValid(self, etree)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._Validator.assertValid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3307
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         u"""assert_(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_7assert_(PyObject *__pyx_v_self, PyObject *__pyx_v_etree); /*proto*/
static char __pyx_doc_4lxml_5etree_10_Validator_6assert_[] = "assert_(self, etree)\n\n        Raises `AssertionError` if the document does not comply with the schema.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_7assert_(PyObject *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("assert_ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_6assert_(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), ((PyObject *)__pyx_v_etree));

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

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_6assert_(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, PyObject *__pyx_v_etree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assert_", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3312
 *         Raises `AssertionError` if the document does not comply with the schema.
 *         """
 *         if not self(etree):             # <<<<<<<<<<<<<<
 *             raise AssertionError, self._error_log._buildExceptionMessage(
 *                 u"Document does not comply with schema")
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_etree);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_etree);
  __Pyx_GIVEREF(__pyx_v_etree);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_self), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3313
 *         """
 *         if not self(etree):
 *             raise AssertionError, self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                 u"Document does not comply with schema")
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_kp_u_Document_does_not_comply_with_sc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3307
 *                                   self._error_log)
 * 
 *     def assert_(self, etree):             # <<<<<<<<<<<<<<
 *         u"""assert_(self, etree)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.assert_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3316
 *                 u"Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
 */

static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10_Validator__append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_append_log_message", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append_log_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_domain); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_level); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3318
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,             # <<<<<<<<<<<<<<
 *                                         filename)
 * 
 */
  __pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3316
 *                 u"Document does not comply with schema")
 * 
 *     cpdef _append_log_message(self, int domain, int type, int level, int line,             # <<<<<<<<<<<<<<
 *                               message, filename):
 *         self._error_log._receiveGeneric(domain, type, level, line, message,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_domain;
  int __pyx_v_type;
  int __pyx_v_level;
  int __pyx_v_line;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_append_log_message (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domain,&__pyx_n_s_type,&__pyx_n_s_level,&__pyx_n_s_line,&__pyx_n_s_message,&__pyx_n_s_filename,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_domain)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_line)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_append_log_message") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_domain = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_type = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_level = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_line = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_line == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_message = values[4];
    __pyx_v_filename = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_append_log_message", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_8_append_log_message(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self), __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename);

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

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_8_append_log_message(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_v_domain, int __pyx_v_type, int __pyx_v_level, int __pyx_v_line, PyObject *__pyx_v_message, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_append_log_message", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Validator *)__pyx_v_self->__pyx_vtab)->_append_log_message(__pyx_v_self, __pyx_v_domain, __pyx_v_type, __pyx_v_level, __pyx_v_line, __pyx_v_message, __pyx_v_filename, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator._append_log_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3321
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
 */

static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4lxml_5etree_10_Validator__clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_clear_error_log", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear_error_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3321; __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;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3322
 * 
 *     cpdef _clear_error_log(self):
 *         self._error_log.clear()             # <<<<<<<<<<<<<<
 * 
 *     property error_log:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->_error_log, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3321
 *                                         filename)
 * 
 *     cpdef _clear_error_log(self):             # <<<<<<<<<<<<<<
 *         self._error_log.clear()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator._clear_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_clear_error_log (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_10_clear_error_log(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_10_clear_error_log(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_clear_error_log", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__Validator *)__pyx_v_self->__pyx_vtab)->_clear_error_log(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._Validator._clear_error_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3326
 *     property error_log:
 *         u"The log of validation errors and warnings."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9error_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_10_Validator_9error_log_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(((struct __pyx_obj_4lxml_5etree__Validator *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_10_Validator_9error_log___get__(struct __pyx_obj_4lxml_5etree__Validator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3327
 *         u"The log of validation errors and warnings."
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"             # <<<<<<<<<<<<<<
 *             return self._error_log.copy()
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_error_log) != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_XPath_evaluator_not_initialised);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3328
 *         def __get__(self):
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()             # <<<<<<<<<<<<<<
 * 
 * include "dtd.pxi"        # DTD
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->_error_log->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->_error_log), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3326
 *     property error_log:
 *         u"The log of validation errors and warnings."
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             assert self._error_log is not None, "XPath evaluator not initialised"
 *             return self._error_log.copy()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._Validator.error_log.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":19
 *     pass
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:             # <<<<<<<<<<<<<<
 *     assert c_node is not NULL, u"invalid DTD proxy at %s" % id(node)
 * 
 */

static CYTHON_INLINE int __pyx_f_4lxml_5etree__assertValidDTDNode(PyObject *__pyx_v_node, void *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_assertValidDTDNode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":20
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:
 *     assert c_node is not NULL, u"invalid DTD proxy at %s" % id(node)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_c_node != NULL) != 0))) {
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_node);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_node);
      __Pyx_GIVEREF(__pyx_v_node);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_invalid_DTD_proxy_at_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[20]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":19
 *     pass
 * 
 * cdef inline int _assertValidDTDNode(node, void *c_node) except -1:             # <<<<<<<<<<<<<<
 *     assert c_node is not NULL, u"invalid DTD proxy at %s" % id(node)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._assertValidDTDNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":30
 *     cdef tree.xmlElementContent* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":31
 * 
 *     def __repr__(self):
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_module_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_occur); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_s_object_name_r_type_r_occur, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":30
 *     cdef tree.xmlElementContent* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r type=%r occur=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.type, self.occur, id(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":34
 * 
 *     property name:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":35
 *     property name:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":36
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property type:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->name != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":34
 * 
 *     property name:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":39
 * 
 *     property type:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.type
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4type___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  int __pyx_v_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContentType __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":40
 *     property type:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            cdef int type = self._c_node.type
 *            if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":41
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.type             # <<<<<<<<<<<<<<
 *            if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 *                return "pcdata"
 */
  __pyx_t_2 = __pyx_v_self->_c_node->type;
  __pyx_v_type = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":48
 *            elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *                return "seq"
 *            elif type == tree.XML_ELEMENT_CONTENT_OR:             # <<<<<<<<<<<<<<
 *                return "or"
 *            else:
 */
  switch (__pyx_v_type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":42
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.type
 *            if type == tree.XML_ELEMENT_CONTENT_PCDATA:             # <<<<<<<<<<<<<<
 *                return "pcdata"
 *            elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 */
    case XML_ELEMENT_CONTENT_PCDATA:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":43
 *            cdef int type = self._c_node.type
 *            if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 *                return "pcdata"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 *                return "element"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_pcdata);
    __pyx_r = __pyx_n_s_pcdata;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":44
 *            if type == tree.XML_ELEMENT_CONTENT_PCDATA:
 *                return "pcdata"
 *            elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:             # <<<<<<<<<<<<<<
 *                return "element"
 *            elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 */
    case XML_ELEMENT_CONTENT_ELEMENT:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":45
 *                return "pcdata"
 *            elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 *                return "element"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *                return "seq"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_element);
    __pyx_r = __pyx_n_s_element;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":46
 *            elif type == tree.XML_ELEMENT_CONTENT_ELEMENT:
 *                return "element"
 *            elif type == tree.XML_ELEMENT_CONTENT_SEQ:             # <<<<<<<<<<<<<<
 *                return "seq"
 *            elif type == tree.XML_ELEMENT_CONTENT_OR:
 */
    case XML_ELEMENT_CONTENT_SEQ:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":47
 *                return "element"
 *            elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *                return "seq"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_CONTENT_OR:
 *                return "or"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_seq);
    __pyx_r = __pyx_n_s_seq;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":48
 *            elif type == tree.XML_ELEMENT_CONTENT_SEQ:
 *                return "seq"
 *            elif type == tree.XML_ELEMENT_CONTENT_OR:             # <<<<<<<<<<<<<<
 *                return "or"
 *            else:
 */
    case XML_ELEMENT_CONTENT_OR:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":49
 *                return "seq"
 *            elif type == tree.XML_ELEMENT_CONTENT_OR:
 *                return "or"             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_or);
    __pyx_r = __pyx_n_s_or;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":51
 *                return "or"
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     property occur:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":39
 * 
 *     property type:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":54
 * 
 *     property occur:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int occur = self._c_node.ocur
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5occur_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5occur_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5occur___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5occur___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  int __pyx_v_occur;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContentOccur __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":55
 *     property occur:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            cdef int occur = self._c_node.ocur
 *            if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":56
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int occur = self._c_node.ocur             # <<<<<<<<<<<<<<
 *            if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 *                return "once"
 */
  __pyx_t_2 = __pyx_v_self->_c_node->ocur;
  __pyx_v_occur = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":63
 *            elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *                return "mult"
 *            elif occur == tree.XML_ELEMENT_CONTENT_PLUS:             # <<<<<<<<<<<<<<
 *                return "plus"
 *            else:
 */
  switch (__pyx_v_occur) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":57
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int occur = self._c_node.ocur
 *            if occur == tree.XML_ELEMENT_CONTENT_ONCE:             # <<<<<<<<<<<<<<
 *                return "once"
 *            elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 */
    case XML_ELEMENT_CONTENT_ONCE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":58
 *            cdef int occur = self._c_node.ocur
 *            if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 *                return "once"             # <<<<<<<<<<<<<<
 *            elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 *                return "opt"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_once);
    __pyx_r = __pyx_n_s_once;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":59
 *            if occur == tree.XML_ELEMENT_CONTENT_ONCE:
 *                return "once"
 *            elif occur == tree.XML_ELEMENT_CONTENT_OPT:             # <<<<<<<<<<<<<<
 *                return "opt"
 *            elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 */
    case XML_ELEMENT_CONTENT_OPT:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":60
 *                return "once"
 *            elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 *                return "opt"             # <<<<<<<<<<<<<<
 *            elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *                return "mult"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_opt);
    __pyx_r = __pyx_n_s_opt;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":61
 *            elif occur == tree.XML_ELEMENT_CONTENT_OPT:
 *                return "opt"
 *            elif occur == tree.XML_ELEMENT_CONTENT_MULT:             # <<<<<<<<<<<<<<
 *                return "mult"
 *            elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
 */
    case XML_ELEMENT_CONTENT_MULT:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":62
 *                return "opt"
 *            elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *                return "mult"             # <<<<<<<<<<<<<<
 *            elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
 *                return "plus"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_mult);
    __pyx_r = __pyx_n_s_mult;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":63
 *            elif occur == tree.XML_ELEMENT_CONTENT_MULT:
 *                return "mult"
 *            elif occur == tree.XML_ELEMENT_CONTENT_PLUS:             # <<<<<<<<<<<<<<
 *                return "plus"
 *            else:
 */
    case XML_ELEMENT_CONTENT_PLUS:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":64
 *                return "mult"
 *            elif occur == tree.XML_ELEMENT_CONTENT_PLUS:
 *                return "plus"             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_plus);
    __pyx_r = __pyx_n_s_plus;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":66
 *                return "plus"
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     property left:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":54
 * 
 *     property occur:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int occur = self._c_node.ocur
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.occur.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":69
 * 
 *     property left:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            c1 = self._c_node.c1
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4left_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4left_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4left___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_4left___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  xmlElementContent *__pyx_v_c1;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_node = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContent *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":70
 *     property left:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            c1 = self._c_node.c1
 *            if c1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":71
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            c1 = self._c_node.c1             # <<<<<<<<<<<<<<
 *            if c1:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 */
  __pyx_t_2 = __pyx_v_self->_c_node->c1;
  __pyx_v_c1 = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":72
 *            _assertValidDTDNode(self, self._c_node)
 *            c1 = self._c_node.c1
 *            if c1:             # <<<<<<<<<<<<<<
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd
 */
  __pyx_t_3 = (__pyx_v_c1 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":73
 *            c1 = self._c_node.c1
 *            if c1:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)             # <<<<<<<<<<<<<<
 *                node._dtd = self._dtd
 *                node._c_node = <tree.xmlElementContent*>c1
 */
    __pyx_t_4 = __pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__DTDElementContentDecl)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":74
 *            if c1:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *                node._c_node = <tree.xmlElementContent*>c1
 *                return node
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_node->_dtd);
    __Pyx_DECREF(((PyObject *)__pyx_v_node->_dtd));
    __pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":75
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd
 *                node._c_node = <tree.xmlElementContent*>c1             # <<<<<<<<<<<<<<
 *                return node
 *            else:
 */
    __pyx_v_node->_c_node = ((xmlElementContent *)__pyx_v_c1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":76
 *                node._dtd = self._dtd
 *                node._c_node = <tree.xmlElementContent*>c1
 *                return node             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_node));
    __pyx_r = ((PyObject *)__pyx_v_node);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":78
 *                return node
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     property right:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":69
 * 
 *     property left:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            c1 = self._c_node.c1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.left.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":81
 * 
 *     property right:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            c2 = self._c_node.c2
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5right_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5right_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5right___get__(((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_22_DTDElementContentDecl_5right___get__(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_self) {
  xmlElementContent *__pyx_v_c2;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_node = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContent *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":82
 *     property right:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            c2 = self._c_node.c2
 *            if c2:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":83
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            c2 = self._c_node.c2             # <<<<<<<<<<<<<<
 *            if c2:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 */
  __pyx_t_2 = __pyx_v_self->_c_node->c2;
  __pyx_v_c2 = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":84
 *            _assertValidDTDNode(self, self._c_node)
 *            c2 = self._c_node.c2
 *            if c2:             # <<<<<<<<<<<<<<
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd
 */
  __pyx_t_3 = (__pyx_v_c2 != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":85
 *            c2 = self._c_node.c2
 *            if c2:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)             # <<<<<<<<<<<<<<
 *                node._dtd = self._dtd
 *                node._c_node = <tree.xmlElementContent*>c2
 */
    __pyx_t_4 = __pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__DTDElementContentDecl)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":86
 *            if c2:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *                node._c_node = <tree.xmlElementContent*>c2
 *                return node
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_node->_dtd);
    __Pyx_DECREF(((PyObject *)__pyx_v_node->_dtd));
    __pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":87
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd
 *                node._c_node = <tree.xmlElementContent*>c2             # <<<<<<<<<<<<<<
 *                return node
 *            else:
 */
    __pyx_v_node->_c_node = ((xmlElementContent *)__pyx_v_c2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":88
 *                node._dtd = self._dtd
 *                node._c_node = <tree.xmlElementContent*>c2
 *                return node             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_node));
    __pyx_r = ((PyObject *)__pyx_v_node);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":90
 *                return node
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":81
 * 
 *     property right:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            c2 = self._c_node.c2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDElementContentDecl.right.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":100
 *     cdef tree.xmlAttribute* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":101
 * 
 *     def __repr__(self):
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_module_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_elemname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_default); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_default_value); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 8, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_s_s_object_name_r_elemname_r_pr, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":100
 *     cdef tree.xmlAttribute* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r elemname=%r prefix=%r type=%r default=%r default_value=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.elemname, self.prefix, self.type, self.default, self.default_value, id(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":104
 * 
 *     property name:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":105
 *     property name:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":106
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property elemname:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->name != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":104
 * 
 *     property name:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":109
 * 
 *     property elemname:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.elem) if self._c_node.elem is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_8elemname_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_8elemname_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_8elemname___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_8elemname___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":110
 *     property elemname:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            return funicode(self._c_node.elem) if self._c_node.elem is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":111
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.elem) if self._c_node.elem is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property prefix:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->elem != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->elem); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":109
 * 
 *     property elemname:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.elem) if self._c_node.elem is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.elemname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":114
 * 
 *     property prefix:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_6prefix___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":115
 *     property prefix:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":116
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property type:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->prefix != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":114
 * 
 *     property prefix:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":119
 * 
 *     property type:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.atype
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4type___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  int __pyx_v_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttributeType __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":120
 *     property type:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            cdef int type = self._c_node.atype
 *            if type == tree.XML_ATTRIBUTE_CDATA:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":121
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.atype             # <<<<<<<<<<<<<<
 *            if type == tree.XML_ATTRIBUTE_CDATA:
 *                return "cdata"
 */
  __pyx_t_2 = __pyx_v_self->_c_node->atype;
  __pyx_v_type = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":140
 *            elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *                return "enumeration"
 *            elif type == tree.XML_ATTRIBUTE_NOTATION:             # <<<<<<<<<<<<<<
 *                return "notation"
 *            else:
 */
  switch (__pyx_v_type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":122
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.atype
 *            if type == tree.XML_ATTRIBUTE_CDATA:             # <<<<<<<<<<<<<<
 *                return "cdata"
 *            elif type == tree.XML_ATTRIBUTE_ID:
 */
    case XML_ATTRIBUTE_CDATA:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":123
 *            cdef int type = self._c_node.atype
 *            if type == tree.XML_ATTRIBUTE_CDATA:
 *                return "cdata"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_ID:
 *                return "id"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_cdata);
    __pyx_r = __pyx_n_s_cdata;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":124
 *            if type == tree.XML_ATTRIBUTE_CDATA:
 *                return "cdata"
 *            elif type == tree.XML_ATTRIBUTE_ID:             # <<<<<<<<<<<<<<
 *                return "id"
 *            elif type == tree.XML_ATTRIBUTE_IDREF:
 */
    case XML_ATTRIBUTE_ID:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":125
 *                return "cdata"
 *            elif type == tree.XML_ATTRIBUTE_ID:
 *                return "id"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_IDREF:
 *                return "idref"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_id);
    __pyx_r = __pyx_n_s_id;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":126
 *            elif type == tree.XML_ATTRIBUTE_ID:
 *                return "id"
 *            elif type == tree.XML_ATTRIBUTE_IDREF:             # <<<<<<<<<<<<<<
 *                return "idref"
 *            elif type == tree.XML_ATTRIBUTE_IDREFS:
 */
    case XML_ATTRIBUTE_IDREF:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":127
 *                return "id"
 *            elif type == tree.XML_ATTRIBUTE_IDREF:
 *                return "idref"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_IDREFS:
 *                return "idrefs"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_idref);
    __pyx_r = __pyx_n_s_idref;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":128
 *            elif type == tree.XML_ATTRIBUTE_IDREF:
 *                return "idref"
 *            elif type == tree.XML_ATTRIBUTE_IDREFS:             # <<<<<<<<<<<<<<
 *                return "idrefs"
 *            elif type == tree.XML_ATTRIBUTE_ENTITY:
 */
    case XML_ATTRIBUTE_IDREFS:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":129
 *                return "idref"
 *            elif type == tree.XML_ATTRIBUTE_IDREFS:
 *                return "idrefs"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_ENTITY:
 *                return "entity"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_idrefs);
    __pyx_r = __pyx_n_s_idrefs;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":130
 *            elif type == tree.XML_ATTRIBUTE_IDREFS:
 *                return "idrefs"
 *            elif type == tree.XML_ATTRIBUTE_ENTITY:             # <<<<<<<<<<<<<<
 *                return "entity"
 *            elif type == tree.XML_ATTRIBUTE_ENTITIES:
 */
    case XML_ATTRIBUTE_ENTITY:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":131
 *                return "idrefs"
 *            elif type == tree.XML_ATTRIBUTE_ENTITY:
 *                return "entity"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *                return "entities"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_entity);
    __pyx_r = __pyx_n_s_entity;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":132
 *            elif type == tree.XML_ATTRIBUTE_ENTITY:
 *                return "entity"
 *            elif type == tree.XML_ATTRIBUTE_ENTITIES:             # <<<<<<<<<<<<<<
 *                return "entities"
 *            elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 */
    case XML_ATTRIBUTE_ENTITIES:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":133
 *                return "entity"
 *            elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *                return "entities"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *                return "nmtoken"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_entities);
    __pyx_r = __pyx_n_s_entities;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":134
 *            elif type == tree.XML_ATTRIBUTE_ENTITIES:
 *                return "entities"
 *            elif type == tree.XML_ATTRIBUTE_NMTOKEN:             # <<<<<<<<<<<<<<
 *                return "nmtoken"
 *            elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 */
    case XML_ATTRIBUTE_NMTOKEN:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":135
 *                return "entities"
 *            elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *                return "nmtoken"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *                return "nmtokens"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_nmtoken);
    __pyx_r = __pyx_n_s_nmtoken;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":136
 *            elif type == tree.XML_ATTRIBUTE_NMTOKEN:
 *                return "nmtoken"
 *            elif type == tree.XML_ATTRIBUTE_NMTOKENS:             # <<<<<<<<<<<<<<
 *                return "nmtokens"
 *            elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 */
    case XML_ATTRIBUTE_NMTOKENS:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":137
 *                return "nmtoken"
 *            elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *                return "nmtokens"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *                return "enumeration"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_nmtokens);
    __pyx_r = __pyx_n_s_nmtokens;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":138
 *            elif type == tree.XML_ATTRIBUTE_NMTOKENS:
 *                return "nmtokens"
 *            elif type == tree.XML_ATTRIBUTE_ENUMERATION:             # <<<<<<<<<<<<<<
 *                return "enumeration"
 *            elif type == tree.XML_ATTRIBUTE_NOTATION:
 */
    case XML_ATTRIBUTE_ENUMERATION:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":139
 *                return "nmtokens"
 *            elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *                return "enumeration"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ATTRIBUTE_NOTATION:
 *                return "notation"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_enumeration);
    __pyx_r = __pyx_n_s_enumeration;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":140
 *            elif type == tree.XML_ATTRIBUTE_ENUMERATION:
 *                return "enumeration"
 *            elif type == tree.XML_ATTRIBUTE_NOTATION:             # <<<<<<<<<<<<<<
 *                return "notation"
 *            else:
 */
    case XML_ATTRIBUTE_NOTATION:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":141
 *                return "enumeration"
 *            elif type == tree.XML_ATTRIBUTE_NOTATION:
 *                return "notation"             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_notation);
    __pyx_r = __pyx_n_s_notation;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":143
 *                return "notation"
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     property default:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":119
 * 
 *     property type:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.atype
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":146
 * 
 *     property default:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int default = self._c_node.def_
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_7default_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_7default_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_7default___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_7default___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  int __pyx_v_default;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttributeDefault __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":147
 *     property default:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            cdef int default = self._c_node.def_
 *            if default == tree.XML_ATTRIBUTE_NONE:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":148
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int default = self._c_node.def_             # <<<<<<<<<<<<<<
 *            if default == tree.XML_ATTRIBUTE_NONE:
 *                return "none"
 */
  __pyx_t_2 = __pyx_v_self->_c_node->def;
  __pyx_v_default = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":155
 *            elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *                return "implied"
 *            elif default == tree.XML_ATTRIBUTE_FIXED:             # <<<<<<<<<<<<<<
 *                return "fixed"
 *            else:
 */
  switch (__pyx_v_default) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":149
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int default = self._c_node.def_
 *            if default == tree.XML_ATTRIBUTE_NONE:             # <<<<<<<<<<<<<<
 *                return "none"
 *            elif default == tree.XML_ATTRIBUTE_REQUIRED:
 */
    case XML_ATTRIBUTE_NONE:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":150
 *            cdef int default = self._c_node.def_
 *            if default == tree.XML_ATTRIBUTE_NONE:
 *                return "none"             # <<<<<<<<<<<<<<
 *            elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *                return "required"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_none);
    __pyx_r = __pyx_n_s_none;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":151
 *            if default == tree.XML_ATTRIBUTE_NONE:
 *                return "none"
 *            elif default == tree.XML_ATTRIBUTE_REQUIRED:             # <<<<<<<<<<<<<<
 *                return "required"
 *            elif default == tree.XML_ATTRIBUTE_IMPLIED:
 */
    case XML_ATTRIBUTE_REQUIRED:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":152
 *                return "none"
 *            elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *                return "required"             # <<<<<<<<<<<<<<
 *            elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *                return "implied"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_required);
    __pyx_r = __pyx_n_s_required;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":153
 *            elif default == tree.XML_ATTRIBUTE_REQUIRED:
 *                return "required"
 *            elif default == tree.XML_ATTRIBUTE_IMPLIED:             # <<<<<<<<<<<<<<
 *                return "implied"
 *            elif default == tree.XML_ATTRIBUTE_FIXED:
 */
    case XML_ATTRIBUTE_IMPLIED:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":154
 *                return "required"
 *            elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *                return "implied"             # <<<<<<<<<<<<<<
 *            elif default == tree.XML_ATTRIBUTE_FIXED:
 *                return "fixed"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_implied);
    __pyx_r = __pyx_n_s_implied;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":155
 *            elif default == tree.XML_ATTRIBUTE_IMPLIED:
 *                return "implied"
 *            elif default == tree.XML_ATTRIBUTE_FIXED:             # <<<<<<<<<<<<<<
 *                return "fixed"
 *            else:
 */
    case XML_ATTRIBUTE_FIXED:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":156
 *                return "implied"
 *            elif default == tree.XML_ATTRIBUTE_FIXED:
 *                return "fixed"             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_fixed);
    __pyx_r = __pyx_n_s_fixed;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":158
 *                return "fixed"
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     property default_value:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":146
 * 
 *     property default:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int default = self._c_node.def_
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.default.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":161
 * 
 *     property default_value:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_13default_value_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_13default_value_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_13default_value___get__(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_13default_value___get__(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":162
 *     property default_value:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":163
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->defaultValue != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->defaultValue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":161
 * 
 *     property default_value:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.default_value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":165
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_2itervalues(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_2itervalues(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct__itervalues(__pyx_ptype_4lxml_5etree___pyx_scope_struct__itervalues, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_17_DTDAttributeDecl_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  xmlEnumeration *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":166
 * 
 *     def itervalues(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 *         while c_node is not NULL:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":167
 *     def itervalues(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             yield funicode(c_node.name)
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_c_node->tree;
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":168
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             yield funicode(c_node.name)
 *             c_node = c_node.next
 */
  while (1) {
    __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":169
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 *         while c_node is not NULL:
 *             yield funicode(c_node.name)             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
 */
    __pyx_t_4 = __pyx_f_4lxml_5etree_funicode(__pyx_cur_scope->__pyx_v_c_node->name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":170
 *         while c_node is not NULL:
 *             yield funicode(c_node.name)
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_c_node->next;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":165
 *            return funicode(self._c_node.defaultValue) if self._c_node.defaultValue is not NULL else None
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlEnumeration *c_node = self._c_node.tree
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":172
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_17_DTDAttributeDecl_5values(((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_17_DTDAttributeDecl_5values(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("values", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":173
 * 
 *     def values(self):
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 173; __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[20]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 173; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":172
 *             c_node = c_node.next
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return list(self.itervalues())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDAttributeDecl.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":183
 *     cdef tree.xmlElement* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":184
 * 
 *     def __repr__(self):
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_module_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prefix); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_s_object_name_r_prefix_r_type, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":183
 *     cdef tree.xmlElement* _c_node
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r prefix=%r type=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, self.prefix, self.type, id(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":187
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":188
 *     property name:
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":189
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property prefix:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->name != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":187
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":192
 * 
 *     property prefix:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6prefix_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_6prefix___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_6prefix___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":193
 *     property prefix:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":194
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property type:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->prefix != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->prefix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":192
 * 
 *     property prefix:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            return funicode(self._c_node.prefix) if self._c_node.prefix is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":197
 * 
 *     property type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.etype
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_4type___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_4type___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  int __pyx_v_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementTypeVal __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":198
 *     property type:
 *         def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            cdef int type = self._c_node.etype
 *            if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":199
 *         def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.etype             # <<<<<<<<<<<<<<
 *            if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 *                return "undefined"
 */
  __pyx_t_2 = __pyx_v_self->_c_node->etype;
  __pyx_v_type = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":208
 *            elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *                return "mixed"
 *            elif type == tree.XML_ELEMENT_TYPE_ELEMENT:             # <<<<<<<<<<<<<<
 *                return "element"
 *            else:
 */
  switch (__pyx_v_type) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":200
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.etype
 *            if type == tree.XML_ELEMENT_TYPE_UNDEFINED:             # <<<<<<<<<<<<<<
 *                return "undefined"
 *            elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 */
    case XML_ELEMENT_TYPE_UNDEFINED:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":201
 *            cdef int type = self._c_node.etype
 *            if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 *                return "undefined"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 *                return "empty"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_undefined);
    __pyx_r = __pyx_n_s_undefined;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":202
 *            if type == tree.XML_ELEMENT_TYPE_UNDEFINED:
 *                return "undefined"
 *            elif type == tree.XML_ELEMENT_TYPE_EMPTY:             # <<<<<<<<<<<<<<
 *                return "empty"
 *            elif type == tree.XML_ELEMENT_TYPE_ANY:
 */
    case XML_ELEMENT_TYPE_EMPTY:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":203
 *                return "undefined"
 *            elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 *                return "empty"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_TYPE_ANY:
 *                return "any"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_empty);
    __pyx_r = __pyx_n_s_empty;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":204
 *            elif type == tree.XML_ELEMENT_TYPE_EMPTY:
 *                return "empty"
 *            elif type == tree.XML_ELEMENT_TYPE_ANY:             # <<<<<<<<<<<<<<
 *                return "any"
 *            elif type == tree.XML_ELEMENT_TYPE_MIXED:
 */
    case XML_ELEMENT_TYPE_ANY:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":205
 *                return "empty"
 *            elif type == tree.XML_ELEMENT_TYPE_ANY:
 *                return "any"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *                return "mixed"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_any);
    __pyx_r = __pyx_n_s_any;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":206
 *            elif type == tree.XML_ELEMENT_TYPE_ANY:
 *                return "any"
 *            elif type == tree.XML_ELEMENT_TYPE_MIXED:             # <<<<<<<<<<<<<<
 *                return "mixed"
 *            elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
 */
    case XML_ELEMENT_TYPE_MIXED:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":207
 *                return "any"
 *            elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *                return "mixed"             # <<<<<<<<<<<<<<
 *            elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
 *                return "element"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_mixed);
    __pyx_r = __pyx_n_s_mixed;
    goto __pyx_L0;
    break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":208
 *            elif type == tree.XML_ELEMENT_TYPE_MIXED:
 *                return "mixed"
 *            elif type == tree.XML_ELEMENT_TYPE_ELEMENT:             # <<<<<<<<<<<<<<
 *                return "element"
 *            else:
 */
    case XML_ELEMENT_TYPE_ELEMENT:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":209
 *                return "mixed"
 *            elif type == tree.XML_ELEMENT_TYPE_ELEMENT:
 *                return "element"             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_element);
    __pyx_r = __pyx_n_s_element;
    goto __pyx_L0;
    break;
    default:

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":211
 *                return "element"
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     property content:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    break;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":197
 * 
 *     property type:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef int type = self._c_node.etype
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":214
 * 
 *     property content:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef tree.xmlElementContent *content = self._c_node.content
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_7content_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_7content_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_7content___get__(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  xmlElementContent *__pyx_v_content;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_v_node = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlElementContent *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":215
 *     property content:
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *            cdef tree.xmlElementContent *content = self._c_node.content
 *            if content:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":216
 *        def __get__(self):
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef tree.xmlElementContent *content = self._c_node.content             # <<<<<<<<<<<<<<
 *            if content:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 */
  __pyx_t_2 = __pyx_v_self->_c_node->content;
  __pyx_v_content = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":217
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef tree.xmlElementContent *content = self._c_node.content
 *            if content:             # <<<<<<<<<<<<<<
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd
 */
  __pyx_t_3 = (__pyx_v_content != 0);
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":218
 *            cdef tree.xmlElementContent *content = self._c_node.content
 *            if content:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)             # <<<<<<<<<<<<<<
 *                node._dtd = self._dtd
 *                node._c_node = content
 */
    __pyx_t_4 = __pyx_tp_new_4lxml_5etree__DTDElementContentDecl(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__DTDElementContentDecl)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_node = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":219
 *            if content:
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *                node._c_node = content
 *                return node
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_node->_dtd);
    __Pyx_DECREF(((PyObject *)__pyx_v_node->_dtd));
    __pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":220
 *                node = <_DTDElementContentDecl>_DTDElementContentDecl.__new__(_DTDElementContentDecl)
 *                node._dtd = self._dtd
 *                node._c_node = content             # <<<<<<<<<<<<<<
 *                return node
 *            else:
 */
    __pyx_v_node->_c_node = __pyx_v_content;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":221
 *                node._dtd = self._dtd
 *                node._c_node = content
 *                return node             # <<<<<<<<<<<<<<
 *            else:
 *                return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_node));
    __pyx_r = ((PyObject *)__pyx_v_node);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":223
 *                return node
 *            else:
 *                return None             # <<<<<<<<<<<<<<
 * 
 *     def iterattributes(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":214
 * 
 *     property content:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            _assertValidDTDNode(self, self._c_node)
 *            cdef tree.xmlElementContent *content = self._c_node.content
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.content.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":225
 *                return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterattributes (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_2iterattributes(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_2iterattributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterattributes", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1_iterattributes(__pyx_ptype_4lxml_5etree___pyx_scope_struct_1_iterattributes, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_15_DTDElementDecl_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  xmlAttribute *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":226
 * 
 *     def iterattributes(self):
 *         _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 *         while c_node:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":227
 *     def iterattributes(self):
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes             # <<<<<<<<<<<<<<
 *         while c_node:
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->_c_node->attributes;
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":228
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 *         while c_node:             # <<<<<<<<<<<<<<
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 *             node._dtd = self._dtd
 */
  while (1) {
    __pyx_t_3 = (__pyx_cur_scope->__pyx_v_c_node != 0);
    if (!__pyx_t_3) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":229
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 *         while c_node:
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)             # <<<<<<<<<<<<<<
 *             node._dtd = self._dtd
 *             node._c_node = c_node
 */
    __pyx_t_4 = __pyx_tp_new_4lxml_5etree__DTDAttributeDecl(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__DTDAttributeDecl)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)__pyx_t_5));
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":230
 *         while c_node:
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 *             node._dtd = self._dtd             # <<<<<<<<<<<<<<
 *             node._c_node = c_node
 *             yield node
 */
    __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_dtd);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node->_dtd);
    __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd));
    __pyx_cur_scope->__pyx_v_node->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":231
 *             node = <_DTDAttributeDecl>_DTDAttributeDecl.__new__(_DTDAttributeDecl)
 *             node._dtd = self._dtd
 *             node._c_node = c_node             # <<<<<<<<<<<<<<
 *             yield node
 *             c_node = c_node.nexth
 */
    __pyx_cur_scope->__pyx_v_node->_c_node = __pyx_cur_scope->__pyx_v_c_node;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":232
 *             node._dtd = self._dtd
 *             node._c_node = c_node
 *             yield node             # <<<<<<<<<<<<<<
 *             c_node = c_node.nexth
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":233
 *             node._c_node = c_node
 *             yield node
 *             c_node = c_node.nexth             # <<<<<<<<<<<<<<
 * 
 *     def attributes(self):
 */
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_c_node->nexth;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":225
 *                return None
 * 
 *     def iterattributes(self):             # <<<<<<<<<<<<<<
 *         _assertValidDTDNode(self, self._c_node)
 *         cdef tree.xmlAttribute *c_node = self._c_node.attributes
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":235
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("attributes (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_15_DTDElementDecl_5attributes(((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_15_DTDElementDecl_5attributes(struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":236
 * 
 *     def attributes(self):
 *         return list(self.iterattributes())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterattributes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 236; __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[20]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 236; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":235
 *             c_node = c_node.nexth
 * 
 *     def attributes(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterattributes())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._DTDElementDecl.attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":245
 *     cdef DTD _dtd
 *     cdef tree.xmlEntity* _c_node
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl___repr__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl___repr__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":246
 *     cdef tree.xmlEntity* _c_node
 *     def __repr__(self):
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_module_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __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);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_s_s_object_name_r_at_0x_x, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 246; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":245
 *     cdef DTD _dtd
 *     cdef tree.xmlEntity* _c_node
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<%s.%s object name=%r at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":249
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_4name___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4name___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":250
 *     property name:
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":251
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property orig:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->name != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":249
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.name) if self._c_node.name is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":254
 * 
 *     property orig:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.orig) if self._c_node.orig is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4orig_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_4orig_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_4orig___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_4orig___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":255
 *     property orig:
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.orig) if self._c_node.orig is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":256
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.orig) if self._c_node.orig is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     property content:
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->orig != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->orig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":254
 * 
 *     property orig:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.orig) if self._c_node.orig is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.orig.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":259
 * 
 *     property content:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.content) if self._c_node.content is not NULL else None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_7content_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_14_DTDEntityDecl_7content_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_14_DTDEntityDecl_7content___get__(((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_14_DTDEntityDecl_7content___get__(struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":260
 *     property content:
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)             # <<<<<<<<<<<<<<
 *             return funicode(self._c_node.content) if self._c_node.content is not NULL else None
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidDTDNode(((PyObject *)__pyx_v_self), __pyx_v_self->_c_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":261
 *         def __get__(self):
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.content) if self._c_node.content is not NULL else None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_c_node->content != NULL) != 0)) {
    __pyx_t_3 = __pyx_f_4lxml_5etree_funicode(__pyx_v_self->_c_node->content); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":259
 * 
 *     property content:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             _assertValidDTDNode(self, self._c_node)
 *             return funicode(self._c_node.content) if self._c_node.content is not NULL else None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree._DTDEntityDecl.content.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":276
 *     """
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if file is not None:
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_3DTD_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_3DTD_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_external_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,&__pyx_n_s_external_id,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_file = values[0];
    __pyx_v_external_id = values[1];
  }
  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[20]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD___init__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self), __pyx_v_file, __pyx_v_external_id);

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

static int __pyx_pf_4lxml_5etree_3DTD___init__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_external_id) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  xmlDtd *__pyx_t_11;
  const xmlChar *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_file);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":277
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if file is not None:
 *             if _isString(file):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 277; __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[20]; __pyx_lineno = 277; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 277; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":278
 *     def __init__(self, file=None, *, external_id=None):
 *         _Validator.__init__(self)
 *         if file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 */
  __pyx_t_4 = (__pyx_v_file != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":279
 *         _Validator.__init__(self)
 *         if file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
 */
    __pyx_t_5 = (_isString(__pyx_v_file) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":280
 *         if file is not None:
 *             if _isString(file):
 *                 file = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 with self._error_log:
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_file, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":281
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *             elif hasattr(file, 'read'):
 */
      /*with:*/ {
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        /*try:*/ {
          {
            if (__pyx_t_8||__pyx_t_9||__pyx_t_10); else {/*mark used*/};
            /*try:*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":282
 *                 file = _encodeFilename(file)
 *                 with self._error_log:
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))             # <<<<<<<<<<<<<<
 *             elif hasattr(file, 'read'):
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 */
              __pyx_v_self->_c_dtd = xmlParseDTD(NULL, (const xmlChar*)PyBytes_AS_STRING(__pyx_v_file));
            }
          }
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":281
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *             elif hasattr(file, 'read'):
 */
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__97, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
        goto __pyx_L17;
        __pyx_L5_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L1_error;
        __pyx_L17:;
      }
      goto __pyx_L4;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":283
 *                 with self._error_log:
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *             elif hasattr(file, 'read'):             # <<<<<<<<<<<<<<
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *             else:
 */
    __pyx_t_5 = PyObject_HasAttr(__pyx_v_file, __pyx_n_s_read); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = (__pyx_t_5 != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":284
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *             elif hasattr(file, 'read'):
 *                 self._c_dtd = _parseDtdFromFilelike(file)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 */
      __pyx_t_11 = __pyx_f_4lxml_5etree__parseDtdFromFilelike(__pyx_v_file); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_self->_c_dtd = __pyx_t_11;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":286
 *                 self._c_dtd = _parseDtdFromFilelike(file)
 *             else:
 *                 raise DTDParseError, u"file must be a filename or file-like object"             # <<<<<<<<<<<<<<
 *         elif external_id is not None:
 *             with self._error_log:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, __pyx_kp_u_file_must_be_a_filename_or_file, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[20]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L4:;
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":287
 *             else:
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 *         elif external_id is not None:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 */
  __pyx_t_4 = (__pyx_v_external_id != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":288
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 *         elif external_id is not None:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 *         else:
 */
    /*with:*/ {
      __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
      /*try:*/ {
        {
          __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_8);
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":289
 *         elif external_id is not None:
 *             with self._error_log:
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)             # <<<<<<<<<<<<<<
 *         else:
 *             raise DTDParseError, u"either filename or external ID required"
 */
            __pyx_t_12 = __Pyx_PyObject_AsUString(__pyx_v_external_id); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __pyx_v_self->_c_dtd = xmlParseDTD(((const xmlChar *)__pyx_t_12), NULL);
          }
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L29_try_end;
          __pyx_L22_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":288
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 *         elif external_id is not None:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 *         else:
 */
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_13 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
            __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
            if (__pyx_t_4) {
              __Pyx_GIVEREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_XGIVEREF(__pyx_t_1);
              __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
              __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; 
              {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L23_exception_handled;
          }
          __pyx_L24_except_error:;
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
          goto __pyx_L1_error;
          __pyx_L23_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
          __pyx_L29_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_6) {
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__98, NULL);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          goto __pyx_L21;
        }
        __pyx_L21:;
      }
      goto __pyx_L33;
      __pyx_L18_error:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L1_error;
      __pyx_L33:;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":291
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 *         else:
 *             raise DTDParseError, u"either filename or external ID required"             # <<<<<<<<<<<<<<
 * 
 *         if self._c_dtd is NULL:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDParseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, __pyx_kp_u_either_filename_or_external_ID_r, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":293
 *             raise DTDParseError, u"either filename or external ID required"
 * 
 *         if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),
 */
  __pyx_t_4 = ((__pyx_v_self->_c_dtd == NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":294
 * 
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDParseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":295
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),             # <<<<<<<<<<<<<<
 *                 self._error_log)
 * 
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_kp_u_error_parsing_DTD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":294
 * 
 *         if self._c_dtd is NULL:
 *             raise DTDParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(u"error parsing DTD"),
 *                 self._error_log)
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 294; __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_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":276
 *     """
 *     cdef tree.xmlDtd* _c_dtd
 *     def __init__(self, file=None, *, external_id=None):             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         if file is not None:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.DTD.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_file);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":299
 * 
 *     property name:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            if self._c_dtd is NULL:
 *                return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_4name___get__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_4name___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":300
 *     property name:
 *        def __get__(self):
 *            if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *                return None
 *            return funicodeOrNone(self._c_dtd.name)
 */
  __pyx_t_1 = ((__pyx_v_self->_c_dtd == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":301
 *        def __get__(self):
 *            if self._c_dtd is NULL:
 *                return None             # <<<<<<<<<<<<<<
 *            return funicodeOrNone(self._c_dtd.name)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":302
 *            if self._c_dtd is NULL:
 *                return None
 *            return funicodeOrNone(self._c_dtd.name)             # <<<<<<<<<<<<<<
 * 
 *     property external_id:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":299
 * 
 *     property name:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            if self._c_dtd is NULL:
 *                return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":305
 * 
 *     property external_id:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            if self._c_dtd is NULL:
 *                return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11external_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11external_id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_11external_id___get__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_11external_id___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":306
 *     property external_id:
 *        def __get__(self):
 *            if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *                return None
 *            return funicodeOrNone(self._c_dtd.ExternalID)
 */
  __pyx_t_1 = ((__pyx_v_self->_c_dtd == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":307
 *        def __get__(self):
 *            if self._c_dtd is NULL:
 *                return None             # <<<<<<<<<<<<<<
 *            return funicodeOrNone(self._c_dtd.ExternalID)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":308
 *            if self._c_dtd is NULL:
 *                return None
 *            return funicodeOrNone(self._c_dtd.ExternalID)             # <<<<<<<<<<<<<<
 * 
 *     property system_url:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->ExternalID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":305
 * 
 *     property external_id:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            if self._c_dtd is NULL:
 *                return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.external_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":311
 * 
 *     property system_url:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            if self._c_dtd is NULL:
 *                return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_10system_url_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_10system_url_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_10system_url___get__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_10system_url___get__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":312
 *     property system_url:
 *        def __get__(self):
 *            if self._c_dtd is NULL:             # <<<<<<<<<<<<<<
 *                return None
 *            return funicodeOrNone(self._c_dtd.SystemID)
 */
  __pyx_t_1 = ((__pyx_v_self->_c_dtd == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":313
 *        def __get__(self):
 *            if self._c_dtd is NULL:
 *                return None             # <<<<<<<<<<<<<<
 *            return funicodeOrNone(self._c_dtd.SystemID)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":314
 *            if self._c_dtd is NULL:
 *                return None
 *            return funicodeOrNone(self._c_dtd.SystemID)             # <<<<<<<<<<<<<<
 * 
 *     def iterelements(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicodeOrNone(__pyx_v_self->_c_dtd->SystemID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":311
 * 
 *     property system_url:
 *        def __get__(self):             # <<<<<<<<<<<<<<
 *            if self._c_dtd is NULL:
 *                return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.system_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_3DTD_4generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":316
 *            return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_3iterelements(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_3iterelements(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterelements (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_2iterelements(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_2iterelements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterelements", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2_iterelements(__pyx_ptype_4lxml_5etree___pyx_scope_struct_2_iterelements, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4lxml_5etree_3DTD_4generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.iterelements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_3DTD_4generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":317
 * 
 *     def iterelements(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 */
  if (((__pyx_cur_scope->__pyx_v_self->_c_dtd != NULL) != 0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_c_dtd->children;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":318
 *     def iterelements(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 *                 node = _DTDElementDecl()
 */
  while (1) {
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":319
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:             # <<<<<<<<<<<<<<
 *                 node = _DTDElementDecl()
 *                 node._dtd = self
 */
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_c_node->type == XML_ELEMENT_DECL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":320
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 *                 node = _DTDElementDecl()             # <<<<<<<<<<<<<<
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlElement*>c_node
 */
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__DTDElementDecl)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)__pyx_t_3));
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":321
 *             if c_node.type == tree.XML_ELEMENT_DECL:
 *                 node = _DTDElementDecl()
 *                 node._dtd = self             # <<<<<<<<<<<<<<
 *                 node._c_node = <tree.xmlElement*>c_node
 *                 yield node
 */
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node->_dtd);
      __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd));
      __pyx_cur_scope->__pyx_v_node->_dtd = __pyx_cur_scope->__pyx_v_self;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":322
 *                 node = _DTDElementDecl()
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlElement*>c_node             # <<<<<<<<<<<<<<
 *                 yield node
 *             c_node = c_node.next
 */
      __pyx_cur_scope->__pyx_v_node->_c_node = ((xmlElement *)__pyx_cur_scope->__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":323
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlElement*>c_node
 *                 yield node             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
      __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":324
 *                 node._c_node = <tree.xmlElement*>c_node
 *                 yield node
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     def elements(self):
 */
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_c_node->next;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":316
 *            return funicodeOrNone(self._c_dtd.SystemID)
 * 
 *     def iterelements(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("iterelements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":326
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_6elements(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_6elements(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elements (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_5elements(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_5elements(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elements", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":327
 * 
 *     def elements(self):
 *         return list(self.iterelements())             # <<<<<<<<<<<<<<
 * 
 *     def iterentities(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterelements); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 327; __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[20]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 327; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":326
 *             c_node = c_node.next
 * 
 *     def elements(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterelements())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.elements", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4lxml_5etree_3DTD_9generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":329
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_8iterentities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_8iterentities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterentities (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_7iterentities(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_7iterentities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterentities", 0);
  __pyx_cur_scope = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *)__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3_iterentities(__pyx_ptype_4lxml_5etree___pyx_scope_struct_3_iterentities, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4lxml_5etree_3DTD_9generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.iterentities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4lxml_5etree_3DTD_9generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *__pyx_cur_scope = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  xmlNode *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":330
 * 
 *     def iterentities(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL             # <<<<<<<<<<<<<<
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:
 */
  if (((__pyx_cur_scope->__pyx_v_self->_c_dtd != NULL) != 0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_c_dtd->children;
  } else {
    __pyx_t_1 = NULL;
  }
  __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":331
 *     def iterentities(self):
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:             # <<<<<<<<<<<<<<
 *             if c_node.type == tree.XML_ENTITY_DECL:
 *                 node = _DTDEntityDecl()
 */
  while (1) {
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_c_node != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":332
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:             # <<<<<<<<<<<<<<
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self
 */
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_c_node->type == XML_ENTITY_DECL) != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":333
 *         while c_node is not NULL:
 *             if c_node.type == tree.XML_ENTITY_DECL:
 *                 node = _DTDEntityDecl()             # <<<<<<<<<<<<<<
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlEntity*>c_node
 */
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__DTDEntityDecl)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)__pyx_t_3));
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":334
 *             if c_node.type == tree.XML_ENTITY_DECL:
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self             # <<<<<<<<<<<<<<
 *                 node._c_node = <tree.xmlEntity*>c_node
 *                 yield node
 */
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node->_dtd);
      __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_node->_dtd));
      __pyx_cur_scope->__pyx_v_node->_dtd = __pyx_cur_scope->__pyx_v_self;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":335
 *                 node = _DTDEntityDecl()
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlEntity*>c_node             # <<<<<<<<<<<<<<
 *                 yield node
 *             c_node = c_node.next
 */
      __pyx_cur_scope->__pyx_v_node->_c_node = ((xmlEntity *)__pyx_cur_scope->__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":336
 *                 node._dtd = self
 *                 node._c_node = <tree.xmlEntity*>c_node
 *                 yield node             # <<<<<<<<<<<<<<
 *             c_node = c_node.next
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
      __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":337
 *                 node._c_node = <tree.xmlEntity*>c_node
 *                 yield node
 *             c_node = c_node.next             # <<<<<<<<<<<<<<
 * 
 *     def entities(self):
 */
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_c_node->next;
    __pyx_cur_scope->__pyx_v_c_node = __pyx_t_1;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":329
 *         return list(self.iterelements())
 * 
 *     def iterentities(self):             # <<<<<<<<<<<<<<
 *         cdef tree.xmlNode *c_node = self._c_dtd.children if self._c_dtd is not NULL else NULL
 *         while c_node is not NULL:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("iterentities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":339
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11entities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4lxml_5etree_3DTD_11entities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("entities (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_10entities(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_10entities(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("entities", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":340
 * 
 *     def entities(self):
 *         return list(self.iterentities())             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterentities); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 340; __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[20]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 340; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":339
 *             c_node = c_node.next
 * 
 *     def entities(self):             # <<<<<<<<<<<<<<
 *         return list(self.iterentities())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.DTD.entities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":342
 *         return list(self.iterentities())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_3DTD_12__dealloc__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_3DTD_12__dealloc__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":343
 * 
 *     def __dealloc__(self):
 *         tree.xmlFreeDtd(self._c_dtd)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlFreeDtd(__pyx_v_self->_c_dtd);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":342
 *         return list(self.iterentities())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":345
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_3DTD_15__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_3DTD_14__call__[] = "__call__(self, etree)\n\n        Validate doc using the DTD.\n\n        Returns true if the document is valid, false if not.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_3DTD_14__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_3DTD_15__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[20]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_3DTD_14__call__(((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_v_self), __pyx_v_etree);

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

static PyObject *__pyx_pf_4lxml_5etree_3DTD_14__call__(struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  xmlDoc *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  char const *__pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":356
 *         cdef xmlDoc* c_doc
 *         cdef dtdvalid.xmlValidCtxt* valid_ctxt
 *         cdef int ret = -1             # <<<<<<<<<<<<<<
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 */
  __pyx_v_ret = -1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":358
 *         cdef int ret = -1
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_dtd != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_DTD_not_initialised);
      {__pyx_filename = __pyx_f[20]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":359
 * 
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":360
 *         assert self._c_dtd is not NULL, "DTD not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":362
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise DTDError(u"Failed to create validation context")
 */
  __pyx_v_valid_ctxt = xmlNewValidCtxt();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":363
 * 
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise DTDError(u"Failed to create validation context")
 * 
 */
  __pyx_t_2 = ((__pyx_v_valid_ctxt == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":364
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 *             raise DTDError(u"Failed to create validation context")             # <<<<<<<<<<<<<<
 * 
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 364; __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, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":368
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
 *         # https://bugzilla.gnome.org/show_bug.cgi?id=724903
 *         valid_ctxt.error = <dtdvalid.xmlValidityErrorFunc>_nullGenericErrorFunc             # <<<<<<<<<<<<<<
 *         valid_ctxt.userData = NULL
 * 
 */
  __pyx_v_valid_ctxt->error = ((xmlValidityErrorFunc)__pyx_f_4lxml_5etree__nullGenericErrorFunc);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":369
 *         # https://bugzilla.gnome.org/show_bug.cgi?id=724903
 *         valid_ctxt.error = <dtdvalid.xmlValidityErrorFunc>_nullGenericErrorFunc
 *         valid_ctxt.userData = NULL             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_v_valid_ctxt->userData = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":371
 *         valid_ctxt.userData = NULL
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":372
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 */
    /*with:*/ {
      __pyx_t_4 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      /*try:*/ {
        {
          __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":373
 *         try:
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 */
            __pyx_t_9 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
            __pyx_v_c_doc = __pyx_t_9;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":374
 *             with self._error_log:
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 */
            __pyx_v_ret = xmlValidateDtd(__pyx_v_valid_ctxt, __pyx_v_c_doc, __pyx_v_self->_c_dtd);

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":375
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 */
            __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
          }
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L18_try_end;
          __pyx_L11_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":372
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 */
          /*except:*/ {
            __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_11 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
            __pyx_t_13 = ((!(__pyx_t_2 != 0)) != 0);
            if (__pyx_t_13) {
              __Pyx_GIVEREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_1);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_10);
              __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_10 = 0; 
              {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L12_exception_handled;
          }
          __pyx_L13_except_error:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          goto __pyx_L5_error;
          __pyx_L12_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          __pyx_L18_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_4) {
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__100, NULL);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
      goto __pyx_L22;
      __pyx_L7_error:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L5_error;
      __pyx_L22:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":377
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_12 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_6, &__pyx_t_12, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_8, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_5 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
      {
        xmlFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_12, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_8, __pyx_t_7);
      __pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_12 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":379
 *             dtdvalid.xmlFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise DTDValidateError(u"Internal error in DTD validation",
 *                                    self._error_log)
 */
  __pyx_t_13 = ((__pyx_v_ret == -1) != 0);
  if (__pyx_t_13) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":380
 * 
 *         if ret == -1:
 *             raise DTDValidateError(u"Internal error in DTD validation",             # <<<<<<<<<<<<<<
 *                                    self._error_log)
 *         return ret == 1
 */
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDValidateError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":381
 *         if ret == -1:
 *             raise DTDValidateError(u"Internal error in DTD validation",
 *                                    self._error_log)             # <<<<<<<<<<<<<<
 *         return ret == 1
 * 
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_DTD_validation);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Internal_error_in_DTD_validation);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_DTD_validation);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":380
 * 
 *         if ret == -1:
 *             raise DTDValidateError(u"Internal error in DTD validation",             # <<<<<<<<<<<<<<
 *                                    self._error_log)
 *         return ret == 1
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":382
 *             raise DTDValidateError(u"Internal error in DTD validation",
 *                                    self._error_log)
 *         return ret == 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_ret == 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":345
 *         tree.xmlFreeDtd(self._c_dtd)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("lxml.etree.DTD.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":385
 * 
 * 
 * cdef tree.xmlDtd* _parseDtdFromFilelike(file) except NULL:             # <<<<<<<<<<<<<<
 *     cdef _ExceptionContext exc_context
 *     cdef _FileReaderContext dtd_parser
 */

static xmlDtd *__pyx_f_4lxml_5etree__parseDtdFromFilelike(PyObject *__pyx_v_file) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *__pyx_v_exc_context = 0;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *__pyx_v_dtd_parser = 0;
  struct __pyx_obj_4lxml_5etree__ErrorLog *__pyx_v_error_log = 0;
  xmlDtd *__pyx_v_c_dtd;
  xmlDtd *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parseDtdFromFilelike", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":390
 *     cdef _ErrorLog error_log
 *     cdef tree.xmlDtd* c_dtd
 *     exc_context = _ExceptionContext()             # <<<<<<<<<<<<<<
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 *     error_log = _ErrorLog()
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ExceptionContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":391
 *     cdef tree.xmlDtd* c_dtd
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)             # <<<<<<<<<<<<<<
 *     error_log = _ErrorLog()
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_file);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_file);
  __Pyx_GIVEREF(__pyx_v_file);
  __Pyx_INCREF(((PyObject *)__pyx_v_exc_context));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_exc_context));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_exc_context));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__FileReaderContext)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dtd_parser = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":392
 *     exc_context = _ExceptionContext()
 *     dtd_parser = _FileReaderContext(file, exc_context, None)
 *     error_log = _ErrorLog()             # <<<<<<<<<<<<<<
 * 
 *     with error_log:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ErrorLog)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":394
 *     error_log = _ErrorLog()
 * 
 *     with error_log:             # <<<<<<<<<<<<<<
 *         c_dtd = dtd_parser._readDtd()
 * 
 */
  /*with:*/ {
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_error_log); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    /*try:*/ {
      {
        if (__pyx_t_5||__pyx_t_6||__pyx_t_7); else {/*mark used*/};
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":395
 * 
 *     with error_log:
 *         c_dtd = dtd_parser._readDtd()             # <<<<<<<<<<<<<<
 * 
 *     exc_context._raise_if_stored()
 */
          __pyx_v_c_dtd = __pyx_f_4lxml_5etree_18_FileReaderContext__readDtd(__pyx_v_dtd_parser);
        }
      }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":394
 *     error_log = _ErrorLog()
 * 
 *     with error_log:             # <<<<<<<<<<<<<<
 *         c_dtd = dtd_parser._readDtd()
 * 
 */
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_3) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__101, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L15;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L1_error;
    __pyx_L15:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":397
 *         c_dtd = dtd_parser._readDtd()
 * 
 *     exc_context._raise_if_stored()             # <<<<<<<<<<<<<<
 *     if c_dtd is NULL:
 *         raise DTDParseError(u"error parsing DTD", error_log)
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext *)__pyx_v_exc_context->__pyx_vtab)->_raise_if_stored(__pyx_v_exc_context); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":398
 * 
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         raise DTDParseError(u"error parsing DTD", error_log)
 *     return c_dtd
 */
  __pyx_t_8 = ((__pyx_v_c_dtd == NULL) != 0);
  if (__pyx_t_8) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":399
 *     exc_context._raise_if_stored()
 *     if c_dtd is NULL:
 *         raise DTDParseError(u"error parsing DTD", error_log)             # <<<<<<<<<<<<<<
 *     return c_dtd
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDParseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 399; __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[20]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_kp_u_error_parsing_DTD);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_error_parsing_DTD);
    __Pyx_GIVEREF(__pyx_kp_u_error_parsing_DTD);
    __Pyx_INCREF(((PyObject *)__pyx_v_error_log));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_error_log));
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    {__pyx_filename = __pyx_f[20]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":400
 *     if c_dtd is NULL:
 *         raise DTDParseError(u"error parsing DTD", error_log)
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):
 */
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":385
 * 
 * 
 * cdef tree.xmlDtd* _parseDtdFromFilelike(file) except NULL:             # <<<<<<<<<<<<<<
 *     cdef _ExceptionContext exc_context
 *     cdef _FileReaderContext dtd_parser
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("lxml.etree._parseDtdFromFilelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_exc_context);
  __Pyx_XDECREF((PyObject *)__pyx_v_dtd_parser);
  __Pyx_XDECREF((PyObject *)__pyx_v_error_log);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":402
 *     return c_dtd
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):             # <<<<<<<<<<<<<<
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 */

static struct __pyx_obj_4lxml_5etree_DTD *__pyx_f_4lxml_5etree__dtdFactory(xmlDtd *__pyx_v_c_dtd) {
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_v_dtd = 0;
  struct __pyx_obj_4lxml_5etree_DTD *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  xmlDtd *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_dtdFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":405
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 *     if c_dtd is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     dtd = DTD.__new__(DTD)
 */
  __pyx_t_1 = ((__pyx_v_c_dtd == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":406
 *     cdef DTD dtd
 *     if c_dtd is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None);
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":407
 *     if c_dtd is NULL:
 *         return None
 *     dtd = DTD.__new__(DTD)             # <<<<<<<<<<<<<<
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)
 */
  __pyx_t_2 = __pyx_tp_new_4lxml_5etree_DTD(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree_DTD)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4lxml_5etree_DTD)))) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":408
 *         return None
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)             # <<<<<<<<<<<<<<
 *     _Validator.__init__(dtd)
 *     return dtd
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree__copyDtd(__pyx_v_c_dtd); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_dtd->_c_dtd = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":409
 *     dtd = DTD.__new__(DTD)
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)             # <<<<<<<<<<<<<<
 *     return dtd
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 409; __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[20]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_dtd));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_dtd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dtd));
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":410
 *     dtd._c_dtd = _copyDtd(c_dtd)
 *     _Validator.__init__(dtd)
 *     return dtd             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_dtd));
  __pyx_r = __pyx_v_dtd;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":402
 *     return c_dtd
 * 
 * cdef DTD _dtdFactory(tree.xmlDtd* c_dtd):             # <<<<<<<<<<<<<<
 *     # do not run through DTD.__init__()!
 *     cdef DTD dtd
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._dtdFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dtd);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":413
 * 
 * 
 * cdef tree.xmlDtd* _copyDtd(tree.xmlDtd* c_orig_dtd) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Copy a DTD.  libxml2 (currently) fails to set up the element->attributes
 */

static xmlDtd *__pyx_f_4lxml_5etree__copyDtd(xmlDtd *__pyx_v_c_orig_dtd) {
  xmlDtd *__pyx_v_c_dtd;
  xmlNode *__pyx_v_c_node;
  xmlDtd *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlNode *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copyDtd", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":418
 *     links when copying DTDs, so we have to rebuild them here.
 *     """
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)             # <<<<<<<<<<<<<<
 *     if not c_dtd:
 *         raise MemoryError
 */
  __pyx_v_c_dtd = xmlCopyDtd(__pyx_v_c_orig_dtd);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":419
 *     """
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)
 *     if not c_dtd:             # <<<<<<<<<<<<<<
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children
 */
  __pyx_t_1 = ((!(__pyx_v_c_dtd != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":420
 *     c_dtd = tree.xmlCopyDtd(c_orig_dtd)
 *     if not c_dtd:
 *         raise MemoryError             # <<<<<<<<<<<<<<
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[20]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":421
 *     if not c_dtd:
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children             # <<<<<<<<<<<<<<
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 */
  __pyx_t_2 = __pyx_v_c_dtd->children;
  __pyx_v_c_node = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":422
 *         raise MemoryError
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:             # <<<<<<<<<<<<<<
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_c_node != 0);
    if (!__pyx_t_1) break;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":423
 *     cdef tree.xmlNode* c_node = c_dtd.children
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:             # <<<<<<<<<<<<<<
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next
 */
    __pyx_t_1 = ((__pyx_v_c_node->type == XML_ATTRIBUTE_DECL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":424
 *     while c_node:
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)             # <<<<<<<<<<<<<<
 *         c_node = c_node.next
 *     return c_dtd
 */
      __pyx_f_4lxml_5etree__linkDtdAttribute(__pyx_v_c_dtd, ((xmlAttribute *)__pyx_v_c_node));
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":425
 *         if c_node.type == tree.XML_ATTRIBUTE_DECL:
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next             # <<<<<<<<<<<<<<
 *     return c_dtd
 * 
 */
    __pyx_t_2 = __pyx_v_c_node->next;
    __pyx_v_c_node = __pyx_t_2;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":426
 *             _linkDtdAttribute(c_dtd, <tree.xmlAttribute*>c_node)
 *         c_node = c_node.next
 *     return c_dtd             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_c_dtd;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":413
 * 
 * 
 * cdef tree.xmlDtd* _copyDtd(tree.xmlDtd* c_orig_dtd) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Copy a DTD.  libxml2 (currently) fails to set up the element->attributes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._copyDtd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":429
 * 
 * 
 * cdef void _linkDtdAttribute(tree.xmlDtd* c_dtd, tree.xmlAttribute* c_attr):             # <<<<<<<<<<<<<<
 *     """
 *     Create the link to the DTD attribute declaration from the corresponding
 */

static void __pyx_f_4lxml_5etree__linkDtdAttribute(xmlDtd *__pyx_v_c_dtd, xmlAttribute *__pyx_v_c_attr) {
  xmlElement *__pyx_v_c_elem;
  xmlAttribute *__pyx_v_c_pos;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  xmlAttribute *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_linkDtdAttribute", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":434
 *     element declaration.
 *     """
 *     c_elem = dtdvalid.xmlGetDtdElementDesc(c_dtd, c_attr.elem)             # <<<<<<<<<<<<<<
 *     if not c_elem:
 *         # no such element? something is wrong with the DTD ...
 */
  __pyx_v_c_elem = xmlGetDtdElementDesc(__pyx_v_c_dtd, __pyx_v_c_attr->elem);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":435
 *     """
 *     c_elem = dtdvalid.xmlGetDtdElementDesc(c_dtd, c_attr.elem)
 *     if not c_elem:             # <<<<<<<<<<<<<<
 *         # no such element? something is wrong with the DTD ...
 *         return
 */
  __pyx_t_1 = ((!(__pyx_v_c_elem != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":437
 *     if not c_elem:
 *         # no such element? something is wrong with the DTD ...
 *         return             # <<<<<<<<<<<<<<
 *     c_pos = c_elem.attributes
 *     if not c_pos:
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":438
 *         # no such element? something is wrong with the DTD ...
 *         return
 *     c_pos = c_elem.attributes             # <<<<<<<<<<<<<<
 *     if not c_pos:
 *         c_elem.attributes = c_attr
 */
  __pyx_t_2 = __pyx_v_c_elem->attributes;
  __pyx_v_c_pos = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":439
 *         return
 *     c_pos = c_elem.attributes
 *     if not c_pos:             # <<<<<<<<<<<<<<
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL
 */
  __pyx_t_1 = ((!(__pyx_v_c_pos != 0)) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":440
 *     c_pos = c_elem.attributes
 *     if not c_pos:
 *         c_elem.attributes = c_attr             # <<<<<<<<<<<<<<
 *         c_attr.nexth = NULL
 *         return
 */
    __pyx_v_c_elem->attributes = __pyx_v_c_attr;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":441
 *     if not c_pos:
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL             # <<<<<<<<<<<<<<
 *         return
 *     # libxml2 keeps namespace declarations first, and we need to make
 */
    __pyx_v_c_attr->nexth = NULL;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":442
 *         c_elem.attributes = c_attr
 *         c_attr.nexth = NULL
 *         return             # <<<<<<<<<<<<<<
 *     # libxml2 keeps namespace declarations first, and we need to make
 *     # sure we don't re-insert attributes that are already there
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":445
 *     # libxml2 keeps namespace declarations first, and we need to make
 *     # sure we don't re-insert attributes that are already there
 *     if _isDtdNsDecl(c_attr):             # <<<<<<<<<<<<<<
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr
 */
  __pyx_t_1 = (__pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_attr) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":446
 *     # sure we don't re-insert attributes that are already there
 *     if _isDtdNsDecl(c_attr):
 *         if not _isDtdNsDecl(c_pos):             # <<<<<<<<<<<<<<
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos
 */
    __pyx_t_1 = ((!(__pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_pos) != 0)) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":447
 *     if _isDtdNsDecl(c_attr):
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr             # <<<<<<<<<<<<<<
 *             c_attr.nexth = c_pos
 *             return
 */
      __pyx_v_c_elem->attributes = __pyx_v_c_attr;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":448
 *         if not _isDtdNsDecl(c_pos):
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos             # <<<<<<<<<<<<<<
 *             return
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):
 */
      __pyx_v_c_attr->nexth = __pyx_v_c_pos;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":449
 *             c_elem.attributes = c_attr
 *             c_attr.nexth = c_pos
 *             return             # <<<<<<<<<<<<<<
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):
 *             c_pos = c_pos.nexth
 */
      goto __pyx_L0;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":450
 *             c_attr.nexth = c_pos
 *             return
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):             # <<<<<<<<<<<<<<
 *             c_pos = c_pos.nexth
 *     else:
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_c_pos != __pyx_v_c_attr) != 0);
      if (__pyx_t_1) {
        if ((__pyx_v_c_pos->nexth != 0)) {
          __pyx_t_3 = (__pyx_f_4lxml_5etree__isDtdNsDecl(__pyx_v_c_pos->nexth) != 0);
          __pyx_t_4 = __pyx_t_3;
        } else {
          __pyx_t_4 = (__pyx_v_c_pos->nexth != 0);
        }
        __pyx_t_3 = __pyx_t_4;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      if (!__pyx_t_3) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":451
 *             return
 *         while c_pos != c_attr and c_pos.nexth and _isDtdNsDecl(c_pos.nexth):
 *             c_pos = c_pos.nexth             # <<<<<<<<<<<<<<
 *     else:
 *         # append at end
 */
      __pyx_t_2 = __pyx_v_c_pos->nexth;
      __pyx_v_c_pos = __pyx_t_2;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":454
 *     else:
 *         # append at end
 *         while c_pos != c_attr and c_pos.nexth:             # <<<<<<<<<<<<<<
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:
 */
    while (1) {
      __pyx_t_3 = ((__pyx_v_c_pos != __pyx_v_c_attr) != 0);
      if (__pyx_t_3) {
        __pyx_t_1 = (__pyx_v_c_pos->nexth != 0);
      } else {
        __pyx_t_1 = __pyx_t_3;
      }
      if (!__pyx_t_1) break;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":455
 *         # append at end
 *         while c_pos != c_attr and c_pos.nexth:
 *             c_pos = c_pos.nexth             # <<<<<<<<<<<<<<
 *     if c_pos == c_attr:
 *         return
 */
      __pyx_t_2 = __pyx_v_c_pos->nexth;
      __pyx_v_c_pos = __pyx_t_2;
    }
  }
  __pyx_L5:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":456
 *         while c_pos != c_attr and c_pos.nexth:
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:             # <<<<<<<<<<<<<<
 *         return
 *     c_attr.nexth = c_pos.nexth
 */
  __pyx_t_1 = ((__pyx_v_c_pos == __pyx_v_c_attr) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":457
 *             c_pos = c_pos.nexth
 *     if c_pos == c_attr:
 *         return             # <<<<<<<<<<<<<<
 *     c_attr.nexth = c_pos.nexth
 *     c_pos.nexth = c_attr
 */
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":458
 *     if c_pos == c_attr:
 *         return
 *     c_attr.nexth = c_pos.nexth             # <<<<<<<<<<<<<<
 *     c_pos.nexth = c_attr
 * 
 */
  __pyx_t_2 = __pyx_v_c_pos->nexth;
  __pyx_v_c_attr->nexth = __pyx_t_2;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":459
 *         return
 *     c_attr.nexth = c_pos.nexth
 *     c_pos.nexth = c_attr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_c_pos->nexth = __pyx_v_c_attr;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":429
 * 
 * 
 * cdef void _linkDtdAttribute(tree.xmlDtd* c_dtd, tree.xmlAttribute* c_attr):             # <<<<<<<<<<<<<<
 *     """
 *     Create the link to the DTD attribute declaration from the corresponding
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":462
 * 
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr):             # <<<<<<<<<<<<<<
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 */

static int __pyx_f_4lxml_5etree__isDtdNsDecl(xmlAttribute *__pyx_v_c_attr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_isDtdNsDecl", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":463
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr):
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:             # <<<<<<<<<<<<<<
 *         return True
 *     if (c_attr.prefix is not NULL and
 */
  __pyx_t_1 = ((strcmp(((const char *)__pyx_v_c_attr->name), __pyx_k_xmlns) == 0) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":464
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr):
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True             # <<<<<<<<<<<<<<
 *     if (c_attr.prefix is not NULL and
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":465
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 *     if (c_attr.prefix is not NULL and             # <<<<<<<<<<<<<<
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
 */
  __pyx_t_1 = ((__pyx_v_c_attr->prefix != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":466
 *         return True
 *     if (c_attr.prefix is not NULL and
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
    __pyx_t_2 = ((strcmp(((const char *)__pyx_v_c_attr->prefix), __pyx_k_xmlns) == 0) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":467
 *     if (c_attr.prefix is not NULL and
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":468
 *             cstring_h.strcmp(<const_char*>c_attr.prefix, "xmlns") == 0):
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":462
 * 
 * 
 * cdef bint _isDtdNsDecl(tree.xmlAttribute* c_attr):             # <<<<<<<<<<<<<<
 *     if cstring_h.strcmp(<const_char*>c_attr.name, "xmlns") == 0:
 *         return True
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":30
 *     """
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 * 
 */

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

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

static int __pyx_pf_4lxml_5etree_7RelaxNG___cinit__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":31
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None):
 */
  __pyx_v_self->_c_schema = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":30
 *     """
 *     cdef relaxng.xmlRelaxNG* _c_schema
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":33
 *         self._c_schema = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_7RelaxNG_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_7RelaxNG_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_file,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  }
  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[21]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG_2__init__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self), __pyx_v_etree, __pyx_v_file);

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

static int __pyx_pf_4lxml_5etree_7RelaxNG_2__init__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlNode *__pyx_v_c_node;
  xmlDoc *__pyx_v_fake_c_doc;
  xmlRelaxNGParserCtxt *__pyx_v_parser_ctxt;
  const xmlChar *__pyx_v_c_href;
  PyObject *__pyx_v_filename = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  xmlDoc *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":39
 *         cdef xmlDoc* fake_c_doc
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         fake_c_doc = NULL
 *         if etree is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 39; __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[21]; __pyx_lineno = 39; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 39; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":40
 *         cdef relaxng.xmlRelaxNGParserCtxt* parser_ctxt
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 */
  __pyx_v_fake_c_doc = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":41
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":42
 *         fake_c_doc = NULL
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             c_node = root_node._c_node
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":43
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             c_node = root_node._c_node
 *             # work around for libxml2 crash bug if document is not RNG at all
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":44
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             c_node = root_node._c_node             # <<<<<<<<<<<<<<
 *             # work around for libxml2 crash bug if document is not RNG at all
 *             if _LIBXML_VERSION_INT < 20624:
 */
    __pyx_t_6 = __pyx_v_root_node->_c_node;
    __pyx_v_c_node = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":46
 *             c_node = root_node._c_node
 *             # work around for libxml2 crash bug if document is not RNG at all
 *             if _LIBXML_VERSION_INT < 20624:             # <<<<<<<<<<<<<<
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \
 */
    __pyx_t_5 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":47
 *             # work around for libxml2 crash bug if document is not RNG at all
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *                 if c_href is NULL or \
 *                        tree.xmlStrcmp(
 */
      __pyx_v_c_href = _getNs(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":48
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \             # <<<<<<<<<<<<<<
 *                        tree.xmlStrcmp(
 *                            c_href, <unsigned char*>'http://relaxng.org/ns/structure/1.0') != 0:
 */
      __pyx_t_5 = ((__pyx_v_c_href == NULL) != 0);
      if (!__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":50
 *                 if c_href is NULL or \
 *                        tree.xmlStrcmp(
 *                            c_href, <unsigned char*>'http://relaxng.org/ns/structure/1.0') != 0:             # <<<<<<<<<<<<<<
 *                     raise RelaxNGParseError, u"Document is not Relax NG"
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
        __pyx_t_4 = ((xmlStrcmp(__pyx_v_c_href, ((unsigned char *)((unsigned char *)__pyx_k_http_relaxng_org_ns_structure_1))) != 0) != 0);
        __pyx_t_7 = __pyx_t_4;
      } else {
        __pyx_t_7 = __pyx_t_5;
      }
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":51
 *                        tree.xmlStrcmp(
 *                            c_href, <unsigned char*>'http://relaxng.org/ns/structure/1.0') != 0:
 *                     raise RelaxNGParseError, u"Document is not Relax NG"             # <<<<<<<<<<<<<<
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 */
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, __pyx_kp_u_Document_is_not_Relax_NG, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[21]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":52
 *                            c_href, <unsigned char*>'http://relaxng.org/ns/structure/1.0') != 0:
 *                     raise RelaxNGParseError, u"Document is not Relax NG"
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 */
    __pyx_t_8 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fake_c_doc = __pyx_t_8;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":53
 *                     raise RelaxNGParseError, u"Document is not Relax NG"
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             if _isString(file):
 */
    __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_fake_c_doc);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":54
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 doc = None
 */
  __pyx_t_7 = (__pyx_v_file != Py_None);
  __pyx_t_5 = (__pyx_t_7 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":55
 *             parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 doc = None
 *                 filename = _encodeFilename(file)
 */
    __pyx_t_5 = (_isString(__pyx_v_file) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":56
 *         elif file is not None:
 *             if _isString(file):
 *                 doc = None             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 with self._error_log:
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_doc = ((struct LxmlDocument *)Py_None);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":57
 *             if _isString(file):
 *                 doc = None
 *                 filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 with self._error_log:
 *                     parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 */
      __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_filename = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":58
 *                 doc = None
 *                 filename = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *             else:
 */
      /*with:*/ {
        __pyx_t_9 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        /*try:*/ {
          {
            if (__pyx_t_11||__pyx_t_12||__pyx_t_13); else {/*mark used*/};
            /*try:*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":59
 *                 filename = _encodeFilename(file)
 *                 with self._error_log:
 *                     parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 doc = _parseDocument(file, None, None)
 */
              __pyx_v_parser_ctxt = xmlRelaxNGNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));
            }
          }
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":58
 *                 doc = None
 *                 filename = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *             else:
 */
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_9) {
              __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__102, NULL);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            }
            goto __pyx_L10;
          }
          __pyx_L10:;
        }
        goto __pyx_L19;
        __pyx_L7_error:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L1_error;
        __pyx_L19:;
      }
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":61
 *                     parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *             else:
 *                 doc = _parseDocument(file, None, None)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":62
 *             else:
 *                 doc = _parseDocument(file, None, None)
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise RelaxNGParseError, u"No tree or file given"
 */
      __pyx_v_parser_ctxt = xmlRelaxNGNewDocParserCtxt(__pyx_v_doc->_c_doc);
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":64
 *                 parser_ctxt = relaxng.xmlRelaxNGNewDocParserCtxt(doc._c_doc)
 *         else:
 *             raise RelaxNGParseError, u"No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, __pyx_kp_u_No_tree_or_file_given, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":66
 *             raise RelaxNGParseError, u"No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
  __pyx_t_5 = ((__pyx_v_parser_ctxt == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":67
 * 
 *         if parser_ctxt is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 */
    __pyx_t_5 = ((__pyx_v_fake_c_doc != NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":68
 *         if parser_ctxt is NULL:
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(
 */
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
      goto __pyx_L21;
    }
    __pyx_L21:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":69
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not parsable as Relax NG"),
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":70
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document is not parsable as Relax NG"),
 *                 self._error_log)
 */
    __pyx_t_2 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_kp_u_Document_is_not_parsable_as_Rela); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":69
 *             if fake_c_doc is not NULL:
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not parsable as Relax NG"),
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_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_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 69; __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_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":74
 *                 self._error_log)
 * 
 *         relaxng.xmlRelaxNGSetParserStructuredErrors(             # <<<<<<<<<<<<<<
 *             parser_ctxt, _receiveError, <void*>self._error_log)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 */
  xmlRelaxNGSetParserStructuredErrors(__pyx_v_parser_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":76
 *         relaxng.xmlRelaxNGSetParserStructuredErrors(
 *             parser_ctxt, _receiveError, <void*>self._error_log)
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if _LIBXML_VERSION_INT >= 20624:
 */
  __pyx_v_self->_c_schema = xmlRelaxNGParse(__pyx_v_parser_ctxt);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":78
 *         self._c_schema = relaxng.xmlRelaxNGParse(parser_ctxt)
 * 
 *         if _LIBXML_VERSION_INT >= 20624:             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 */
  __pyx_t_5 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20624) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":79
 * 
 *         if _LIBXML_VERSION_INT >= 20624:
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
 */
    xmlRelaxNGFreeParserCtxt(__pyx_v_parser_ctxt);
    goto __pyx_L22;
  }
  __pyx_L22:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":80
 *         if _LIBXML_VERSION_INT >= 20624:
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             if fake_c_doc is not NULL:
 *                 if _LIBXML_VERSION_INT < 20624:
 */
  __pyx_t_5 = ((__pyx_v_self->_c_schema == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":81
 *             relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 if _LIBXML_VERSION_INT < 20624:
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 */
    __pyx_t_5 = ((__pyx_v_fake_c_doc != NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":82
 *         if self._c_schema is NULL:
 *             if fake_c_doc is not NULL:
 *                 if _LIBXML_VERSION_INT < 20624:             # <<<<<<<<<<<<<<
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 */
      __pyx_t_5 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624) != 0);
      if (__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":83
 *             if fake_c_doc is not NULL:
 *                 if _LIBXML_VERSION_INT < 20624:
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 */
        xmlRelaxNGFreeParserCtxt(__pyx_v_parser_ctxt);
        goto __pyx_L25;
      }
      __pyx_L25:;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":84
 *                 if _LIBXML_VERSION_INT < 20624:
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(
 */
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
      goto __pyx_L24;
    }
    __pyx_L24:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":85
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid Relax NG"),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGParseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":86
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document is not valid Relax NG"),
 *                 self._error_log)
 */
    __pyx_t_1 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_kp_u_Document_is_not_valid_Relax_NG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":85
 *                     relaxng.xmlRelaxNGFreeParserCtxt(parser_ctxt)
 *                 _destroyFakeDoc(doc._c_doc, fake_c_doc)
 *             raise RelaxNGParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid Relax NG"),
 */
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 85; __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_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 85; __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_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":89
 *                     u"Document is not valid Relax NG"),
 *                 self._error_log)
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 */
  __pyx_t_5 = ((__pyx_v_fake_c_doc != NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":90
 *                 self._error_log)
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":33
 *         self._c_schema = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":92
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_7RelaxNG_4__dealloc__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_7RelaxNG_4__dealloc__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":93
 * 
 *     def __dealloc__(self):
 *         relaxng.xmlRelaxNGFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlRelaxNGFree(__pyx_v_self->_c_schema);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":92
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":95
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_7RelaxNG_6__call__[] = "__call__(self, etree)\n\n        Validate doc using Relax NG.\n\n        Returns true if document is valid, false if not.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_7RelaxNG_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[21]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_7RelaxNG_6__call__(((struct __pyx_obj_4lxml_5etree_RelaxNG *)__pyx_v_self), __pyx_v_etree);

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

static PyObject *__pyx_pf_4lxml_5etree_7RelaxNG_6__call__(struct __pyx_obj_4lxml_5etree_RelaxNG *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlRelaxNGValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":107
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_schema != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_RelaxNG_instance_not_initialised);
      {__pyx_filename = __pyx_f[21]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":108
 * 
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":109
 *         assert self._c_schema is not NULL, "RelaxNG instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":111
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise MemoryError()
 */
  __pyx_v_valid_ctxt = xmlRelaxNGNewValidCtxt(__pyx_v_self->_c_schema);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":112
 * 
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_2 = ((__pyx_v_valid_ctxt == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":113
 *         valid_ctxt = relaxng.xmlRelaxNGNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[21]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":115
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._error_log.clear()
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":116
 * 
 *         try:
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->__pyx_base._error_log, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":117
 *         try:
 *             self._error_log.clear()
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
    xmlRelaxNGSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":119
 *             relaxng.xmlRelaxNGSetValidStructuredErrors(
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __pyx_v_c_doc = __pyx_t_3;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":120
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":121
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 */
          __pyx_v_ret = xmlRelaxNGValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":120
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":122
 *             with nogil:
 *                 ret = relaxng.xmlRelaxNGValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":124
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlRelaxNGFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":126
 *             relaxng.xmlRelaxNGFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise RelaxNGValidateError(
 *                 u"Internal error in Relax NG validation",
 */
  __pyx_t_2 = ((__pyx_v_ret == -1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":127
 * 
 *         if ret == -1:
 *             raise RelaxNGValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGValidateError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":129
 *             raise RelaxNGValidateError(
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
 */
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_Relax_NG_valid);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_Internal_error_in_Relax_NG_valid);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_Relax_NG_valid);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":127
 * 
 *         if ret == -1:
 *             raise RelaxNGValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)
 */
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_Raise(__pyx_t_14, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    {__pyx_filename = __pyx_f[21]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":130
 *                 u"Internal error in Relax NG validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_ret == 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":131
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":133
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":95
 *         relaxng.xmlRelaxNGFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree.RelaxNG.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":39
 *     cdef bint _has_default_attributes
 *     cdef bint _add_attribute_defaults
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe
 */

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

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

static int __pyx_pf_4lxml_5etree_9XMLSchema___cinit__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":40
 *     cdef bint _add_attribute_defaults
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 *         self._has_default_attributes = True # play safe
 *         self._add_attribute_defaults = False
 */
  __pyx_v_self->_c_schema = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":41
 *     def __cinit__(self):
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = False
 * 
 */
  __pyx_v_self->_has_default_attributes = 1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":42
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe
 *         self._add_attribute_defaults = False             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None, attribute_defaults=False):
 */
  __pyx_v_self->_add_attribute_defaults = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":39
 *     cdef bint _has_default_attributes
 *     cdef bint _add_attribute_defaults
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 *         self._has_default_attributes = True # play safe
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":44
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_9XMLSchema_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_9XMLSchema_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  PyObject *__pyx_v_attribute_defaults = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_file,&__pyx_n_s_attribute_defaults,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 1; index < 3 && kw_args > 0; index++) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
    __pyx_v_attribute_defaults = values[2];
  }
  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[22]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLSchema_2__init__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self), __pyx_v_etree, __pyx_v_file, __pyx_v_attribute_defaults);

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

static int __pyx_pf_4lxml_5etree_9XMLSchema_2__init__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file, PyObject *__pyx_v_attribute_defaults) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_fake_c_doc;
  xmlNode *__pyx_v_c_node;
  xmlSchemaParserCtxt *__pyx_v_parser_ctxt;
  const xmlChar *__pyx_v_c_href;
  PyObject *__pyx_v_filename = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  xmlNode *__pyx_t_6;
  int __pyx_t_7;
  xmlDoc *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":51
 *         cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
 * 
 *         self._add_attribute_defaults = attribute_defaults             # <<<<<<<<<<<<<<
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_add_attribute_defaults = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":52
 * 
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         fake_c_doc = NULL
 *         if etree is not None:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 52; __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[22]; __pyx_lineno = 52; __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_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":53
 *         self._add_attribute_defaults = attribute_defaults
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL             # <<<<<<<<<<<<<<
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 */
  __pyx_v_fake_c_doc = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":54
 *         _Validator.__init__(self)
 *         fake_c_doc = NULL
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_1 = (__pyx_v_etree != Py_None);
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":55
 *         fake_c_doc = NULL
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 * 
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":56
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *             # work around for libxml2 bug if document is not XML schema at all
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":59
 * 
 *             # work around for libxml2 bug if document is not XML schema at all
 *             if _LIBXML_VERSION_INT < 20624:             # <<<<<<<<<<<<<<
 *                 c_node = root_node._c_node
 *                 c_href = _getNs(c_node)
 */
    __pyx_t_5 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT < 20624) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":60
 *             # work around for libxml2 bug if document is not XML schema at all
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_node = root_node._c_node             # <<<<<<<<<<<<<<
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \
 */
      __pyx_t_6 = __pyx_v_root_node->_c_node;
      __pyx_v_c_node = __pyx_t_6;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":61
 *             if _LIBXML_VERSION_INT < 20624:
 *                 c_node = root_node._c_node
 *                 c_href = _getNs(c_node)             # <<<<<<<<<<<<<<
 *                 if c_href is NULL or \
 *                        tree.xmlStrcmp(
 */
      __pyx_v_c_href = _getNs(__pyx_v_c_node);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":62
 *                 c_node = root_node._c_node
 *                 c_href = _getNs(c_node)
 *                 if c_href is NULL or \             # <<<<<<<<<<<<<<
 *                        tree.xmlStrcmp(
 *                            c_href, <unsigned char*>'http://www.w3.org/2001/XMLSchema') != 0:
 */
      __pyx_t_5 = ((__pyx_v_c_href == NULL) != 0);
      if (!__pyx_t_5) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":64
 *                 if c_href is NULL or \
 *                        tree.xmlStrcmp(
 *                            c_href, <unsigned char*>'http://www.w3.org/2001/XMLSchema') != 0:             # <<<<<<<<<<<<<<
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"
 * 
 */
        __pyx_t_1 = ((xmlStrcmp(__pyx_v_c_href, ((unsigned char *)((unsigned char *)__pyx_k_http_www_w3_org_2001_XMLSchema))) != 0) != 0);
        __pyx_t_7 = __pyx_t_1;
      } else {
        __pyx_t_7 = __pyx_t_5;
      }
      if (__pyx_t_7) {

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":65
 *                        tree.xmlStrcmp(
 *                            c_href, <unsigned char*>'http://www.w3.org/2001/XMLSchema') != 0:
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"             # <<<<<<<<<<<<<<
 * 
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSchemaParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, __pyx_kp_u_Document_is_not_XML_Schema, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[22]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":67
 *                     raise XMLSchemaParseError, u"Document is not XML Schema"
 * 
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 */
    __pyx_t_8 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fake_c_doc = __pyx_t_8;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":68
 * 
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             if _isString(file):
 */
    __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_fake_c_doc);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":69
 *             fake_c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             if _isString(file):
 *                 doc = None
 */
  __pyx_t_7 = (__pyx_v_file != Py_None);
  __pyx_t_5 = (__pyx_t_7 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":70
 *             parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(fake_c_doc)
 *         elif file is not None:
 *             if _isString(file):             # <<<<<<<<<<<<<<
 *                 doc = None
 *                 filename = _encodeFilename(file)
 */
    __pyx_t_5 = (_isString(__pyx_v_file) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":71
 *         elif file is not None:
 *             if _isString(file):
 *                 doc = None             # <<<<<<<<<<<<<<
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_doc = ((struct LxmlDocument *)Py_None);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":72
 *             if _isString(file):
 *                 doc = None
 *                 filename = _encodeFilename(file)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 */
      __pyx_t_4 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_file); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_filename = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":73
 *                 doc = None
 *                 filename = _encodeFilename(file)
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *             else:
 *                 doc = _parseDocument(file, None, None)
 */
      __pyx_v_parser_ctxt = xmlSchemaNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":75
 *                 parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
 *             else:
 *                 doc = _parseDocument(file, None, None)             # <<<<<<<<<<<<<<
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)
 *         else:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__parseDocument(__pyx_v_file, ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None), Py_None)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":76
 *             else:
 *                 doc = _parseDocument(file, None, None)
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)             # <<<<<<<<<<<<<<
 *         else:
 *             raise XMLSchemaParseError, u"No tree or file given"
 */
      __pyx_v_parser_ctxt = xmlSchemaNewDocParserCtxt(__pyx_v_doc->_c_doc);
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":78
 *                 parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(doc._c_doc)
 *         else:
 *             raise XMLSchemaParseError, u"No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is not NULL:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSchemaParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, __pyx_kp_u_No_tree_or_file_given, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":80
 *             raise XMLSchemaParseError, u"No tree or file given"
 * 
 *         if parser_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetParserStructuredErrors(
 *                 parser_ctxt, _receiveError, <void*>self._error_log)
 */
  __pyx_t_5 = ((__pyx_v_parser_ctxt != NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":81
 * 
 *         if parser_ctxt is not NULL:
 *             xmlschema.xmlSchemaSetParserStructuredErrors(             # <<<<<<<<<<<<<<
 *                 parser_ctxt, _receiveError, <void*>self._error_log)
 *             if doc is None:
 */
    xmlSchemaSetParserStructuredErrors(__pyx_v_parser_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":83
 *             xmlschema.xmlSchemaSetParserStructuredErrors(
 *                 parser_ctxt, _receiveError, <void*>self._error_log)
 *             if doc is None:             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 */
    __pyx_t_5 = (((PyObject *)__pyx_v_doc) == Py_None);
    __pyx_t_7 = (__pyx_t_5 != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":84
 *                 parser_ctxt, _receiveError, <void*>self._error_log)
 *             if doc is None:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             else:
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":85
 *             if doc is None:
 *                 with nogil:
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *             else:
 *                 # calling xmlSchemaParse on a schema with imports or
 */
            __pyx_v_self->_c_schema = xmlSchemaParse(__pyx_v_parser_ctxt);
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":84
 *                 parser_ctxt, _receiveError, <void*>self._error_log)
 *             if doc is None:
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *             else:
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
      }
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":91
 *                 # context for parsing, so push an implied context to route
 *                 # resolve requests to the document's parser
 *                 __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(doc._parser)             # <<<<<<<<<<<<<<
 *                 self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 */
      __pyx_t_4 = ((PyObject *)__pyx_v_doc->_parser);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":92
 *                 # resolve requests to the document's parser
 *                 __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(doc._parser)
 *                 self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 * 
 */
      __pyx_v_self->_c_schema = xmlSchemaParse(__pyx_v_parser_ctxt);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":93
 *                 __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(doc._parser)
 *                 self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()             # <<<<<<<<<<<<<<
 * 
 *             if _LIBXML_VERSION_INT >= 20624:
 */
      __pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);
    }
    __pyx_L8:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":95
 *                 __GLOBAL_PARSER_CONTEXT.popImpliedContext()
 * 
 *             if _LIBXML_VERSION_INT >= 20624:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 */
    __pyx_t_7 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20624) != 0);
    if (__pyx_t_7) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":96
 * 
 *             if _LIBXML_VERSION_INT >= 20624:
 *                 xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if fake_c_doc is not NULL:
 */
      xmlSchemaFreeParserCtxt(__pyx_v_parser_ctxt);
      goto __pyx_L12;
    }
    __pyx_L12:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":98
 *                 xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
 * 
 *         if fake_c_doc is not NULL:             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 */
  __pyx_t_7 = ((__pyx_v_fake_c_doc != NULL) != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":99
 * 
 *         if fake_c_doc is not NULL:
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_fake_c_doc);
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":101
 *             _destroyFakeDoc(doc._c_doc, fake_c_doc)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(
 */
  __pyx_t_7 = ((__pyx_v_self->_c_schema == NULL) != 0);
  if (__pyx_t_7) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":102
 * 
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid XML Schema"),
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSchemaParseError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":103
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(
 *                 self._error_log._buildExceptionMessage(             # <<<<<<<<<<<<<<
 *                     u"Document is not valid XML Schema"),
 *                 self._error_log)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage(((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_v_self->__pyx_base._error_log), __pyx_kp_u_Document_is_not_valid_XML_Schema); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":102
 * 
 *         if self._c_schema is NULL:
 *             raise XMLSchemaParseError(             # <<<<<<<<<<<<<<
 *                 self._error_log._buildExceptionMessage(
 *                     u"Document is not valid XML Schema"),
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 102; __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_INCREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":107
 *                 self._error_log)
 * 
 *         if doc is not None:             # <<<<<<<<<<<<<<
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \
 */
  __pyx_t_7 = (((PyObject *)__pyx_v_doc) != Py_None);
  __pyx_t_5 = (__pyx_t_7 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":108
 * 
 *         if doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(doc)             # <<<<<<<<<<<<<<
 *         self._add_attribute_defaults = attribute_defaults and \
 *                                        self._has_default_attributes
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_doc));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_doc));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_doc));
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->_has_default_attributes = __pyx_t_5;
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":109
 *         if doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \             # <<<<<<<<<<<<<<
 *                                        self._has_default_attributes
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_defaults); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":110
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \
 *                                        self._has_default_attributes             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->_has_default_attributes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_v_attribute_defaults);
    __pyx_t_3 = __pyx_v_attribute_defaults;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":109
 *         if doc is not None:
 *             self._has_default_attributes = _check_for_default_attributes(doc)
 *         self._add_attribute_defaults = attribute_defaults and \             # <<<<<<<<<<<<<<
 *                                        self._has_default_attributes
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->_add_attribute_defaults = __pyx_t_5;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":44
 *         self._add_attribute_defaults = False
 * 
 *     def __init__(self, etree=None, *, file=None, attribute_defaults=False):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

  /* function exit code */
  __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("lxml.etree.XMLSchema.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":112
 *                                        self._has_default_attributes
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_9XMLSchema_4__dealloc__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self));

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

static void __pyx_pf_4lxml_5etree_9XMLSchema_4__dealloc__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":113
 * 
 *     def __dealloc__(self):
 *         xmlschema.xmlSchemaFree(self._c_schema)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
  xmlSchemaFree(__pyx_v_self->_c_schema);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":112
 *                                        self._has_default_attributes
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":115
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9XMLSchema_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9XMLSchema_6__call__[] = "__call__(self, etree)\n\n        Validate doc using XML Schema.\n\n        Returns true if document is valid, false if not.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_9XMLSchema_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[22]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9XMLSchema_6__call__(((struct __pyx_obj_4lxml_5etree_XMLSchema *)__pyx_v_self), __pyx_v_etree);

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

static PyObject *__pyx_pf_4lxml_5etree_9XMLSchema_6__call__(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, PyObject *__pyx_v_etree) {
  xmlSchemaValidCtxt *__pyx_v_valid_ctxt;
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  xmlDoc *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":128
 *         cdef int ret
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_schema != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Schema_instance_not_initialised);
      {__pyx_filename = __pyx_f[22]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":129
 * 
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":130
 *         assert self._c_schema is not NULL, "Schema instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":132
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)             # <<<<<<<<<<<<<<
 *         if valid_ctxt is NULL:
 *             raise MemoryError()
 */
  __pyx_v_valid_ctxt = xmlSchemaNewValidCtxt(__pyx_v_self->_c_schema);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":133
 * 
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_2 = ((__pyx_v_valid_ctxt == NULL) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":134
 *         valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[22]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":136
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self._add_attribute_defaults:
 *                 xmlschema.xmlSchemaSetValidOptions(
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":137
 * 
 *         try:
 *             if self._add_attribute_defaults:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 */
    __pyx_t_2 = (__pyx_v_self->_add_attribute_defaults != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":138
 *         try:
 *             if self._add_attribute_defaults:
 *                 xmlschema.xmlSchemaSetValidOptions(             # <<<<<<<<<<<<<<
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
 */
      xmlSchemaSetValidOptions(__pyx_v_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":141
 *                     valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 * 
 *             self._error_log.clear()             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->__pyx_base._error_log, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":142
 * 
 *             self._error_log.clear()
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 * 
 */
    xmlSchemaSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":145
 *                 valid_ctxt, _receiveError, <void*>self._error_log)
 * 
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
    __pyx_v_c_doc = __pyx_t_3;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":146
 * 
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":147
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 */
          __pyx_v_ret = xmlSchemaValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":146
 * 
 *             c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L10;
          }
          __pyx_L10:;
        }
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":148
 *             with nogil:
 *                 ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
 *             _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 */
    __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":150
 *             _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchemaFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        xmlSchemaFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":152
 *             xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise XMLSchemaValidateError(
 *                 u"Internal error in XML Schema validation.",
 */
  __pyx_t_2 = ((__pyx_v_ret == -1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":153
 * 
 *         if ret == -1:
 *             raise XMLSchemaValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSchemaValidateError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":155
 *             raise XMLSchemaValidateError(
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
 */
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_XML_Schema_val);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u_Internal_error_in_XML_Schema_val);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_XML_Schema_val);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":153
 * 
 *         if ret == -1:
 *             raise XMLSchemaValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)
 */
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_Raise(__pyx_t_14, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    {__pyx_filename = __pyx_f[22]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":156
 *                 u"Internal error in XML Schema validation.",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_ret == 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":157
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":159
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":115
 *         xmlschema.xmlSchemaFree(self._c_schema)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("lxml.etree.XMLSchema.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":161
 *             return False
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(             # <<<<<<<<<<<<<<
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
 */

static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator(struct __pyx_obj_4lxml_5etree_XMLSchema *__pyx_v_self, int __pyx_v_add_default_attributes) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_context = 0;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_newSaxValidator", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":164
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)             # <<<<<<<<<<<<<<
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (
 */
  __pyx_t_1 = __pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(((PyTypeObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserSchemaValidationContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext)))) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_context = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":165
 *         cdef _ParserSchemaValidationContext context
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
 *         context._schema = self             # <<<<<<<<<<<<<<
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_context->_schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_context->_schema));
  __pyx_v_context->_schema = __pyx_v_self;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":166
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (             # <<<<<<<<<<<<<<
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context
 */
  if (__pyx_v_self->_has_default_attributes) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":167
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))             # <<<<<<<<<<<<<<
 *         return context
 * 
 */
    if (!__pyx_v_add_default_attributes) {
      __pyx_t_2 = __pyx_v_self->_add_attribute_defaults;
    } else {
      __pyx_t_2 = __pyx_v_add_default_attributes;
    }
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_v_self->_has_default_attributes;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":166
 *         context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
 *         context._schema = self
 *         context._add_default_attributes = (self._has_default_attributes and (             # <<<<<<<<<<<<<<
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context
 */
  __pyx_v_context->_add_default_attributes = __pyx_t_3;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":168
 *         context._add_default_attributes = (self._has_default_attributes and (
 *             add_default_attributes or self._add_attribute_defaults))
 *         return context             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __pyx_r = __pyx_v_context;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":161
 *             return False
 * 
 *     cdef _ParserSchemaValidationContext _newSaxValidator(             # <<<<<<<<<<<<<<
 *             self, bint add_default_attributes):
 *         cdef _ParserSchemaValidationContext context
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.XMLSchema._newSaxValidator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_context);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":177
 *     cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 */

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

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

static int __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext___cinit__(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":178
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL             # <<<<<<<<<<<<<<
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False
 */
  __pyx_v_self->_valid_ctxt = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":179
 *     def __cinit__(self):
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL             # <<<<<<<<<<<<<<
 *         self._add_default_attributes = False
 * 
 */
  __pyx_v_self->_sax_plug = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":180
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 *         self._add_default_attributes = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_add_default_attributes = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":177
 *     cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
 *     cdef bint _add_default_attributes
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._valid_ctxt = NULL
 *         self._sax_plug = NULL
 */

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

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":182
 *         self._add_default_attributes = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.disconnect()
 *         if self._valid_ctxt:
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_30_ParserSchemaValidationContext_2__dealloc__(((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_v_self));

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

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

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":183
 * 
 *     def __dealloc__(self):
 *         self.disconnect()             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 */
  __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(__pyx_v_self);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":184
 *     def __dealloc__(self):
 *         self.disconnect()
 *         if self._valid_ctxt:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_valid_ctxt != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":185
 *         self.disconnect()
 *         if self._valid_ctxt:
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
 */
    xmlSchemaFreeValidCtxt(__pyx_v_self->_valid_ctxt);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":182
 *         self._add_default_attributes = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.disconnect()
 *         if self._valid_ctxt:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":187
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 *     cdef _ParserSchemaValidationContext copy(self):             # <<<<<<<<<<<<<<
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
 */

static struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":188
 * 
 *     cdef _ParserSchemaValidationContext copy(self):
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"             # <<<<<<<<<<<<<<
 *         return self._schema._newSaxValidator(
 *             self._add_default_attributes)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (((PyObject *)__pyx_v_self->_schema) != Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_ParserSchemaValidationContext_n);
      {__pyx_filename = __pyx_f[22]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":189
 *     cdef _ParserSchemaValidationContext copy(self):
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(             # <<<<<<<<<<<<<<
 *             self._add_default_attributes)
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":190
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
 *             self._add_default_attributes)             # <<<<<<<<<<<<<<
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc):
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4lxml_5etree_XMLSchema *)__pyx_v_self->_schema->__pyx_base.__pyx_vtab)->_newSaxValidator(__pyx_v_self->_schema, __pyx_v_self->_add_default_attributes)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":187
 *             xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
 * 
 *     cdef _ParserSchemaValidationContext copy(self):             # <<<<<<<<<<<<<<
 *         assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
 *         return self._schema._newSaxValidator(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":192
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc):             # <<<<<<<<<<<<<<
 *         # we currently need to insert default attributes manually
 *         # after parsing, as libxml2 does not support this at parse
 */

static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlDoc *__pyx_v_c_doc) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("inject_default_attributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":196
 *         # after parsing, as libxml2 does not support this at parse
 *         # time
 *         if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 */
  __pyx_t_1 = (__pyx_v_self->_add_default_attributes != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":197
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":198
 *         if self._add_default_attributes:
 *             with nogil:
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
 */
          xmlSchemaValidateDoc(__pyx_v_self->_valid_ctxt, __pyx_v_c_doc);
        }

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":197
 *         # time
 *         if self._add_default_attributes:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L6;
          }
          __pyx_L6:;
        }
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":192
 *             self._add_default_attributes)
 * 
 *     cdef void inject_default_attributes(self, xmlDoc* c_doc):             # <<<<<<<<<<<<<<
 *         # we currently need to insert default attributes manually
 *         # after parsing, as libxml2 does not support this at parse
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":200
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 */

static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self, xmlParserCtxt *__pyx_v_c_ctxt, struct __pyx_obj_4lxml_5etree__BaseErrorLog *__pyx_v_error_log) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":201
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 */
  __pyx_t_1 = ((__pyx_v_self->_valid_ctxt == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":202
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(             # <<<<<<<<<<<<<<
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
 */
    __pyx_v_self->_valid_ctxt = xmlSchemaNewValidCtxt(__pyx_v_self->_schema->_c_schema);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":204
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             if self._add_default_attributes:
 */
    __pyx_t_1 = ((__pyx_v_self->_valid_ctxt == NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":205
 *                 self._schema._c_schema)
 *             if self._valid_ctxt is NULL:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             if self._add_default_attributes:
 *                 xmlschema.xmlSchemaSetValidOptions(
 */
      PyErr_NoMemory(); {__pyx_filename = __pyx_f[22]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":206
 *             if self._valid_ctxt is NULL:
 *                 raise MemoryError()
 *             if self._add_default_attributes:             # <<<<<<<<<<<<<<
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 */
    __pyx_t_1 = (__pyx_v_self->_add_default_attributes != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":207
 *                 raise MemoryError()
 *             if self._add_default_attributes:
 *                 xmlschema.xmlSchemaSetValidOptions(             # <<<<<<<<<<<<<<
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:
 */
      xmlSchemaSetValidOptions(__pyx_v_self->_valid_ctxt, XML_SCHEMA_VAL_VC_I_CREATE);
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":209
 *                 xmlschema.xmlSchemaSetValidOptions(
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, _receiveError, <void*>error_log)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_error_log) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":210
 *                     self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
 *         if error_log is not None:
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 self._valid_ctxt, _receiveError, <void*>error_log)
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(
 */
    xmlSchemaSetValidStructuredErrors(__pyx_v_self->_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_error_log));
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":212
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, _receiveError, <void*>error_log)
 *         self._sax_plug = xmlschema.xmlSchemaSAXPlug(             # <<<<<<<<<<<<<<
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 */
  __pyx_v_self->_sax_plug = xmlSchemaSAXPlug(__pyx_v_self->_valid_ctxt, (&__pyx_v_c_ctxt->sax), (&__pyx_v_c_ctxt->userData));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":200
 *                 xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
 * 
 *     cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree._ParserSchemaValidationContext.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":215
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self):             # <<<<<<<<<<<<<<
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 */

static void __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("disconnect", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":216
 * 
 *     cdef void disconnect(self):
 *         if self._sax_plug is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_sax_plug != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":217
 *     cdef void disconnect(self):
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)             # <<<<<<<<<<<<<<
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:
 */
    xmlSchemaSAXUnplug(__pyx_v_self->_sax_plug);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":218
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is not NULL:
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 */
    __pyx_v_self->_sax_plug = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":219
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:             # <<<<<<<<<<<<<<
 *             xmlschema.xmlSchemaSetValidStructuredErrors(
 *                 self._valid_ctxt, NULL, NULL)
 */
  __pyx_t_1 = ((__pyx_v_self->_valid_ctxt != NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":220
 *             self._sax_plug = NULL
 *         if self._valid_ctxt is not NULL:
 *             xmlschema.xmlSchemaSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                 self._valid_ctxt, NULL, NULL)
 * 
 */
    xmlSchemaSetValidStructuredErrors(__pyx_v_self->_valid_ctxt, NULL, NULL);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":215
 *             self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
 * 
 *     cdef void disconnect(self):             # <<<<<<<<<<<<<<
 *         if self._sax_plug is not NULL:
 *             xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":223
 *                 self._valid_ctxt, NULL, NULL)
 * 
 *     cdef bint isvalid(self):             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 */

static int __pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("isvalid", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":224
 * 
 *     cdef bint isvalid(self):
 *         if self._valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 */
  __pyx_t_1 = ((__pyx_v_self->_valid_ctxt == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":225
 *     cdef bint isvalid(self):
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid             # <<<<<<<<<<<<<<
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":226
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 *         return xmlschema.xmlSchemaIsValid(self._valid_ctxt)             # <<<<<<<<<<<<<<
 */
  __pyx_r = xmlSchemaIsValid(__pyx_v_self->_valid_ctxt);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":223
 *                 self._valid_ctxt, NULL, NULL)
 * 
 *     cdef bint isvalid(self):             # <<<<<<<<<<<<<<
 *         if self._valid_ctxt is NULL:
 *             return 1 # valid
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":73
 *     cdef schematron.xmlSchematron* _c_schema
 *     cdef xmlDoc* _c_schema_doc
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 *         self._c_schema_doc = NULL
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10Schematron_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10Schematron_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_4lxml_5etree_10Schematron___cinit__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10Schematron___cinit__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":74
 *     cdef xmlDoc* _c_schema_doc
 *     def __cinit__(self):
 *         self._c_schema = NULL             # <<<<<<<<<<<<<<
 *         self._c_schema_doc = NULL
 * 
 */
  __pyx_v_self->_c_schema = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":75
 *     def __cinit__(self):
 *         self._c_schema = NULL
 *         self._c_schema_doc = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, etree=None, *, file=None):
 */
  __pyx_v_self->_c_schema_doc = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":73
 *     cdef schematron.xmlSchematron* _c_schema
 *     cdef xmlDoc* _c_schema_doc
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_schema = NULL
 *         self._c_schema_doc = NULL
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":77
 *         self._c_schema_doc = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

/* Python wrapper */
static int __pyx_pw_4lxml_5etree_10Schematron_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4lxml_5etree_10Schematron_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  PyObject *__pyx_v_file = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,&__pyx_n_s_file,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 1;
        PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_etree = values[0];
    __pyx_v_file = values[1];
  }
  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[23]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Schematron.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10Schematron_2__init__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self), __pyx_v_etree, __pyx_v_file);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4lxml_5etree_10Schematron_2__init__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree, PyObject *__pyx_v_file) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlSchematronParserCtxt *__pyx_v_parser_ctxt;
  PyObject *__pyx_v_filename = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  xmlDoc *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  char const *__pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":83
 *         cdef char* c_href
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt
 *         _Validator.__init__(self)             # <<<<<<<<<<<<<<
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__Validator)), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __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[23]; __pyx_lineno = 83; __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 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 83; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":84
 *         cdef schematron.xmlSchematronParserCtxt* parser_ctxt
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:             # <<<<<<<<<<<<<<
 *             raise SchematronError, \
 *                 u"lxml.etree was compiled without Schematron support."
 */
  __pyx_t_4 = ((!(ENABLE_SCHEMATRON != 0)) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":85
 *         _Validator.__init__(self)
 *         if not config.ENABLE_SCHEMATRON:
 *             raise SchematronError, \             # <<<<<<<<<<<<<<
 *                 u"lxml.etree was compiled without Schematron support."
 *         if etree is not None:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SchematronError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, __pyx_kp_u_lxml_etree_was_compiled_without, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":87
 *             raise SchematronError, \
 *                 u"lxml.etree was compiled without Schematron support."
 *         if etree is not None:             # <<<<<<<<<<<<<<
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 */
  __pyx_t_4 = (__pyx_v_etree != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":88
 *                 u"lxml.etree was compiled without Schematron support."
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":89
 *         if etree is not None:
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":90
 *             doc = _documentOrRaise(etree)
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:
 */
    __pyx_t_6 = __pyx_f_4lxml_5etree__copyDocRoot(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->_c_schema_doc = __pyx_t_6;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":91
 *             root_node = _rootNodeOrRaise(etree)
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)             # <<<<<<<<<<<<<<
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 */
    __pyx_v_parser_ctxt = xmlSchematronNewDocParserCtxt(__pyx_v_self->_c_schema_doc);
    goto __pyx_L4;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":92
 *             self._c_schema_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:             # <<<<<<<<<<<<<<
 *             filename = _getFilenameForFile(file)
 *             if filename is None:
 */
  __pyx_t_5 = (__pyx_v_file != Py_None);
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":93
 *             parser_ctxt = schematron.xmlSchematronNewDocParserCtxt(self._c_schema_doc)
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)             # <<<<<<<<<<<<<<
 *             if filename is None:
 *                 # XXX assume a string object
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__getFilenameForFile(__pyx_v_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_filename = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":94
 *         elif file is not None:
 *             filename = _getFilenameForFile(file)
 *             if filename is None:             # <<<<<<<<<<<<<<
 *                 # XXX assume a string object
 *                 filename = file
 */
    __pyx_t_4 = (__pyx_v_filename == Py_None);
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":96
 *             if filename is None:
 *                 # XXX assume a string object
 *                 filename = file             # <<<<<<<<<<<<<<
 *             filename = _encodeFilename(filename)
 *             with self._error_log:
 */
      __Pyx_INCREF(__pyx_v_file);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_v_file);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":97
 *                 # XXX assume a string object
 *                 filename = file
 *             filename = _encodeFilename(filename)             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 */
    __pyx_t_3 = __pyx_f_4lxml_5etree__encodeFilename(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":98
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *         else:
 */
    /*with:*/ {
      __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      /*try:*/ {
        {
          if (__pyx_t_9||__pyx_t_10||__pyx_t_11); else {/*mark used*/};
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":99
 *             filename = _encodeFilename(filename)
 *             with self._error_log:
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))             # <<<<<<<<<<<<<<
 *         else:
 *             raise SchematronParseError, u"No tree or file given"
 */
            __pyx_v_parser_ctxt = xmlSchematronNewParserCtxt(PyBytes_AS_STRING(__pyx_v_filename));
          }
        }
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":98
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *         else:
 */
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_7) {
            __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__103, NULL);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
      goto __pyx_L18;
      __pyx_L6_error:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L1_error;
      __pyx_L18:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":101
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *         else:
 *             raise SchematronParseError, u"No tree or file given"             # <<<<<<<<<<<<<<
 * 
 *         if parser_ctxt is NULL:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SchematronParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, __pyx_kp_u_No_tree_or_file_given, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":103
 *             raise SchematronParseError, u"No tree or file given"
 * 
 *         if parser_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 */
  __pyx_t_5 = ((__pyx_v_parser_ctxt == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":104
 * 
 *         if parser_ctxt is NULL:
 *             if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
 */
    __pyx_t_5 = ((__pyx_v_self->_c_schema_doc != NULL) != 0);
    if (__pyx_t_5) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":105
 *         if parser_ctxt is NULL:
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)             # <<<<<<<<<<<<<<
 *                 self._c_schema_doc = NULL
 *             raise MemoryError()
 */
      xmlFreeDoc(__pyx_v_self->_c_schema_doc);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":106
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
      __pyx_v_self->_c_schema_doc = NULL;
      goto __pyx_L20;
    }
    __pyx_L20:;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":107
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 *                 self._c_schema_doc = NULL
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[23]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":109
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             with self._error_log:
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":110
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *         finally:
 */
    /*with:*/ {
      __pyx_t_7 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
      /*try:*/ {
        {
          if (__pyx_t_11||__pyx_t_10||__pyx_t_9); else {/*mark used*/};
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":111
 *         try:
 *             with self._error_log:
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)             # <<<<<<<<<<<<<<
 *         finally:
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 */
            __pyx_v_self->_c_schema = xmlSchematronParse(__pyx_v_parser_ctxt);
          }
        }
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":110
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *         finally:
 */
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_7) {
            __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__104, NULL);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          goto __pyx_L27;
        }
        __pyx_L27:;
      }
      goto __pyx_L36;
      __pyx_L24_error:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L22_error;
      __pyx_L36:;
    }
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":113
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *         finally:
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if self._c_schema is NULL:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);
      goto __pyx_L23;
    }
    /*exception exit:*/{
      __pyx_L22_error:;
      __pyx_t_7 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_8 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
      {
        xmlSchematronFreeParserCtxt(__pyx_v_parser_ctxt);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_9, __pyx_t_10);
      __pyx_t_7 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
      goto __pyx_L1_error;
    }
    __pyx_L23:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":115
 *             schematron.xmlSchematronFreeParserCtxt(parser_ctxt)
 * 
 *         if self._c_schema is NULL:             # <<<<<<<<<<<<<<
 *             raise SchematronParseError(
 *                 u"Document is not a valid Schematron schema",
 */
  __pyx_t_5 = ((__pyx_v_self->_c_schema == NULL) != 0);
  if (__pyx_t_5) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":116
 * 
 *         if self._c_schema is NULL:
 *             raise SchematronParseError(             # <<<<<<<<<<<<<<
 *                 u"Document is not a valid Schematron schema",
 *                 self._error_log)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_SchematronParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":118
 *             raise SchematronParseError(
 *                 u"Document is not a valid Schematron schema",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_kp_u_Document_is_not_a_valid_Schematr);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Document_is_not_a_valid_Schematr);
    __Pyx_GIVEREF(__pyx_kp_u_Document_is_not_a_valid_Schematr);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":116
 * 
 *         if self._c_schema is NULL:
 *             raise SchematronParseError(             # <<<<<<<<<<<<<<
 *                 u"Document is not a valid Schematron schema",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":77
 *         self._c_schema_doc = NULL
 * 
 *     def __init__(self, etree=None, *, file=None):             # <<<<<<<<<<<<<<
 *         cdef _Document doc
 *         cdef _Element root_node
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("lxml.etree.Schematron.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":120
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if _LIBXML_VERSION_INT >= 20631:
 */

/* Python wrapper */
static void __pyx_pw_4lxml_5etree_10Schematron_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4lxml_5etree_10Schematron_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4lxml_5etree_10Schematron_4__dealloc__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4lxml_5etree_10Schematron_4__dealloc__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":121
 * 
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)             # <<<<<<<<<<<<<<
 *         if _LIBXML_VERSION_INT >= 20631:
 *             # earlier libxml2 versions may have freed the document in
 */
  xmlSchematronFree(__pyx_v_self->_c_schema);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":122
 *     def __dealloc__(self):
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if _LIBXML_VERSION_INT >= 20631:             # <<<<<<<<<<<<<<
 *             # earlier libxml2 versions may have freed the document in
 *             # xmlSchematronFree() already, we don't know ...
 */
  __pyx_t_1 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20631) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":125
 *             # earlier libxml2 versions may have freed the document in
 *             # xmlSchematronFree() already, we don't know ...
 *             if self._c_schema_doc is not NULL:             # <<<<<<<<<<<<<<
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->_c_schema_doc != NULL) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":126
 *             # xmlSchematronFree() already, we don't know ...
 *             if self._c_schema_doc is not NULL:
 *                 tree.xmlFreeDoc(self._c_schema_doc)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, etree):
 */
      xmlFreeDoc(__pyx_v_self->_c_schema_doc);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":120
 *                 self._error_log)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         schematron.xmlSchematronFree(self._c_schema)
 *         if _LIBXML_VERSION_INT >= 20631:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":128
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_10Schematron_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_10Schematron_6__call__[] = "__call__(self, etree)\n\n        Validate doc using Schematron.\n\n        Returns true if document is valid, false if not.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_4lxml_5etree_10Schematron_6__call__;
#endif
static PyObject *__pyx_pw_4lxml_5etree_10Schematron_7__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_etree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_etree,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_etree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_etree = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[23]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree.Schematron.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_10Schematron_6__call__(((struct __pyx_obj_4lxml_5etree_Schematron *)__pyx_v_self), __pyx_v_etree);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_10Schematron_6__call__(struct __pyx_obj_4lxml_5etree_Schematron *__pyx_v_self, PyObject *__pyx_v_etree) {
  struct LxmlDocument *__pyx_v_doc = 0;
  struct LxmlElement *__pyx_v_root_node = 0;
  xmlDoc *__pyx_v_c_doc;
  xmlSchematronValidCtxt *__pyx_v_valid_ctxt;
  int __pyx_v_ret;
  int __pyx_v_options;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  xmlDoc *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":141
 *         cdef int options
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"             # <<<<<<<<<<<<<<
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_self->_c_schema != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Schematron_instance_not_initiali);
      {__pyx_filename = __pyx_f[23]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":142
 * 
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)             # <<<<<<<<<<<<<<
 *         root_node = _rootNodeOrRaise(etree)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_doc = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":143
 *         assert self._c_schema is not NULL, "Schematron instance not initialised"
 *         doc = _documentOrRaise(etree)
 *         root_node = _rootNodeOrRaise(etree)             # <<<<<<<<<<<<<<
 * 
 *         if _LIBXML_VERSION_INT >= 20632 and \
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_etree)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_root_node = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":145
 *         root_node = _rootNodeOrRaise(etree)
 * 
 *         if _LIBXML_VERSION_INT >= 20632 and \             # <<<<<<<<<<<<<<
 *                 schematron.XML_SCHEMATRON_OUT_ERROR != 0:
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR
 */
  __pyx_t_2 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":146
 * 
 *         if _LIBXML_VERSION_INT >= 20632 and \
 *                 schematron.XML_SCHEMATRON_OUT_ERROR != 0:             # <<<<<<<<<<<<<<
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR
 *         else:
 */
    __pyx_t_3 = ((XML_SCHEMATRON_OUT_ERROR != 0) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":147
 *         if _LIBXML_VERSION_INT >= 20632 and \
 *                 schematron.XML_SCHEMATRON_OUT_ERROR != 0:
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR             # <<<<<<<<<<<<<<
 *         else:
 *             options = schematron.XML_SCHEMATRON_OUT_QUIET
 */
    __pyx_v_options = XML_SCHEMATRON_OUT_ERROR;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":149
 *             options = schematron.XML_SCHEMATRON_OUT_ERROR
 *         else:
 *             options = schematron.XML_SCHEMATRON_OUT_QUIET             # <<<<<<<<<<<<<<
 *             # hack to switch off stderr output
 *             options = options | schematron.XML_SCHEMATRON_OUT_XML
 */
    __pyx_v_options = XML_SCHEMATRON_OUT_QUIET;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":151
 *             options = schematron.XML_SCHEMATRON_OUT_QUIET
 *             # hack to switch off stderr output
 *             options = options | schematron.XML_SCHEMATRON_OUT_XML             # <<<<<<<<<<<<<<
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 */
    __pyx_v_options = (__pyx_v_options | XML_SCHEMATRON_OUT_XML);
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":153
 *             options = options | schematron.XML_SCHEMATRON_OUT_XML
 * 
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(             # <<<<<<<<<<<<<<
 *             self._c_schema, options)
 *         if valid_ctxt is NULL:
 */
  __pyx_v_valid_ctxt = xmlSchematronNewValidCtxt(__pyx_v_self->_c_schema, __pyx_v_options);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":155
 *         valid_ctxt = schematron.xmlSchematronNewValidCtxt(
 *             self._c_schema, options)
 *         if valid_ctxt is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 * 
 */
  __pyx_t_4 = ((__pyx_v_valid_ctxt == NULL) != 0);
  if (__pyx_t_4) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":156
 *             self._c_schema, options)
 *         if valid_ctxt is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[23]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":158
 *             raise MemoryError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if _LIBXML_VERSION_INT >= 20632:
 *                 self._error_log.clear()
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":159
 * 
 *         try:
 *             if _LIBXML_VERSION_INT >= 20632:             # <<<<<<<<<<<<<<
 *                 self._error_log.clear()
 *                 schematron.xmlSchematronSetValidStructuredErrors(
 */
    __pyx_t_4 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT >= 20632) != 0);
    if (__pyx_t_4) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":160
 *         try:
 *             if _LIBXML_VERSION_INT >= 20632:
 *                 self._error_log.clear()             # <<<<<<<<<<<<<<
 *                 schematron.xmlSchematronSetValidStructuredErrors(
 *                     valid_ctxt, _receiveError, <void*>self._error_log)
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ErrorLog *)__pyx_v_self->__pyx_base._error_log->__pyx_base.__pyx_base.__pyx_vtab)->clear(__pyx_v_self->__pyx_base._error_log, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":161
 *             if _LIBXML_VERSION_INT >= 20632:
 *                 self._error_log.clear()
 *                 schematron.xmlSchematronSetValidStructuredErrors(             # <<<<<<<<<<<<<<
 *                     valid_ctxt, _receiveError, <void*>self._error_log)
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
      xmlSchematronSetValidStructuredErrors(__pyx_v_valid_ctxt, __pyx_f_4lxml_5etree__receiveError, ((void *)__pyx_v_self->__pyx_base._error_log));

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":163
 *                 schematron.xmlSchematronSetValidStructuredErrors(
 *                     valid_ctxt, _receiveError, <void*>self._error_log)
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 */
      __pyx_t_5 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_v_c_doc = __pyx_t_5;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":164
 *                     valid_ctxt, _receiveError, <void*>self._error_log)
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 */
      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          #endif
          /*try:*/ {

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":165
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 with nogil:
 *                     ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *             else:
 */
            __pyx_v_ret = xmlSchematronValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
          }

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":164
 *                     valid_ctxt, _receiveError, <void*>self._error_log)
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
      }

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":166
 *                 with nogil:
 *                     ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *                 _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *             else:
 *                 ret = -1
 */
      __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":168
 *                 _destroyFakeDoc(doc._c_doc, c_doc)
 *             else:
 *                 ret = -1             # <<<<<<<<<<<<<<
 *                 with self._error_log:
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 */
      __pyx_v_ret = -1;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":169
 *             else:
 *                 ret = -1
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                     with nogil:
 */
      /*with:*/ {
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(((PyObject *)__pyx_v_self->__pyx_base._error_log), __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __pyx_f_4lxml_5etree_9_ErrorLog___enter__(__pyx_v_self->__pyx_base._error_log); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            /*try:*/ {

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":170
 *                 ret = -1
 *                 with self._error_log:
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)             # <<<<<<<<<<<<<<
 *                     with nogil:
 *                         ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 */
              __pyx_t_5 = __pyx_f_4lxml_5etree__fakeRootDoc(__pyx_v_doc->_c_doc, __pyx_v_root_node->_c_node); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __pyx_v_c_doc = __pyx_t_5;

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":171
 *                 with self._error_log:
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                     with nogil:             # <<<<<<<<<<<<<<
 *                         ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *                     _destroyFakeDoc(doc._c_doc, c_doc)
 */
              {
                  #ifdef WITH_THREAD
                  PyThreadState *_save;
                  Py_UNBLOCK_THREADS
                  #endif
                  /*try:*/ {

                    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":172
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                     with nogil:
 *                         ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)             # <<<<<<<<<<<<<<
 *                     _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 */
                    __pyx_v_ret = xmlSchematronValidateDoc(__pyx_v_valid_ctxt, __pyx_v_c_doc);
                  }

                  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":171
 *                 with self._error_log:
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                     with nogil:             # <<<<<<<<<<<<<<
 *                         ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *                     _destroyFakeDoc(doc._c_doc, c_doc)
 */
                  /*finally:*/ {
                    /*normal exit:*/{
                      #ifdef WITH_THREAD
                      Py_BLOCK_THREADS
                      #endif
                      goto __pyx_L28;
                    }
                    __pyx_L28:;
                  }
              }

              /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":173
 *                     with nogil:
 *                         ret = schematron.xmlSchematronValidateDoc(valid_ctxt, c_doc)
 *                     _destroyFakeDoc(doc._c_doc, c_doc)             # <<<<<<<<<<<<<<
 *         finally:
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 */
              __pyx_f_4lxml_5etree__destroyFakeDoc(__pyx_v_doc->_c_doc, __pyx_v_c_doc);
            }
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            goto __pyx_L23_try_end;
            __pyx_L16_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":169
 *             else:
 *                 ret = -1
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                     with nogil:
 */
            /*except:*/ {
              __Pyx_AddTraceback("lxml.etree.Schematron.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_11, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_13 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              if (__pyx_t_4 < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
              __pyx_t_2 = ((!(__pyx_t_4 != 0)) != 0);
              if (__pyx_t_2) {
                __Pyx_GIVEREF(__pyx_t_1);
                __Pyx_GIVEREF(__pyx_t_11);
                __Pyx_XGIVEREF(__pyx_t_12);
                __Pyx_ErrRestore(__pyx_t_1, __pyx_t_11, __pyx_t_12);
                __pyx_t_1 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; 
                {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
              }
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              goto __pyx_L17_exception_handled;
            }
            __pyx_L18_except_error:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            goto __pyx_L6_error;
            __pyx_L17_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
            __pyx_L23_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__105, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            goto __pyx_L15;
          }
          __pyx_L15:;
        }
        goto __pyx_L32;
        __pyx_L12_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L6_error;
        __pyx_L32:;
      }
    }
    __pyx_L8:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":175
 *                     _destroyFakeDoc(doc._c_doc, c_doc)
 *         finally:
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)             # <<<<<<<<<<<<<<
 * 
 *         if ret == -1:
 */
  /*finally:*/ {
    /*normal exit:*/{
      xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt);
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_14, &__pyx_t_17);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_17);
      __pyx_t_7 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
      {
        xmlSchematronFreeValidCtxt(__pyx_v_valid_ctxt);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_14, __pyx_t_17);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_10, __pyx_t_9);
      __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_14 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":177
 *             schematron.xmlSchematronFreeValidCtxt(valid_ctxt)
 * 
 *         if ret == -1:             # <<<<<<<<<<<<<<
 *             raise SchematronValidateError(
 *                 u"Internal error in Schematron validation",
 */
  __pyx_t_2 = ((__pyx_v_ret == -1) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":178
 * 
 *         if ret == -1:
 *             raise SchematronValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_SchematronValidateError); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":180
 *             raise SchematronValidateError(
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)             # <<<<<<<<<<<<<<
 *         if ret == 0:
 *             return True
 */
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_kp_u_Internal_error_in_Schematron_val);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_u_Internal_error_in_Schematron_val);
    __Pyx_GIVEREF(__pyx_kp_u_Internal_error_in_Schematron_val);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));
    PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_v_self->__pyx_base._error_log));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base._error_log));

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":178
 * 
 *         if ret == -1:
 *             raise SchematronValidateError(             # <<<<<<<<<<<<<<
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[23]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":181
 *                 u"Internal error in Schematron validation",
 *                 self._error_log)
 *         if ret == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_ret == 0) != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":182
 *                 self._error_log)
 *         if ret == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":184
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":128
 *                 tree.xmlFreeDoc(self._c_schema_doc)
 * 
 *     def __call__(self, etree):             # <<<<<<<<<<<<<<
 *         u"""__call__(self, etree)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("lxml.etree.Schematron.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_doc);
  __Pyx_XDECREF((PyObject *)__pyx_v_root_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     u"Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
 */

struct LxmlElement *deepcopyNodeToDocument(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_root) {
  xmlNode *__pyx_v_c_node;
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  xmlNode *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("deepcopyNodeToDocument", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":6
 *     u"Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
 *     c_node = _copyNodeToDoc(c_root, doc._c_doc)             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__copyNodeToDoc(__pyx_v_c_root, __pyx_v_doc->_c_doc); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_c_node = __pyx_t_1;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":7
 *     cdef xmlNode* c_node
 *     c_node = _copyNodeToDoc(c_root, doc._c_doc)
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":3
 * # Public C API for lxml.etree
 * 
 * cdef public api _Element deepcopyNodeToDocument(_Document doc, xmlNode* c_root):             # <<<<<<<<<<<<<<
 *     u"Recursively copy the element into the document. doc is not modified."
 *     cdef xmlNode* c_node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.deepcopyNodeToDocument", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":9
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):             # <<<<<<<<<<<<<<
 *     _assertValidNode(context_node)
 *     return newElementTree(context_node, _ElementTree)
 */

struct LxmlElementTree *elementTreeFactory(struct LxmlElement *__pyx_v_context_node) {
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elementTreeFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":10
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 *     _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     return newElementTree(context_node, _ElementTree)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":11
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):
 *     _assertValidNode(context_node)
 *     return newElementTree(context_node, _ElementTree)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)newElementTree(__pyx_v_context_node, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ElementTree)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":9
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _ElementTree elementTreeFactory(_Element context_node):             # <<<<<<<<<<<<<<
 *     _assertValidNode(context_node)
 *     return newElementTree(context_node, _ElementTree)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.elementTreeFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":13
 *     return newElementTree(context_node, _ElementTree)
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,             # <<<<<<<<<<<<<<
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:
 */

struct LxmlElementTree *newElementTree(struct LxmlElement *__pyx_v_context_node, PyObject *__pyx_v_subclass) {
  struct LxmlElementTree *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("newElementTree", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":15
 * cdef public api _ElementTree newElementTree(_Element context_node,
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     _assertValidNode(context_node)
 */
  __pyx_t_1 = ((((void *)__pyx_v_context_node) == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_context_node) == Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":16
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     _assertValidNode(context_node)
 *     return _newElementTree(context_node._doc, context_node, subclass)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":17
 *     if <void*>context_node is NULL or context_node is None:
 *         raise TypeError
 *     _assertValidNode(context_node)             # <<<<<<<<<<<<<<
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 */
  __pyx_t_4 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_context_node); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":18
 *         raise TypeError
 *     _assertValidNode(context_node)
 *     return _newElementTree(context_node._doc, context_node, subclass)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_5 = ((PyObject *)__pyx_v_context_node->_doc);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = ((PyObject *)__pyx_f_4lxml_5etree__newElementTree(((struct LxmlDocument *)__pyx_t_5), __pyx_v_context_node, __pyx_v_subclass)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = ((struct LxmlElementTree *)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":13
 *     return newElementTree(context_node, _ElementTree)
 * 
 * cdef public api _ElementTree newElementTree(_Element context_node,             # <<<<<<<<<<<<<<
 *                                             object subclass):
 *     if <void*>context_node is NULL or context_node is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("lxml.etree.newElementTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":20
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL or doc is None:
 *         raise TypeError
 */

struct LxmlElement *elementFactory(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("elementFactory", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":21
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return _elementFactory(doc, c_node)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_doc) == Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":22
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):
 *     if c_node is NULL or doc is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return _elementFactory(doc, c_node)
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":23
 *     if c_node is NULL or doc is None:
 *         raise TypeError
 *     return _elementFactory(doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_4 = ((PyObject *)__pyx_f_4lxml_5etree__elementFactory(__pyx_v_doc, __pyx_v_c_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = ((struct LxmlElement *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":20
 *     return _newElementTree(context_node._doc, context_node, subclass)
 * 
 * cdef public api _Element elementFactory(_Document doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL or doc is None:
 *         raise TypeError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("lxml.etree.elementFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":25
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,             # <<<<<<<<<<<<<<
 *                                      text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 */

struct LxmlElement *makeElement(PyObject *__pyx_v_tag, struct LxmlDocument *__pyx_v_doc, PyObject *__pyx_v_parser, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":27
 * cdef public api _Element makeElement(tag, _Document doc, parser,
 *                                      text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (!(likely(((__pyx_v_parser) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_parser, __pyx_ptype_4lxml_5etree__BaseParser))))) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__makeElement(__pyx_v_tag, NULL, __pyx_v_doc, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_v_parser), __pyx_v_text, __pyx_v_tail, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":25
 *     return _elementFactory(doc, c_node)
 * 
 * cdef public api _Element makeElement(tag, _Document doc, parser,             # <<<<<<<<<<<<<<
 *                                      text, tail, attrib, nsmap):
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.makeElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":29
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)
 */

struct LxmlElement *makeSubElement(struct LxmlElement *__pyx_v_parent, PyObject *__pyx_v_tag, PyObject *__pyx_v_text, PyObject *__pyx_v_tail, PyObject *__pyx_v_attrib, PyObject *__pyx_v_nsmap) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("makeSubElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":31
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)             # <<<<<<<<<<<<<<
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_parent); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":32
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void setElementClassLookupFunction(
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = ((PyObject *)__pyx_f_4lxml_5etree__makeSubElement(__pyx_v_parent, __pyx_v_tag, __pyx_v_text, __pyx_v_tail, __pyx_v_attrib, __pyx_v_nsmap, ((PyObject*)Py_None))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct LxmlElement *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":29
 *     return _makeElement(tag, NULL, doc, parser, text, tail, attrib, nsmap, None)
 * 
 * cdef public api _Element makeSubElement(_Element parent, tag, text, tail,             # <<<<<<<<<<<<<<
 *                                         attrib, nsmap):
 *     _assertValidNode(parent)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.makeSubElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":34
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
 * cdef public api void setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)
 */

void setElementClassLookupFunction(_element_class_lookup_function __pyx_v_function, PyObject *__pyx_v_state) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setElementClassLookupFunction", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":36
 * cdef public api void setElementClassLookupFunction(
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):
 */
  __pyx_f_4lxml_5etree__setElementClassLookupFunction(__pyx_v_function, __pyx_v_state);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":34
 *     return _makeSubElement(parent, tag, text, tail, attrib, nsmap, None)
 * 
 * cdef public api void setElementClassLookupFunction(             # <<<<<<<<<<<<<<
 *     _element_class_lookup_function function, state):
 *     _setElementClassLookupFunction(function, state)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":38
 *     _setElementClassLookupFunction(function, state)
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 */

PyObject *lookupDefaultElementClass(PyObject *__pyx_v_state, PyObject *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookupDefaultElementClass", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":39
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):
 *     return _lookupDefaultElementClass(state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_f_4lxml_5etree__lookupDefaultElementClass(__pyx_v_state, ((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":38
 *     _setElementClassLookupFunction(function, state)
 * 
 * cdef public api object lookupDefaultElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.lookupDefaultElementClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":41
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _find_nselement_class(state, doc, c_node)
 * 
 */

PyObject *lookupNamespaceElementClass(PyObject *__pyx_v_state, PyObject *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookupNamespaceElementClass", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":42
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):
 *     return _find_nselement_class(state, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_ptype_4lxml_5etree__Document))))) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_f_4lxml_5etree__find_nselement_class(__pyx_v_state, ((struct LxmlDocument *)__pyx_v_doc), __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":41
 *     return _lookupDefaultElementClass(state, doc, c_node)
 * 
 * cdef public api object lookupNamespaceElementClass(state, doc, xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _find_nselement_class(state, doc, c_node)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.lookupNamespaceElementClass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":44
 *     return _find_nselement_class(state, doc, c_node)
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                           _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)
 */

PyObject *callLookupFallback(struct LxmlFallbackElementClassLookup *__pyx_v_lookup, struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("callLookupFallback", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":46
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,
 *                                           _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__callLookupFallback(__pyx_v_lookup, __pyx_v_doc, __pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":44
 *     return _find_nselement_class(state, doc, c_node)
 * 
 * cdef public api object callLookupFallback(FallbackElementClassLookup lookup,             # <<<<<<<<<<<<<<
 *                                           _Document doc, xmlNode* c_node):
 *     return _callLookupFallback(lookup, doc, c_node)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.callLookupFallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":48
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return -1
 */

int tagMatches(xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("tagMatches", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":49
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":50
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):
 *     if c_node is NULL:
 *         return -1             # <<<<<<<<<<<<<<
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 */
    __pyx_r = -1;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":51
 *     if c_node is NULL:
 *         return -1
 *     return _tagMatches(c_node, c_href, c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Document documentOrRaise(object input):
 */
  __pyx_r = __pyx_f_4lxml_5etree__tagMatches(__pyx_v_c_node, __pyx_v_c_href, __pyx_v_c_name);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":48
 *     return _callLookupFallback(lookup, doc, c_node)
 * 
 * cdef public api int tagMatches(xmlNode* c_node, const_xmlChar* c_href, const_xmlChar* c_name):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return -1
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":53
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 * cdef public api _Document documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _documentOrRaise(input)
 * 
 */

struct LxmlDocument *documentOrRaise(PyObject *__pyx_v_input) {
  struct LxmlDocument *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("documentOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":54
 * 
 * cdef public api _Document documentOrRaise(object input):
 *     return _documentOrRaise(input)             # <<<<<<<<<<<<<<
 * 
 * cdef public api _Element rootNodeOrRaise(object input):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__documentOrRaise(__pyx_v_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlDocument *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":53
 *     return _tagMatches(c_node, c_href, c_name)
 * 
 * cdef public api _Document documentOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _documentOrRaise(input)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.documentOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":56
 *     return _documentOrRaise(input)
 * 
 * cdef public api _Element rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _rootNodeOrRaise(input)
 * 
 */

struct LxmlElement *rootNodeOrRaise(PyObject *__pyx_v_input) {
  struct LxmlElement *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rootNodeOrRaise", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":57
 * 
 * cdef public api _Element rootNodeOrRaise(object input):
 *     return _rootNodeOrRaise(input)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasText(xmlNode* c_node):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_4lxml_5etree__rootNodeOrRaise(__pyx_v_input)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct LxmlElement *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":56
 *     return _documentOrRaise(input)
 * 
 * cdef public api _Element rootNodeOrRaise(object input):             # <<<<<<<<<<<<<<
 *     return _rootNodeOrRaise(input)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.rootNodeOrRaise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":59
 *     return _rootNodeOrRaise(input)
 * 
 * cdef public api bint hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasText(c_node)
 * 
 */

int hasText(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":60
 * 
 * cdef public api bint hasText(xmlNode* c_node):
 *     return _hasText(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasTail(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasText(__pyx_v_c_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":59
 *     return _rootNodeOrRaise(input)
 * 
 * cdef public api bint hasText(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasText(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":62
 *     return _hasText(c_node)
 * 
 * cdef public api bint hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasTail(c_node)
 * 
 */

int hasTail(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasTail", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":63
 * 
 * cdef public api bint hasTail(xmlNode* c_node):
 *     return _hasTail(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object textOf(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasTail(__pyx_v_c_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":62
 *     return _hasText(c_node)
 * 
 * cdef public api bint hasTail(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasTail(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":65
 *     return _hasTail(c_node)
 * 
 * cdef public api object textOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */

PyObject *textOf(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("textOf", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":66
 * 
 * cdef public api object textOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.children)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":67
 * cdef public api object textOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.children)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":68
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.children)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object tailOf(xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_node->children); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":65
 *     return _hasTail(c_node)
 * 
 * cdef public api object textOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.textOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":70
 *     return _collectText(c_node.children)
 * 
 * cdef public api object tailOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */

PyObject *tailOf(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tailOf", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":71
 * 
 * cdef public api object tailOf(xmlNode* c_node):
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return _collectText(c_node.next)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":72
 * cdef public api object tailOf(xmlNode* c_node):
 *     if c_node is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return _collectText(c_node.next)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":73
 *     if c_node is NULL:
 *         return None
 *     return _collectText(c_node.next)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__collectText(__pyx_v_c_node->next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":70
 *     return _collectText(c_node.children)
 * 
 * cdef public api object tailOf(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.tailOf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":75
 *     return _collectText(c_node.next)
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
 */

int setNodeText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_text) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setNodeText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":76
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setNodeText(c_node, text)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":77
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     return _setNodeText(c_node, text)
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":78
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setNodeText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__setNodeText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":75
 *     return _collectText(c_node.next)
 * 
 * cdef public api int setNodeText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setNodeText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":80
 *     return _setNodeText(c_node, text)
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
 */

int setTailText(xmlNode *__pyx_v_c_node, PyObject *__pyx_v_text) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setTailText", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":81
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError
 *     return _setTailText(c_node, text)
 */
  __pyx_t_1 = ((__pyx_v_c_node == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":82
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:
 *     if c_node is NULL:
 *         raise ValueError             # <<<<<<<<<<<<<<
 *     return _setTailText(c_node, text)
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":83
 *     if c_node is NULL:
 *         raise ValueError
 *     return _setTailText(c_node, text)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 */
  __pyx_t_2 = __pyx_f_4lxml_5etree__setTailText(__pyx_v_c_node, __pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":80
 *     return _setNodeText(c_node, text)
 * 
 * cdef public api int setTailText(xmlNode* c_node, text) except -1:             # <<<<<<<<<<<<<<
 *     if c_node is NULL:
 *         raise ValueError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setTailText", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":85
 *     return _setTailText(c_node, text)
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 */

PyObject *attributeValue(xmlNode *__pyx_v_c_element, xmlAttr *__pyx_v_c_attrib_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributeValue", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":86
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):
 *     return _attributeValue(c_element, c_attrib_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValue(__pyx_v_c_element, __pyx_v_c_attrib_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":85
 *     return _setTailText(c_node, text)
 * 
 * cdef public api object attributeValue(xmlNode* c_element, xmlAttr* c_attrib_node):             # <<<<<<<<<<<<<<
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.attributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":88
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                                 const_xmlChar* ns, const_xmlChar* name):
 *     return _attributeValueFromNsName(c_element, ns, name)
 */

PyObject *attributeValueFromNsName(xmlNode *__pyx_v_c_element, const xmlChar *__pyx_v_ns, const xmlChar *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("attributeValueFromNsName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":90
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,
 *                                                 const_xmlChar* ns, const_xmlChar* name):
 *     return _attributeValueFromNsName(c_element, ns, name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__attributeValueFromNsName(__pyx_v_c_element, __pyx_v_ns, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":88
 *     return _attributeValue(c_element, c_attrib_node)
 * 
 * cdef public api object attributeValueFromNsName(xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                                 const_xmlChar* ns, const_xmlChar* name):
 *     return _attributeValueFromNsName(c_element, ns, name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.attributeValueFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":92
 *     return _attributeValueFromNsName(c_element, ns, name)
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _getAttributeValue(element, key, default)
 */

PyObject *getAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getAttributeValue", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":93
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _getAttributeValue(element, key, default)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":94
 * cdef public api object getAttributeValue(_Element element, key, default):
 *     _assertValidNode(element)
 *     return _getAttributeValue(element, key, default)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__getAttributeValue(__pyx_v_element, __pyx_v_key, __pyx_v_default); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":92
 *     return _attributeValueFromNsName(c_element, ns, name)
 * 
 * cdef public api object getAttributeValue(_Element element, key, default):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _getAttributeValue(element, key, default)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.getAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":96
 *     return _getAttributeValue(element, key, default)
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _attributeIteratorFactory(element, keysvalues)
 */

PyObject *iterattributes(struct LxmlElement *__pyx_v_element, int __pyx_v_keysvalues) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterattributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":97
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":98
 * cdef public api object iterattributes(_Element element, int keysvalues):
 *     _assertValidNode(element)
 *     return _attributeIteratorFactory(element, keysvalues)             # <<<<<<<<<<<<<<
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree__attributeIteratorFactory(__pyx_v_element, __pyx_v_keysvalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":96
 *     return _getAttributeValue(element, key, default)
 * 
 * cdef public api object iterattributes(_Element element, int keysvalues):             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _attributeIteratorFactory(element, keysvalues)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.iterattributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":100
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):             # <<<<<<<<<<<<<<
 *     return _collectAttributes(c_element, keysvalues)
 * 
 */

PyObject *collectAttributes(xmlNode *__pyx_v_c_element, int __pyx_v_keysvalues) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("collectAttributes", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":101
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):
 *     return _collectAttributes(c_element, keysvalues)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__collectAttributes(__pyx_v_c_element, __pyx_v_keysvalues); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 101; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":100
 *     return _attributeIteratorFactory(element, keysvalues)
 * 
 * cdef public api list collectAttributes(xmlNode* c_element, int keysvalues):             # <<<<<<<<<<<<<<
 *     return _collectAttributes(c_element, keysvalues)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.collectAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":103
 *     return _collectAttributes(c_element, keysvalues)
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _setAttributeValue(element, key, value)
 */

int setAttributeValue(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setAttributeValue", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":104
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _setAttributeValue(element, key, value)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":105
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:
 *     _assertValidNode(element)
 *     return _setAttributeValue(element, key, value)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__setAttributeValue(__pyx_v_element, __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":103
 *     return _collectAttributes(c_element, keysvalues)
 * 
 * cdef public api int setAttributeValue(_Element element, key, value) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _setAttributeValue(element, key, value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.setAttributeValue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":107
 *     return _setAttributeValue(element, key, value)
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _delAttribute(element, key)
 */

int delAttribute(struct LxmlElement *__pyx_v_element, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("delAttribute", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":108
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:
 *     _assertValidNode(element)             # <<<<<<<<<<<<<<
 *     return _delAttribute(element, key)
 * 
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__assertValidNode(__pyx_v_element); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":109
 * cdef public api int delAttribute(_Element element, key) except -1:
 *     _assertValidNode(element)
 *     return _delAttribute(element, key)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__delAttribute(__pyx_v_element, __pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":107
 *     return _setAttributeValue(element, key, value)
 * 
 * cdef public api int delAttribute(_Element element, key) except -1:             # <<<<<<<<<<<<<<
 *     _assertValidNode(element)
 *     return _delAttribute(element, key)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.delAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":111
 *     return _delAttribute(element, key)
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                            const_xmlChar* c_href, const_xmlChar* c_name):
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 */

int delAttributeFromNsName(xmlNode *__pyx_v_c_element, const xmlChar *__pyx_v_c_href, const xmlChar *__pyx_v_c_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("delAttributeFromNsName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":113
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,
 *                                            const_xmlChar* c_href, const_xmlChar* c_name):
 *     return _delAttributeFromNsName(c_element, c_href, c_name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bint hasChild(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__delAttributeFromNsName(__pyx_v_c_element, __pyx_v_c_href, __pyx_v_c_name);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":111
 *     return _delAttribute(element, key)
 * 
 * cdef public api int delAttributeFromNsName(tree.xmlNode* c_element,             # <<<<<<<<<<<<<<
 *                                            const_xmlChar* c_href, const_xmlChar* c_name):
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":115
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 * 
 * cdef public api bint hasChild(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasChild(c_node)
 * 
 */

int hasChild(xmlNode *__pyx_v_c_node) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hasChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":116
 * 
 * cdef public api bint hasChild(xmlNode* c_node):
 *     return _hasChild(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = __pyx_f_4lxml_5etree__hasChild(__pyx_v_c_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":115
 *     return _delAttributeFromNsName(c_element, c_href, c_name)
 * 
 * cdef public api bint hasChild(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _hasChild(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":118
 *     return _hasChild(c_node)
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChild(c_node, index)
 * 
 */

xmlNode *findChild(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":119
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):
 *     return _findChild(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = __pyx_f_4lxml_5etree__findChild(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":118
 *     return _hasChild(c_node)
 * 
 * cdef public api xmlNode* findChild(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChild(c_node, index)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":121
 *     return _findChild(c_node, index)
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChildForwards(c_node, index)
 * 
 */

xmlNode *findChildForwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findChildForwards", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":122
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):
 *     return _findChildForwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):
 */
  __pyx_r = __pyx_f_4lxml_5etree__findChildForwards(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":121
 *     return _findChild(c_node, index)
 * 
 * cdef public api xmlNode* findChildForwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChildForwards(c_node, index)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":124
 *     return _findChildForwards(c_node, index)
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChildBackwards(c_node, index)
 * 
 */

xmlNode *findChildBackwards(xmlNode *__pyx_v_c_node, Py_ssize_t __pyx_v_index) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findChildBackwards", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":125
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):
 *     return _findChildBackwards(c_node, index)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__findChildBackwards(__pyx_v_c_node, __pyx_v_index);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":124
 *     return _findChildForwards(c_node, index)
 * 
 * cdef public api xmlNode* findChildBackwards(xmlNode* c_node, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *     return _findChildBackwards(c_node, index)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":127
 *     return _findChildBackwards(c_node, index)
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _nextElement(c_node)
 * 
 */

xmlNode *nextElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nextElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":128
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):
 *     return _nextElement(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):
 */
  __pyx_r = __pyx_f_4lxml_5etree__nextElement(__pyx_v_c_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":127
 *     return _findChildBackwards(c_node, index)
 * 
 * cdef public api xmlNode* nextElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _nextElement(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":130
 *     return _nextElement(c_node)
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _previousElement(c_node)
 * 
 */

xmlNode *previousElement(xmlNode *__pyx_v_c_node) {
  xmlNode *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("previousElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":131
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):
 *     return _previousElement(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void appendChild(_Element parent, _Element child):
 */
  __pyx_r = __pyx_f_4lxml_5etree__previousElement(__pyx_v_c_node);
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":130
 *     return _nextElement(c_node)
 * 
 * cdef public api xmlNode* previousElement(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _previousElement(c_node)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":133
 *     return _previousElement(c_node)
 * 
 * cdef public api void appendChild(_Element parent, _Element child):             # <<<<<<<<<<<<<<
 *     # deprecated, use appendChildToElement() instead!
 *     _appendChild(parent, child)
 */

void appendChild(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("appendChild", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":135
 * cdef public api void appendChild(_Element parent, _Element child):
 *     # deprecated, use appendChildToElement() instead!
 *     _appendChild(parent, child)             # <<<<<<<<<<<<<<
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_child); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":133
 *     return _previousElement(c_node)
 * 
 * cdef public api void appendChild(_Element parent, _Element child):             # <<<<<<<<<<<<<<
 *     # deprecated, use appendChildToElement() instead!
 *     _appendChild(parent, child)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("lxml.etree.appendChild", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":137
 *     _appendChild(parent, child)
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     return _appendChild(parent, child)
 * 
 */

int appendChildToElement(struct LxmlElement *__pyx_v_parent, struct LxmlElement *__pyx_v_child) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("appendChildToElement", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":138
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:
 *     return _appendChild(parent, child)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object pyunicode(const_xmlChar* s):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree__appendChild(__pyx_v_parent, __pyx_v_child); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":137
 *     _appendChild(parent, child)
 * 
 * cdef public api int appendChildToElement(_Element parent, _Element child) except -1:             # <<<<<<<<<<<<<<
 *     return _appendChild(parent, child)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.appendChildToElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":140
 *     return _appendChild(parent, child)
 * 
 * cdef public api object pyunicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     if s is NULL:
 *         raise TypeError
 */

PyObject *pyunicode(const xmlChar *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pyunicode", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":141
 * 
 * cdef public api object pyunicode(const_xmlChar* s):
 *     if s is NULL:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return funicode(s)
 */
  __pyx_t_1 = ((__pyx_v_s == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":142
 * cdef public api object pyunicode(const_xmlChar* s):
 *     if s is NULL:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return funicode(s)
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":143
 *     if s is NULL:
 *         raise TypeError
 *     return funicode(s)             # <<<<<<<<<<<<<<
 * 
 * cdef public api bytes utf8(object s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_4lxml_5etree_funicode(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":140
 *     return _appendChild(parent, child)
 * 
 * cdef public api object pyunicode(const_xmlChar* s):             # <<<<<<<<<<<<<<
 *     if s is NULL:
 *         raise TypeError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree.pyunicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":145
 *     return funicode(s)
 * 
 * cdef public api bytes utf8(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s)
 * 
 */

PyObject *utf8(PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("utf8", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":146
 * 
 * cdef public api bytes utf8(object s):
 *     return _utf8(s)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tuple getNsTag(object tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__utf8(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 146; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":145
 *     return funicode(s)
 * 
 * cdef public api bytes utf8(object s):             # <<<<<<<<<<<<<<
 *     return _utf8(s)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.utf8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":148
 *     return _utf8(s)
 * 
 * cdef public api tuple getNsTag(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTag(tag)
 * 
 */

PyObject *getNsTag(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getNsTag", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":149
 * 
 * cdef public api tuple getNsTag(object tag):
 *     return _getNsTag(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 149; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":148
 *     return _utf8(s)
 * 
 * cdef public api tuple getNsTag(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTag(tag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":151
 *     return _getNsTag(tag)
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTagWithEmptyNs(tag)
 * 
 */

PyObject *getNsTagWithEmptyNs(PyObject *__pyx_v_tag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getNsTagWithEmptyNs", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":152
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):
 *     return _getNsTagWithEmptyNs(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object namespacedName(xmlNode* c_node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__getNsTagWithEmptyNs(__pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 152; __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;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":151
 *     return _getNsTag(tag)
 * 
 * cdef public api tuple getNsTagWithEmptyNs(object tag):             # <<<<<<<<<<<<<<
 *     return _getNsTagWithEmptyNs(tag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.getNsTagWithEmptyNs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":154
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api object namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedName(c_node)
 * 
 */

PyObject *namespacedName(xmlNode *__pyx_v_c_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("namespacedName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":155
 * 
 * cdef public api object namespacedName(xmlNode* c_node):
 *     return _namespacedName(c_node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api object namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedName(__pyx_v_c_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":154
 *     return _getNsTagWithEmptyNs(tag)
 * 
 * cdef public api object namespacedName(xmlNode* c_node):             # <<<<<<<<<<<<<<
 *     return _namespacedName(c_node)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.namespacedName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":157
 *     return _namespacedName(c_node)
 * 
 * cdef public api object namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(href, name)
 * 
 */

PyObject *namespacedNameFromNsName(const xmlChar *__pyx_v_href, const xmlChar *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("namespacedNameFromNsName", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":158
 * 
 * cdef public api object namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):
 *     return _namespacedNameFromNsName(href, name)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4lxml_5etree__namespacedNameFromNsName(__pyx_v_href, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":157
 *     return _namespacedName(c_node)
 * 
 * cdef public api object namespacedNameFromNsName(const_xmlChar* href, const_xmlChar* name):             # <<<<<<<<<<<<<<
 *     return _namespacedNameFromNsName(href, name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree.namespacedNameFromNsName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":160
 *     return _namespacedNameFromNsName(href, name)
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     iterator._storeNext(node)
 */

void iteratorStoreNext(struct LxmlElementIterator *__pyx_v_iterator, struct LxmlElement *__pyx_v_node) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteratorStoreNext", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":162
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):
 *     # deprecated!
 *     iterator._storeNext(node)             # <<<<<<<<<<<<<<
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):
 */
  ((struct __pyx_vtabstruct_4lxml_5etree__ElementIterator *)__pyx_v_iterator->__pyx_base.__pyx_vtab)->_storeNext(__pyx_v_iterator, __pyx_v_node);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":160
 *     return _namespacedNameFromNsName(href, name)
 * 
 * cdef public api void iteratorStoreNext(_ElementIterator iterator, _Element node):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     iterator._storeNext(node)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":164
 *     iterator._storeNext(node)
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     matcher._initTagMatch(tag)
 */

void initTagMatch(struct LxmlElementTagMatcher *__pyx_v_matcher, PyObject *__pyx_v_tag) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initTagMatch", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":166
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):
 *     # deprecated!
 *     matcher._initTagMatch(tag)             # <<<<<<<<<<<<<<
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *)__pyx_v_matcher->__pyx_vtab)->_initTagMatch(__pyx_v_matcher, __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":164
 *     iterator._storeNext(node)
 * 
 * cdef public api void initTagMatch(_ElementTagMatcher matcher, tag):             # <<<<<<<<<<<<<<
 *     # deprecated!
 *     matcher._initTagMatch(tag)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("lxml.etree.initTagMatch", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":168
 *     matcher._initTagMatch(tag)
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(             # <<<<<<<<<<<<<<
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:
 */

xmlNs *findOrBuildNodeNsPrefix(struct LxmlDocument *__pyx_v_doc, xmlNode *__pyx_v_c_node, const xmlChar *__pyx_v_href, const xmlChar *__pyx_v_prefix) {
  xmlNs *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  xmlNs *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("findOrBuildNodeNsPrefix", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":170
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:             # <<<<<<<<<<<<<<
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_doc) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":171
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:
 *         raise TypeError             # <<<<<<<<<<<<<<
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)
 */
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    {__pyx_filename = __pyx_f[24]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":172
 *     if doc is None:
 *         raise TypeError
 *     return doc._findOrBuildNodeNs(c_node, href, prefix, 0)             # <<<<<<<<<<<<<<
 */
  __pyx_t_3 = __pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs(__pyx_v_doc, __pyx_v_c_node, __pyx_v_href, __pyx_v_prefix, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[24]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/public-api.pxi":168
 *     matcher._initTagMatch(tag)
 * 
 * cdef public api tree.xmlNs* findOrBuildNodeNsPrefix(             # <<<<<<<<<<<<<<
 *         _Document doc, xmlNode* c_node, const_xmlChar* href, const_xmlChar* prefix) except NULL:
 *     if doc is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("lxml.etree.findOrBuildNodeNsPrefix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":7
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_9_MemDebug_bytes_used[] = "bytes_used(self)\n\n        Returns the total amount of memory (in bytes) currently used by libxml2.\n        Note that libxml2 constrains this value to a C int, which limits\n        the accuracy on 64 bit systems.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bytes_used (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_bytes_used(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_bytes_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bytes_used", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":14
 *         the accuracy on 64 bit systems.
 *         """
 *         return tree.xmlMemUsed()             # <<<<<<<<<<<<<<
 * 
 *     def blocks_used(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(xmlMemUsed()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":7
 *     """Debugging support for the memory allocation in libxml2.
 *     """
 *     def bytes_used(self):             # <<<<<<<<<<<<<<
 *         """bytes_used(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._MemDebug.bytes_used", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":16
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used[] = "blocks_used(self)\n\n        Returns the total number of memory blocks currently allocated by libxml2.\n        Note that libxml2 constrains this value to a C int, which limits\n        the accuracy on 64 bit systems.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blocks_used (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_2blocks_used(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_2blocks_used(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blocks_used", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":23
 *         the accuracy on 64 bit systems.
 *         """
 *         return tree.xmlMemBlocks()             # <<<<<<<<<<<<<<
 * 
 *     def dict_size(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(xmlMemBlocks()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":16
 *         return tree.xmlMemUsed()
 * 
 *     def blocks_used(self):             # <<<<<<<<<<<<<<
 *         """blocks_used(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("lxml.etree._MemDebug.blocks_used", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":25
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4lxml_5etree_9_MemDebug_4dict_size[] = "dict_size(self)\n\n        Returns the current size of the global name dictionary used by libxml2\n        for the current thread.  Each thread has its own dictionary.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dict_size (wrapper)", 0);
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_4dict_size(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_4dict_size(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self) {
  xmlDict *__pyx_v_c_dict;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dict_size", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":31
 *         for the current thread.  Each thread has its own dictionary.
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)             # <<<<<<<<<<<<<<
 *         if c_dict is NULL:
 *             raise MemoryError()
 */
  __pyx_v_c_dict = __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, NULL);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":32
 *         """
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)
 */
  __pyx_t_1 = ((__pyx_v_c_dict == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":33
 *         c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
 *         if c_dict is NULL:
 *             raise MemoryError()             # <<<<<<<<<<<<<<
 *         return tree.xmlDictSize(c_dict)
 * 
 */
    PyErr_NoMemory(); {__pyx_filename = __pyx_f[25]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":34
 *         if c_dict is NULL:
 *             raise MemoryError()
 *         return tree.xmlDictSize(c_dict)             # <<<<<<<<<<<<<<
 * 
 *     def dump(self, output_file=None, byte_count=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(xmlDictSize(__pyx_v_c_dict)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":25
 *         return tree.xmlMemBlocks()
 * 
 *     def dict_size(self):             # <<<<<<<<<<<<<<
 *         """dict_size(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("lxml.etree._MemDebug.dict_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":36
 *         return tree.xmlDictSize(c_dict)
 * 
 *     def dump(self, output_file=None, byte_count=None):             # <<<<<<<<<<<<<<
 *         """dump(self, output_file=None, byte_count=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_7dump(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9_MemDebug_6dump[] = "dump(self, output_file=None, byte_count=None)\n\n        Dumps the current memory blocks allocated by libxml2 to a file.\n\n        The optional parameter 'output_file' specifies the file path.  It defaults\n        to the file \".memorylist\" in the current directory.\n\n        The optional parameter 'byte_count' limits the number of bytes in the dump.\n        Note that this parameter is ignored when lxml is compiled against a libxml2\n        version before 2.7.0.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_7dump(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_output_file = 0;
  PyObject *__pyx_v_byte_count = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dump (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_file,&__pyx_n_s_byte_count,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output_file);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_byte_count);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dump") < 0)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_output_file = values[0];
    __pyx_v_byte_count = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dump", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[25]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._MemDebug.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_6dump(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self), __pyx_v_output_file, __pyx_v_byte_count);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_6dump(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_byte_count) {
  Py_ssize_t __pyx_v_c_count;
  FILE *__pyx_v_f;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char const *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dump", 0);
  __Pyx_INCREF(__pyx_v_output_file);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":49
 *         """
 *         cdef Py_ssize_t c_count
 *         if output_file is None:             # <<<<<<<<<<<<<<
 *             output_file = b'.memorylist'
 *         elif isinstance(output_file, unicode):
 */
  __pyx_t_1 = (__pyx_v_output_file == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":50
 *         cdef Py_ssize_t c_count
 *         if output_file is None:
 *             output_file = b'.memorylist'             # <<<<<<<<<<<<<<
 *         elif isinstance(output_file, unicode):
 *             output_file.encode(sys.getfilesystemencoding())
 */
    __Pyx_INCREF(__pyx_kp_b_memorylist);
    __Pyx_DECREF_SET(__pyx_v_output_file, __pyx_kp_b_memorylist);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":51
 *         if output_file is None:
 *             output_file = b'.memorylist'
 *         elif isinstance(output_file, unicode):             # <<<<<<<<<<<<<<
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 */
  __pyx_t_2 = PyUnicode_Check(__pyx_v_output_file); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":52
 *             output_file = b'.memorylist'
 *         elif isinstance(output_file, unicode):
 *             output_file.encode(sys.getfilesystemencoding())             # <<<<<<<<<<<<<<
 * 
 *         f = stdio.fopen(output_file, "w")
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":54
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 *         f = stdio.fopen(output_file, "w")             # <<<<<<<<<<<<<<
 *         if f is NULL:
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 */
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_output_file); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_f = fopen(__pyx_t_6, __pyx_k_w);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":55
 * 
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 *         try:
 */
  __pyx_t_1 = ((__pyx_v_f == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":56
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))             # <<<<<<<<<<<<<<
 *         try:
 *             if tree.LIBXML_VERSION < 20700:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_decode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_create_file_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __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(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __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 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[25]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":57
 *         if f is NULL:
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 *         try:             # <<<<<<<<<<<<<<
 *             if tree.LIBXML_VERSION < 20700:
 *                 tree.xmlMemDisplay(f)
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":58
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 *         try:
 *             if tree.LIBXML_VERSION < 20700:             # <<<<<<<<<<<<<<
 *                 tree.xmlMemDisplay(f)
 *             elif byte_count is None:
 */
    __pyx_t_1 = ((LIBXML_VERSION < 20700) != 0);
    if (__pyx_t_1) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":59
 *         try:
 *             if tree.LIBXML_VERSION < 20700:
 *                 tree.xmlMemDisplay(f)             # <<<<<<<<<<<<<<
 *             elif byte_count is None:
 *                 tree.xmlMemDisplay(f)
 */
      xmlMemDisplay(__pyx_v_f);
      goto __pyx_L8;
    }

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":60
 *             if tree.LIBXML_VERSION < 20700:
 *                 tree.xmlMemDisplay(f)
 *             elif byte_count is None:             # <<<<<<<<<<<<<<
 *                 tree.xmlMemDisplay(f)
 *             else:
 */
    __pyx_t_1 = (__pyx_v_byte_count == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":61
 *                 tree.xmlMemDisplay(f)
 *             elif byte_count is None:
 *                 tree.xmlMemDisplay(f)             # <<<<<<<<<<<<<<
 *             else:
 *                 c_count = byte_count
 */
      xmlMemDisplay(__pyx_v_f);
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":63
 *                 tree.xmlMemDisplay(f)
 *             else:
 *                 c_count = byte_count             # <<<<<<<<<<<<<<
 *                 tree.xmlMemDisplayLast(f, c_count)
 *         finally:
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_byte_count); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_v_c_count = __pyx_t_7;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":64
 *             else:
 *                 c_count = byte_count
 *                 tree.xmlMemDisplayLast(f, c_count)             # <<<<<<<<<<<<<<
 *         finally:
 *             stdio.fclose(f)
 */
      xmlMemDisplayLast(__pyx_v_f, __pyx_v_c_count);
    }
    __pyx_L8:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":66
 *                 tree.xmlMemDisplayLast(f, c_count)
 *         finally:
 *             stdio.fclose(f)             # <<<<<<<<<<<<<<
 * 
 *     def show(self, output_file=None, block_count=None):
 */
  /*finally:*/ {
    /*normal exit:*/{
      fclose(__pyx_v_f);
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        fclose(__pyx_v_f);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":36
 *         return tree.xmlDictSize(c_dict)
 * 
 *     def dump(self, output_file=None, byte_count=None):             # <<<<<<<<<<<<<<
 *         """dump(self, output_file=None, byte_count=None)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._MemDebug.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_file);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":68
 *             stdio.fclose(f)
 * 
 *     def show(self, output_file=None, block_count=None):             # <<<<<<<<<<<<<<
 *         """show(self, output_file=None, block_count=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_9show(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4lxml_5etree_9_MemDebug_8show[] = "show(self, output_file=None, block_count=None)\n\n        Dumps the current memory blocks allocated by libxml2 to a file.\n        The output file format is suitable for line diffing.\n\n        The optional parameter 'output_file' specifies the file path.  It defaults\n        to the file \".memorydump\" in the current directory.\n\n        The optional parameter 'block_count' limits the number of blocks\n        in the dump.\n        ";
static PyObject *__pyx_pw_4lxml_5etree_9_MemDebug_9show(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_output_file = 0;
  PyObject *__pyx_v_block_count = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("show (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_file,&__pyx_n_s_block_count,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output_file);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_block_count);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "show") < 0)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_output_file = values[0];
    __pyx_v_block_count = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("show", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[25]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("lxml.etree._MemDebug.show", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4lxml_5etree_9_MemDebug_8show(((struct __pyx_obj_4lxml_5etree__MemDebug *)__pyx_v_self), __pyx_v_output_file, __pyx_v_block_count);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4lxml_5etree_9_MemDebug_8show(CYTHON_UNUSED struct __pyx_obj_4lxml_5etree__MemDebug *__pyx_v_self, PyObject *__pyx_v_output_file, PyObject *__pyx_v_block_count) {
  FILE *__pyx_v_f;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char const *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("show", 0);
  __Pyx_INCREF(__pyx_v_output_file);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":80
 *         in the dump.
 *         """
 *         if output_file is None:             # <<<<<<<<<<<<<<
 *             output_file = b'.memorydump'
 *         elif isinstance(output_file, unicode):
 */
  __pyx_t_1 = (__pyx_v_output_file == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":81
 *         """
 *         if output_file is None:
 *             output_file = b'.memorydump'             # <<<<<<<<<<<<<<
 *         elif isinstance(output_file, unicode):
 *             output_file.encode(sys.getfilesystemencoding())
 */
    __Pyx_INCREF(__pyx_kp_b_memorydump);
    __Pyx_DECREF_SET(__pyx_v_output_file, __pyx_kp_b_memorydump);
    goto __pyx_L3;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":82
 *         if output_file is None:
 *             output_file = b'.memorydump'
 *         elif isinstance(output_file, unicode):             # <<<<<<<<<<<<<<
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 */
  __pyx_t_2 = PyUnicode_Check(__pyx_v_output_file); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":83
 *             output_file = b'.memorydump'
 *         elif isinstance(output_file, unicode):
 *             output_file.encode(sys.getfilesystemencoding())             # <<<<<<<<<<<<<<
 * 
 *         f = stdio.fopen(output_file, "w")
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":85
 *             output_file.encode(sys.getfilesystemencoding())
 * 
 *         f = stdio.fopen(output_file, "w")             # <<<<<<<<<<<<<<
 *         if f is NULL:
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 */
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_output_file); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_f = fopen(__pyx_t_6, __pyx_k_w);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":86
 * 
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:             # <<<<<<<<<<<<<<
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 *         try:
 */
  __pyx_t_1 = ((__pyx_v_f == NULL) != 0);
  if (__pyx_t_1) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":87
 *         f = stdio.fopen(output_file, "w")
 *         if f is NULL:
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))             # <<<<<<<<<<<<<<
 *         try:
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_decode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_create_file_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __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(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __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 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[25]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":88
 *         if f is NULL:
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 *         try:             # <<<<<<<<<<<<<<
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())
 *         finally:
 */
  /*try:*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":89
 *             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
 *         try:
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())             # <<<<<<<<<<<<<<
 *         finally:
 *             stdio.fclose(f)
 */
    __pyx_t_1 = (__pyx_v_block_count != Py_None);
    if ((__pyx_t_1 != 0)) {
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_block_count); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_t_7 = __pyx_t_8;
    } else {
      __pyx_t_7 = xmlMemBlocks();
    }
    xmlMemShow(__pyx_v_f, __pyx_t_7);
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":91
 *             tree.xmlMemShow(f, block_count if block_count is not None else tree.xmlMemBlocks())
 *         finally:
 *             stdio.fclose(f)             # <<<<<<<<<<<<<<
 * 
 * memory_debugger = _MemDebug()
 */
  /*finally:*/ {
    /*normal exit:*/{
      fclose(__pyx_v_f);
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __pyx_L6_error:;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        fclose(__pyx_v_f);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":68
 *             stdio.fclose(f)
 * 
 *     def show(self, output_file=None, block_count=None):             # <<<<<<<<<<<<<<
 *         """show(self, output_file=None, block_count=None)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("lxml.etree._MemDebug.show", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output_file);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_4lxml_5etree__TempStore __pyx_vtable_4lxml_5etree__TempStore;

static PyObject *__pyx_tp_new_4lxml_5etree__TempStore(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__TempStore *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__TempStore *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__TempStore;
  p->_storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__TempStore(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_storage);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__TempStore(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  if (p->_storage) {
    e = (*v)(p->_storage, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__TempStore(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TempStore *p = (struct __pyx_obj_4lxml_5etree__TempStore *)o;
  Py_CLEAR(p->_storage);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__TempStore[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__TempStore = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._TempStore"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__TempStore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__TempStore, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TempStore, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__TempStore, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__TempStore, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_10_TempStore_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__TempStore, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext __pyx_vtable_4lxml_5etree__ExceptionContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ExceptionContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ExceptionContext;
  p->_exc_info = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ExceptionContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_exc_info);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ExceptionContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  if (p->_exc_info) {
    e = (*v)(p->_exc_info, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ExceptionContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExceptionContext *p = (struct __pyx_obj_4lxml_5etree__ExceptionContext *)o;
  Py_CLEAR(p->_exc_info);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree__ExceptionContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ExceptionContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ExceptionContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ExceptionContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ExceptionContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ExceptionContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ExceptionContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Document __pyx_vtable_4lxml_5etree__Document;

static struct LxmlDocument *__pyx_freelist_4lxml_5etree__Document[8];
static int __pyx_freecount_4lxml_5etree__Document = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__Document(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlDocument *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__Document > 0) & (t->tp_basicsize == sizeof(struct LxmlDocument)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__Document[--__pyx_freecount_4lxml_5etree__Document];
    memset(o, 0, sizeof(struct LxmlDocument));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct LxmlDocument *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__Document;
  p->_prefix_tail = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Document(PyObject *o) {
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_9_Document_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_prefix_tail);
  Py_CLEAR(p->_parser);
  if ((__pyx_freecount_4lxml_5etree__Document < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct LxmlDocument))) {
    __pyx_freelist_4lxml_5etree__Document[__pyx_freecount_4lxml_5etree__Document++] = ((struct LxmlDocument *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__Document(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Document(PyObject *o) {
  struct LxmlDocument *p = (struct LxmlDocument *)o;
  Py_CLEAR(p->_parser);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__Document[] = {
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) LxmlDocumentType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Document"), /*tp_name*/
  sizeof(struct LxmlDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Document, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Internal base class to reference a libxml document.\n\n    When instances of this class are garbage collected, the libxml\n    document is cleaned up.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Document, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Document, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Document, /*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_4lxml_5etree__Document, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__Element(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlElement *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElement *)o);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_tag = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Element(PyObject *o) {
  struct LxmlElement *p = (struct LxmlElement *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_8_Element_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_tag);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__Element(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElement *p = (struct LxmlElement *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_tag) {
    e = (*v)(p->_tag, a); if (e) return e;
  }
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__Element(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_4lxml_5etree__Element(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_5__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_4lxml_5etree_8_Element_7__delitem__(o, i);
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_3tag_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_tag(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_3tag_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_6attrib_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_tail(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_4tail_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_tail(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_4tail_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_sourceline(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_10sourceline_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_sourceline(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_10sourceline_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_nsmap(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_5nsmap_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Element_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Element_4base_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_8_Element_base(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_8_Element_4base_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__Element[] = {
  {__Pyx_NAMESTR("_init"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_1_init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element__init)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_9__deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_8__deepcopy__)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_11__copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_10__copy__)},
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_13set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_12set)},
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_15append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_14append)},
  {__Pyx_NAMESTR("addnext"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_17addnext, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_16addnext)},
  {__Pyx_NAMESTR("addprevious"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_19addprevious, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_18addprevious)},
  {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_21extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_20extend)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_23clear, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_22clear)},
  {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_25insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_24insert)},
  {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_27remove, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_26remove)},
  {__Pyx_NAMESTR("replace"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_29replace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_28replace)},
  {__Pyx_NAMESTR("__reversed__"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_43__reversed__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_42__reversed__)},
  {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_45index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_44index)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_47get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_46get)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_49keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_48keys)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_51values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_50values)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_53items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_52items)},
  {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_55getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_54getchildren)},
  {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_57getparent, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_56getparent)},
  {__Pyx_NAMESTR("getnext"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_59getnext, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_58getnext)},
  {__Pyx_NAMESTR("getprevious"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_61getprevious, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_60getprevious)},
  {__Pyx_NAMESTR("itersiblings"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_63itersiblings, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_62itersiblings)},
  {__Pyx_NAMESTR("iterancestors"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_65iterancestors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_64iterancestors)},
  {__Pyx_NAMESTR("iterdescendants"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_67iterdescendants, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_66iterdescendants)},
  {__Pyx_NAMESTR("iterchildren"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_69iterchildren, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_68iterchildren)},
  {__Pyx_NAMESTR("getroottree"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_71getroottree, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_70getroottree)},
  {__Pyx_NAMESTR("getiterator"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_73getiterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_72getiterator)},
  {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_75iter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_74iter)},
  {__Pyx_NAMESTR("itertext"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_77itertext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_76itertext)},
  {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_79makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_78makeelement)},
  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_81find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_80find)},
  {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_83findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_82findtext)},
  {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_85findall, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_84findall)},
  {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_87iterfind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_86iterfind)},
  {__Pyx_NAMESTR("xpath"), (PyCFunction)__pyx_pw_4lxml_5etree_8_Element_89xpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8_Element_88xpath)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Element[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_8_Element_tag, __pyx_setprop_4lxml_5etree_8_Element_tag, __Pyx_DOCSTR(__pyx_k_Element_tag), 0},
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_8_Element_attrib, 0, __Pyx_DOCSTR(__pyx_k_Element_attribute_dictionary_Whe), 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_8_Element_text, __pyx_setprop_4lxml_5etree_8_Element_text, __Pyx_DOCSTR(__pyx_k_Text_before_the_first_subelement), 0},
  {(char *)"tail", __pyx_getprop_4lxml_5etree_8_Element_tail, __pyx_setprop_4lxml_5etree_8_Element_tail, __Pyx_DOCSTR(__pyx_k_Text_after_this_element_s_end_ta), 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_8_Element_prefix, 0, __Pyx_DOCSTR(__pyx_k_Namespace_prefix_or_None), 0},
  {(char *)"sourceline", __pyx_getprop_4lxml_5etree_8_Element_sourceline, __pyx_setprop_4lxml_5etree_8_Element_sourceline, __Pyx_DOCSTR(__pyx_k_Original_line_number_as_found_by), 0},
  {(char *)"nsmap", __pyx_getprop_4lxml_5etree_8_Element_nsmap, 0, __Pyx_DOCSTR(__pyx_k_Namespace_prefix_URI_mapping_kno), 0},
  {(char *)"base", __pyx_getprop_4lxml_5etree_8_Element_base, __pyx_setprop_4lxml_5etree_8_Element_base, __Pyx_DOCSTR(__pyx_k_The_base_URI_of_the_Element_xml), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Element = {
  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*/
  __pyx_pw_4lxml_5etree_8_Element_37__nonzero__, /*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__Element = {
  __pyx_pw_4lxml_5etree_8_Element_35__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__Element, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_8_Element_39__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Element = {
  __pyx_pw_4lxml_5etree_8_Element_35__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_8_Element_33__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__Element, /*mp_ass_subscript*/
};

DL_EXPORT(PyTypeObject) LxmlElementType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Element"), /*tp_name*/
  sizeof(struct LxmlElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_8_Element_31__repr__, /*tp_repr*/
  &__pyx_tp_as_number__Element, /*tp_as_number*/
  &__pyx_tp_as_sequence__Element, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Element, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Element class.\n\n    References a document object and a libxml node.\n\n    By pointing to a Document instance, a reference is kept to\n    _Document as long as there is some pointer to a node in it.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Element, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Element, /*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_4lxml_5etree__Element, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseParser __pyx_vtable_4lxml_5etree__BaseParser;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseParser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseParser *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseParser;
  p->_class_lookup = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  p->_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  p->_push_parser_context = ((struct __pyx_obj_4lxml_5etree__ParserContext *)Py_None); Py_INCREF(Py_None);
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  p->_filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->target = Py_None; Py_INCREF(Py_None);
  p->_default_encoding = Py_None; Py_INCREF(Py_None);
  p->_events_to_collect = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseParser(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_class_lookup);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_parser_context);
  Py_CLEAR(p->_push_parser_context);
  Py_CLEAR(p->_schema);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->target);
  Py_CLEAR(p->_default_encoding);
  Py_CLEAR(p->_events_to_collect);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__BaseParser(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  if (p->_class_lookup) {
    e = (*v)(((PyObject*)p->_class_lookup), a); if (e) return e;
  }
  if (p->_resolvers) {
    e = (*v)(((PyObject*)p->_resolvers), a); if (e) return e;
  }
  if (p->_parser_context) {
    e = (*v)(((PyObject*)p->_parser_context), a); if (e) return e;
  }
  if (p->_push_parser_context) {
    e = (*v)(((PyObject*)p->_push_parser_context), a); if (e) return e;
  }
  if (p->_schema) {
    e = (*v)(((PyObject*)p->_schema), a); if (e) return e;
  }
  if (p->target) {
    e = (*v)(p->target, a); if (e) return e;
  }
  if (p->_default_encoding) {
    e = (*v)(p->_default_encoding, a); if (e) return e;
  }
  if (p->_events_to_collect) {
    e = (*v)(p->_events_to_collect, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseParser(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseParser *p = (struct __pyx_obj_4lxml_5etree__BaseParser *)o;
  Py_CLEAR(p->_class_lookup);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_parser_context);
  Py_CLEAR(p->_push_parser_context);
  Py_CLEAR(p->_schema);
  Py_CLEAR(p->target);
  Py_CLEAR(p->_default_encoding);
  Py_CLEAR(p->_events_to_collect);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_9error_log_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_resolvers(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_9resolvers_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_7version_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_11_BaseParser_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_BaseParser_6target_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseParser[] = {
  {__Pyx_NAMESTR("setElementClassLookup"), (PyCFunction)__pyx_pw_4lxml_5etree_11_BaseParser_3setElementClassLookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_2setElementClassLookup)},
  {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pw_4lxml_5etree_11_BaseParser_5set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_4set_element_class_lookup)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_11_BaseParser_7copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_6copy)},
  {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pw_4lxml_5etree_11_BaseParser_9makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_BaseParser_8makeelement)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseParser[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_11_BaseParser_error_log, 0, __Pyx_DOCSTR(__pyx_k_The_error_log_of_the_last_parser), 0},
  {(char *)"resolvers", __pyx_getprop_4lxml_5etree_11_BaseParser_resolvers, 0, __Pyx_DOCSTR(__pyx_k_The_custom_resolver_registry_of), 0},
  {(char *)"version", __pyx_getprop_4lxml_5etree_11_BaseParser_version, 0, __Pyx_DOCSTR(__pyx_k_The_version_of_the_underlying_XM), 0},
  {(char *)"target", __pyx_getprop_4lxml_5etree_11_BaseParser_target, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__BaseParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._BaseParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_11_BaseParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_QName(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_QName *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_QName *)o);
  p->text = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->localname = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->namespace = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_QName(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_QName *p = (struct __pyx_obj_4lxml_5etree_QName *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  Py_CLEAR(p->text);
  Py_CLEAR(p->localname);
  Py_CLEAR(p->namespace);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5QName_4text_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_localname(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5QName_9localname_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5QName_namespace(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5QName_9namespace_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_QName[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_QName[] = {
  {(char *)"text", __pyx_getprop_4lxml_5etree_5QName_text, 0, 0, 0},
  {(char *)"localname", __pyx_getprop_4lxml_5etree_5QName_localname, 0, 0, 0},
  {(char *)"namespace", __pyx_getprop_4lxml_5etree_5QName_namespace, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_QName = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.QName"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_QName), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_QName, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_4lxml_5etree_5QName_5__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_4lxml_5etree_5QName_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("QName(text_or_uri_or_element, tag=None)\n\n    QName wrapper for qualified XML names.\n\n    Pass a tag name by itself or a namespace URI and a tag name to\n    create a qualified name.  Alternatively, pass an Element to\n    extract its tag name.\n\n    The ``text`` property holds the qualified name in\n    ``{namespace}tagname`` notation.  The ``namespace`` and\n    ``localname`` properties hold the respective parts of the tag\n    name.\n\n    You can pass QName objects wherever a tag name is expected.  Also,\n    setting Element text from a QName will resolve the namespace\n    prefix and set a qualified text value.  This is helpful in XML\n    languages like SOAP or XML-Schema that use prefixed tag names in\n    their text content.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_4lxml_5etree_5QName_7__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_QName, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_QName, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_5QName_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_QName, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__LogEntry __pyx_vtable_4lxml_5etree__LogEntry;

static struct __pyx_obj_4lxml_5etree__LogEntry *__pyx_freelist_4lxml_5etree__LogEntry[16];
static int __pyx_freecount_4lxml_5etree__LogEntry = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__LogEntry(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__LogEntry > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__LogEntry)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__LogEntry[--__pyx_freecount_4lxml_5etree__LogEntry];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__LogEntry));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__LogEntry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__LogEntry;
  p->_message = Py_None; Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__LogEntry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_9_LogEntry_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_message);
  Py_CLEAR(p->_filename);
  if ((__pyx_freecount_4lxml_5etree__LogEntry < 16) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__LogEntry))) {
    __pyx_freelist_4lxml_5etree__LogEntry[__pyx_freecount_4lxml_5etree__LogEntry++] = ((struct __pyx_obj_4lxml_5etree__LogEntry *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__LogEntry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  if (p->_message) {
    e = (*v)(p->_message, a); if (e) return e;
  }
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__LogEntry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__LogEntry *p = (struct __pyx_obj_4lxml_5etree__LogEntry *)o;
  Py_CLEAR(p->_message);
  Py_CLEAR(p->_filename);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_domain_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_11domain_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_type_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_9type_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_level_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_10level_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_message(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_7message_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_filename(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_8filename_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_domain(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_6domain_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_level(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_5level_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_line(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_4line_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9_LogEntry_column(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9_LogEntry_6column_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__LogEntry[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__LogEntry[] = {
  {(char *)"domain_name", __pyx_getprop_4lxml_5etree_9_LogEntry_domain_name, 0, __Pyx_DOCSTR(__pyx_k_The_name_of_the_error_domain_See), 0},
  {(char *)"type_name", __pyx_getprop_4lxml_5etree_9_LogEntry_type_name, 0, __Pyx_DOCSTR(__pyx_k_The_name_of_the_error_type_See_l), 0},
  {(char *)"level_name", __pyx_getprop_4lxml_5etree_9_LogEntry_level_name, 0, __Pyx_DOCSTR(__pyx_k_The_name_of_the_error_level_See), 0},
  {(char *)"message", __pyx_getprop_4lxml_5etree_9_LogEntry_message, 0, 0, 0},
  {(char *)"filename", __pyx_getprop_4lxml_5etree_9_LogEntry_filename, 0, 0, 0},
  {(char *)"domain", __pyx_getprop_4lxml_5etree_9_LogEntry_domain, 0, 0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_9_LogEntry_type, 0, 0, 0},
  {(char *)"level", __pyx_getprop_4lxml_5etree_9_LogEntry_level, 0, 0, 0},
  {(char *)"line", __pyx_getprop_4lxml_5etree_9_LogEntry_line, 0, 0, 0},
  {(char *)"column", __pyx_getprop_4lxml_5etree_9_LogEntry_column, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__LogEntry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._LogEntry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__LogEntry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__LogEntry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_9_LogEntry_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A log message entry from an error log.\n\n    Attributes:\n\n    - message: the message text\n    - domain: the domain ID (see lxml.etree.ErrorDomains)\n    - type: the message type ID (see lxml.etree.ErrorTypes)\n    - level: the log level ID (see lxml.etree.ErrorLevels)\n    - line: the line at which the message originated (if applicable)\n    - column: the character column at which the message originated (if applicable)\n    - filename: the name of the file in which the message originated (if applicable)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__LogEntry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__LogEntry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__LogEntry, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__LogEntry, /*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_4lxml_5etree__LogEntry, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog __pyx_vtable_4lxml_5etree__BaseErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseErrorLog(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  p->_first_error = ((struct __pyx_obj_4lxml_5etree__LogEntry *)Py_None); Py_INCREF(Py_None);
  p->last_error = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_first_error);
  Py_CLEAR(p->last_error);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  if (p->_first_error) {
    e = (*v)(((PyObject*)p->_first_error), a); if (e) return e;
  }
  if (p->last_error) {
    e = (*v)(p->last_error, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseErrorLog *p = (struct __pyx_obj_4lxml_5etree__BaseErrorLog *)o;
  Py_CLEAR(p->_first_error);
  Py_CLEAR(p->last_error);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_13_BaseErrorLog_last_error(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_13_BaseErrorLog_10last_error_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseErrorLog[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_13_BaseErrorLog_3copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pw_4lxml_5etree_13_BaseErrorLog_7receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseErrorLog[] = {
  {(char *)"last_error", __pyx_getprop_4lxml_5etree_13_BaseErrorLog_last_error, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__BaseErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._BaseErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseErrorLog, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseErrorLog, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_13_BaseErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseErrorLog, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ListErrorLog __pyx_vtable_4lxml_5etree__ListErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__ListErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ListErrorLog *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__ListErrorLog;
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ListErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_entries);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ListErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(o, v, a); if (e) return e;
  if (p->_entries) {
    e = (*v)(p->_entries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ListErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ListErrorLog *p = (struct __pyx_obj_4lxml_5etree__ListErrorLog *)o;
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog(o);
  Py_CLEAR(p->_entries);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__ListErrorLog(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 PyMethodDef __pyx_methods_4lxml_5etree__ListErrorLog[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_3copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_2copy)},
  {__Pyx_NAMESTR("filter_domains"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_17filter_domains, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_16filter_domains)},
  {__Pyx_NAMESTR("filter_types"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_19filter_types, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_18filter_types)},
  {__Pyx_NAMESTR("filter_levels"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_21filter_levels, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_20filter_levels)},
  {__Pyx_NAMESTR("filter_from_level"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_23filter_from_level, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_22filter_from_level)},
  {__Pyx_NAMESTR("filter_from_fatals"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_25filter_from_fatals, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_24filter_from_fatals)},
  {__Pyx_NAMESTR("filter_from_errors"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_27filter_from_errors, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_26filter_from_errors)},
  {__Pyx_NAMESTR("filter_from_warnings"), (PyCFunction)__pyx_pw_4lxml_5etree_13_ListErrorLog_29filter_from_warnings, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13_ListErrorLog_28filter_from_warnings)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ListErrorLog = {
  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*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_15__nonzero__, /*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__ListErrorLog = {
  __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__ListErrorLog, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_13__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__ListErrorLog = {
  __pyx_pw_4lxml_5etree_13_ListErrorLog_11__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_9__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__ListErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ListErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ListErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ListErrorLog, /*tp_as_number*/
  &__pyx_tp_as_sequence__ListErrorLog, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ListErrorLog, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Immutable base version of a list based error log."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ListErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ListErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_5__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ListErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_13_ListErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ListErrorLog, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLogContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ErrorLogContext(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLogContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ErrorLogContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLogContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLogContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  __Pyx_DOCSTR("\n    Error log context for the 'with' statement.\n    Stores a reference to the current callbacks to allow for\n    recursively stacked log contexts.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ErrorLogContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ErrorLog __pyx_vtable_4lxml_5etree__ErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__ErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ListErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__ErrorLog;
  p->_logContexts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_9_ErrorLog_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p = (struct __pyx_obj_4lxml_5etree__ErrorLog *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_logContexts);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ListErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ErrorLog *p = (struct __pyx_obj_4lxml_5etree__ErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ListErrorLog(o, v, a); if (e) return e;
  if (p->_logContexts) {
    e = (*v)(p->_logContexts, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ErrorLog *p = (struct __pyx_obj_4lxml_5etree__ErrorLog *)o;
  __pyx_tp_clear_4lxml_5etree__ListErrorLog(o);
  Py_CLEAR(p->_logContexts);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ErrorLog[] = {
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_5__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_7clear, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_9copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_ErrorLog_8copy)},
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pw_4lxml_5etree_9_ErrorLog_13receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_9_ErrorLog_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ErrorLog, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__DomainErrorLog __pyx_vtable_4lxml_5etree__DomainErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__DomainErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DomainErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__DomainErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__DomainErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__DomainErrorLog[] = {
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pw_4lxml_5etree_15_DomainErrorLog_3receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__DomainErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._DomainErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DomainErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DomainErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_15_DomainErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__DomainErrorLog, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__RotatingErrorLog __pyx_vtable_4lxml_5etree__RotatingErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree__RotatingErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__RotatingErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__RotatingErrorLog *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree__RotatingErrorLog;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__RotatingErrorLog[] = {
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pw_4lxml_5etree_17_RotatingErrorLog_3receive, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__RotatingErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._RotatingErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__RotatingErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_13_ListErrorLog_7__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_9_ErrorLog_11__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__RotatingErrorLog, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_17_RotatingErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__RotatingErrorLog, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_PyErrorLog __pyx_vtable_4lxml_5etree_PyErrorLog;

static PyObject *__pyx_tp_new_4lxml_5etree_PyErrorLog(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseErrorLog(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PyErrorLog *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseErrorLog*)__pyx_vtabptr_4lxml_5etree_PyErrorLog;
  p->level_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_map_level = Py_None; Py_INCREF(Py_None);
  p->_log = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_PyErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->level_map);
  Py_CLEAR(p->_map_level);
  Py_CLEAR(p->_log);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseErrorLog(o);
}

static int __pyx_tp_traverse_4lxml_5etree_PyErrorLog(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseErrorLog(o, v, a); if (e) return e;
  if (p->level_map) {
    e = (*v)(p->level_map, a); if (e) return e;
  }
  if (p->_map_level) {
    e = (*v)(p->_map_level, a); if (e) return e;
  }
  if (p->_log) {
    e = (*v)(p->_log, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_PyErrorLog(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_PyErrorLog *p = (struct __pyx_obj_4lxml_5etree_PyErrorLog *)o;
  __pyx_tp_clear_4lxml_5etree__BaseErrorLog(o);
  Py_CLEAR(p->level_map);
  Py_CLEAR(p->_map_level);
  Py_CLEAR(p->_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_10PyErrorLog_level_map(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_10PyErrorLog_9level_map_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_PyErrorLog[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_10PyErrorLog_3copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_2copy)},
  {__Pyx_NAMESTR("log"), (PyCFunction)__pyx_pw_4lxml_5etree_10PyErrorLog_5log, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_4log)},
  {__Pyx_NAMESTR("receive"), (PyCFunction)__pyx_pw_4lxml_5etree_10PyErrorLog_7receive, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10PyErrorLog_6receive)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_PyErrorLog[] = {
  {(char *)"level_map", __pyx_getprop_4lxml_5etree_10PyErrorLog_level_map, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_PyErrorLog = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.PyErrorLog"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PyErrorLog), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_PyErrorLog, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_13_BaseErrorLog_5__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("PyErrorLog(self, logger_name=None, logger=None)\n    A global error log that connects to the Python stdlib logging package.\n\n    The constructor accepts an optional logger name or a readily\n    instantiated logger instance.\n\n    If you want to change the mapping between libxml2's ErrorLevels and Python\n    logging levels, you can modify the level_map dictionary from a subclass.\n\n    The default mapping is::\n\n            ErrorLevels.WARNING = logging.WARNING\n            ErrorLevels.ERROR   = logging.ERROR\n            ErrorLevels.FATAL   = logging.CRITICAL\n\n    You can also override the method ``receive()`` that takes a LogEntry\n    object and calls ``self.log(log_entry, format_string, arg1, arg2, ...)``\n    with appropriate data.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_PyErrorLog, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_PyErrorLog, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PyErrorLog, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_PyErrorLog, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_10PyErrorLog_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PyErrorLog, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_DocInfo(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_DocInfo *)o);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7DocInfo_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_DocInfo(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_DocInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_DocInfo(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_DocInfo *p = (struct __pyx_obj_4lxml_5etree_DocInfo *)o;
  Py_CLEAR(p->_doc);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_root_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_9root_name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_public_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_9public_id_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_system_url(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_10system_url_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_xml_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_11xml_version_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_encoding(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_8encoding_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_standalone(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_10standalone_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_URL(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_3URL_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_7DocInfo_URL(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7DocInfo_3URL_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_doctype(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_7doctype_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_internalDTD(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_11internalDTD_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7DocInfo_externalDTD(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7DocInfo_11externalDTD_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_DocInfo[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DocInfo[] = {
  {(char *)"root_name", __pyx_getprop_4lxml_5etree_7DocInfo_root_name, 0, __Pyx_DOCSTR(__pyx_k_Returns_the_name_of_the_root_nod), 0},
  {(char *)"public_id", __pyx_getprop_4lxml_5etree_7DocInfo_public_id, 0, __Pyx_DOCSTR(__pyx_k_Returns_the_public_ID_of_the_DOC), 0},
  {(char *)"system_url", __pyx_getprop_4lxml_5etree_7DocInfo_system_url, 0, __Pyx_DOCSTR(__pyx_k_Returns_the_system_ID_of_the_DOC), 0},
  {(char *)"xml_version", __pyx_getprop_4lxml_5etree_7DocInfo_xml_version, 0, __Pyx_DOCSTR(__pyx_k_Returns_the_XML_version_as_decla), 0},
  {(char *)"encoding", __pyx_getprop_4lxml_5etree_7DocInfo_encoding, 0, __Pyx_DOCSTR(__pyx_k_Returns_the_encoding_name_as_dec), 0},
  {(char *)"standalone", __pyx_getprop_4lxml_5etree_7DocInfo_standalone, 0, __Pyx_DOCSTR(__pyx_k_Returns_the_standalone_flag_as_d), 0},
  {(char *)"URL", __pyx_getprop_4lxml_5etree_7DocInfo_URL, __pyx_setprop_4lxml_5etree_7DocInfo_URL, __Pyx_DOCSTR(__pyx_k_The_source_URL_of_the_document_o), 0},
  {(char *)"doctype", __pyx_getprop_4lxml_5etree_7DocInfo_doctype, 0, __Pyx_DOCSTR(__pyx_k_Returns_a_DOCTYPE_declaration_st), 0},
  {(char *)"internalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_internalDTD, 0, __Pyx_DOCSTR(__pyx_k_Returns_a_DTD_validator_based_on), 0},
  {(char *)"externalDTD", __pyx_getprop_4lxml_5etree_7DocInfo_externalDTD, 0, __Pyx_DOCSTR(__pyx_k_Returns_a_DTD_validator_based_on_2), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_DocInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.DocInfo"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DocInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_DocInfo, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Document information provided by parser and DTD."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_DocInfo, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_DocInfo, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_DocInfo, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_DocInfo, /*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_4lxml_5etree_DocInfo, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement __pyx_vtable_4lxml_5etree___ContentOnlyElement;

static PyObject *__pyx_tp_new_4lxml_5etree___ContentOnlyElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree___ContentOnlyElement *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree___ContentOnlyElement *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  return o;
}
static PyObject *__pyx_sq_item_4lxml_5etree___ContentOnlyElement(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_4lxml_5etree___ContentOnlyElement(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_7__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_4lxml_5etree__Element->tp_as_mapping && __pyx_ptype_4lxml_5etree__Element->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_4lxml_5etree__Element->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_20__ContentOnlyElement_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_6attrib_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_20__ContentOnlyElement_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree___ContentOnlyElement[] = {
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_1set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_set)},
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_3append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_2append)},
  {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_5insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_4insert)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_13get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_12get)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_15keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_14keys)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_17items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_16items)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pw_4lxml_5etree_20__ContentOnlyElement_19values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_20__ContentOnlyElement_18values)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree___ContentOnlyElement[] = {
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_attrib, 0, 0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_20__ContentOnlyElement_text, __pyx_setprop_4lxml_5etree_20__ContentOnlyElement_text, 0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence___ContentOnlyElement = {
  __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree___ContentOnlyElement, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_39__contains__, /*sq_contains*/
  #else
  0, /*sq_contains*/
  #endif
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___ContentOnlyElement = {
  __pyx_pw_4lxml_5etree_20__ContentOnlyElement_11__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_20__ContentOnlyElement_9__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree___ContentOnlyElement, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree___ContentOnlyElement = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.__ContentOnlyElement"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___ContentOnlyElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_31__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence___ContentOnlyElement, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___ContentOnlyElement, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree___ContentOnlyElement, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree___ContentOnlyElement, /*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_4lxml_5etree___ContentOnlyElement, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Comment __pyx_vtable_4lxml_5etree__Comment;

static PyObject *__pyx_tp_new_4lxml_5etree__Comment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Comment *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree___ContentOnlyElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Comment *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__Comment;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_8_Comment_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8_Comment_3tag_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Comment[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Comment[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_8_Comment_tag, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__Comment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Comment"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Comment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_8_Comment_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Comment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Comment, /*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_4lxml_5etree__Comment, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ProcessingInstruction __pyx_vtable_4lxml_5etree__ProcessingInstruction;

static PyObject *__pyx_tp_new_4lxml_5etree__ProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ProcessingInstruction *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree___ContentOnlyElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ProcessingInstruction *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_3tag_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6target_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_22_ProcessingInstruction_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_ProcessingInstruction_6attrib_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ProcessingInstruction[] = {
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_4lxml_5etree_22_ProcessingInstruction_3get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_ProcessingInstruction_2get)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ProcessingInstruction[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_tag, 0, 0, 0},
  {(char *)"target", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_target, __pyx_setprop_4lxml_5etree_22_ProcessingInstruction_target, 0, 0},
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_22_ProcessingInstruction_attrib, 0, __Pyx_DOCSTR(__pyx_k_Returns_a_dict_containing_all_ps), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ProcessingInstruction"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ProcessingInstruction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ProcessingInstruction, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ProcessingInstruction, /*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_4lxml_5etree__ProcessingInstruction, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Entity __pyx_vtable_4lxml_5etree__Entity;

static PyObject *__pyx_tp_new_4lxml_5etree__Entity(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Entity *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree___ContentOnlyElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Entity *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__Entity;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7_Entity_3tag_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7_Entity_4name_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_7_Entity_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7_Entity_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_7_Entity_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_7_Entity_4text_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Entity[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Entity[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_7_Entity_tag, 0, 0, 0},
  {(char *)"name", __pyx_getprop_4lxml_5etree_7_Entity_name, __pyx_setprop_4lxml_5etree_7_Entity_name, 0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_7_Entity_text, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__Entity = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Entity"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Entity), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_7_Entity_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Entity, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Entity, /*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_4lxml_5etree__Entity, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTree __pyx_vtable_4lxml_5etree__ElementTree;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementTree(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlElementTree *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElementTree *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementTree;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_context_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementTree(PyObject *o) {
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_context_node);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementTree(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_context_node) {
    e = (*v)(((PyObject*)p->_context_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementTree(PyObject *o) {
  struct LxmlElementTree *p = (struct LxmlElementTree *)o;
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_context_node);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_12_ElementTree_docinfo(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_ElementTree_7docinfo_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_12_ElementTree_parser(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_ElementTree_6parser_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementTree[] = {
  {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_1parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_parse)},
  {__Pyx_NAMESTR("_setroot"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_3_setroot, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_2_setroot)},
  {__Pyx_NAMESTR("getroot"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_5getroot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_4getroot)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_7__copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_9__deepcopy__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_11write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_10write)},
  {__Pyx_NAMESTR("getpath"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_13getpath, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_12getpath)},
  {__Pyx_NAMESTR("getiterator"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_15getiterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_14getiterator)},
  {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_17iter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_16iter)},
  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_19find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_18find)},
  {__Pyx_NAMESTR("findtext"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_21findtext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_20findtext)},
  {__Pyx_NAMESTR("findall"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_23findall, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_22findall)},
  {__Pyx_NAMESTR("iterfind"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_25iterfind, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_24iterfind)},
  {__Pyx_NAMESTR("xpath"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_27xpath, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_26xpath)},
  {__Pyx_NAMESTR("xslt"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_29xslt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_28xslt)},
  {__Pyx_NAMESTR("relaxng"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_31relaxng, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_30relaxng)},
  {__Pyx_NAMESTR("xmlschema"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_33xmlschema, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_32xmlschema)},
  {__Pyx_NAMESTR("xinclude"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_35xinclude, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_34xinclude)},
  {__Pyx_NAMESTR("write_c14n"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ElementTree_37write_c14n, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_12_ElementTree_36write_c14n)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementTree[] = {
  {(char *)"docinfo", __pyx_getprop_4lxml_5etree_12_ElementTree_docinfo, 0, __Pyx_DOCSTR(__pyx_k_Information_about_the_document_p), 0},
  {(char *)"parser", __pyx_getprop_4lxml_5etree_12_ElementTree_parser, 0, __Pyx_DOCSTR(__pyx_k_The_parser_that_was_used_to_pars), 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) LxmlElementTreeType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementTree"), /*tp_name*/
  sizeof(struct LxmlElementTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTree, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementTree, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementTree, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementTree, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ElementTree, /*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_4lxml_5etree__ElementTree, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__Attrib *__pyx_freelist_4lxml_5etree__Attrib[16];
static int __pyx_freecount_4lxml_5etree__Attrib = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__Attrib(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Attrib *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__Attrib > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__Attrib)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__Attrib[--__pyx_freecount_4lxml_5etree__Attrib];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__Attrib));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__Attrib *)o);
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7_Attrib_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Attrib(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element);
  if ((__pyx_freecount_4lxml_5etree__Attrib < 16) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__Attrib))) {
    __pyx_freelist_4lxml_5etree__Attrib[__pyx_freecount_4lxml_5etree__Attrib++] = ((struct __pyx_obj_4lxml_5etree__Attrib *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__Attrib(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  if (p->_element) {
    e = (*v)(((PyObject*)p->_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Attrib(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Attrib *p = (struct __pyx_obj_4lxml_5etree__Attrib *)o;
  Py_CLEAR(p->_element);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__Attrib(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_4lxml_5etree__Attrib(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_7_Attrib_3__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_4lxml_5etree_7_Attrib_5__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__Attrib[] = {
  {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_7update, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("pop"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_9pop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_11clear, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_15__copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_17__deepcopy__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_25get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_27keys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_31iterkeys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_33values, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_35itervalues, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_37items, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_39iteritems, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pw_4lxml_5etree_7_Attrib_41has_key, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Attrib = {
  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*/
  __pyx_pw_4lxml_5etree_7_Attrib_21__bool__, /*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__Attrib = {
  __pyx_pw_4lxml_5etree_7_Attrib_23__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__Attrib, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_7_Attrib_43__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Attrib = {
  __pyx_pw_4lxml_5etree_7_Attrib_23__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_7_Attrib_19__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__Attrib, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__Attrib = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Attrib"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Attrib), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Attrib, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_7_Attrib_13__repr__, /*tp_repr*/
  &__pyx_tp_as_number__Attrib, /*tp_as_number*/
  &__pyx_tp_as_sequence__Attrib, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Attrib, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A dict-like proxy for the ``Element.attrib`` property.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Attrib, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Attrib, /*tp_clear*/
  __pyx_pw_4lxml_5etree_7_Attrib_45__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_7_Attrib_29__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Attrib, /*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_4lxml_5etree__Attrib, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__AttribIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AttribIterator *)o);
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__AttribIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__AttribIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  if (p->_node) {
    e = (*v)(((PyObject*)p->_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__AttribIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__AttribIterator *p = (struct __pyx_obj_4lxml_5etree__AttribIterator *)o;
  Py_CLEAR(p->_node);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__AttribIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_15_AttribIterator_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__AttribIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._AttribIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AttribIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__AttribIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Attribute iterator - for internal use only!\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__AttribIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__AttribIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_15_AttribIterator_1__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_15_AttribIterator_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AttribIterator, /*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_4lxml_5etree__AttribIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher __pyx_vtable_4lxml_5etree__ElementTagMatcher;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementTagMatcher(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct LxmlElementTagMatcher *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElementTagMatcher *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  p->_pystrings = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(PyObject *o) {
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_pystrings);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  if (p->_pystrings) {
    e = (*v)(p->_pystrings, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(PyObject *o) {
  struct LxmlElementTagMatcher *p = (struct LxmlElementTagMatcher *)o;
  Py_CLEAR(p->_pystrings);
  return 0;
}

DL_EXPORT(PyTypeObject) LxmlElementTagMatcherType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementTagMatcher"), /*tp_name*/
  sizeof(struct LxmlElementTagMatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Dead but public. :)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ElementTagMatcher, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementIterator __pyx_vtable_4lxml_5etree__ElementIterator;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlElementIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTagMatcher(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlElementIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher*)__pyx_vtabptr_4lxml_5etree__ElementIterator;
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementIterator(PyObject *o) {
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ElementTagMatcher(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTagMatcher(o, v, a); if (e) return e;
  if (p->_node) {
    e = (*v)(((PyObject*)p->_node), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementIterator(PyObject *o) {
  struct LxmlElementIterator *p = (struct LxmlElementIterator *)o;
  __pyx_tp_clear_4lxml_5etree__ElementTagMatcher(o);
  Py_CLEAR(p->_node);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_16_ElementIterator_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) LxmlElementIteratorType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementIterator"), /*tp_name*/
  sizeof(struct LxmlElementIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Dead but public. :)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_16_ElementIterator_1__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_16_ElementIterator_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementIterator, /*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_4lxml_5etree__ElementIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__MultiTagMatcher __pyx_vtable_4lxml_5etree__MultiTagMatcher;

static PyObject *__pyx_tp_new_4lxml_5etree__MultiTagMatcher(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__MultiTagMatcher;
  p->_py_tags = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_cached_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_16_MultiTagMatcher_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__MultiTagMatcher(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p = (struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_16_MultiTagMatcher_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_py_tags);
  Py_CLEAR(p->_cached_doc);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__MultiTagMatcher(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p = (struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o;
  if (p->_py_tags) {
    e = (*v)(p->_py_tags, a); if (e) return e;
  }
  if (p->_cached_doc) {
    e = (*v)(((PyObject*)p->_cached_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__MultiTagMatcher(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__MultiTagMatcher *p = (struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)o;
  Py_CLEAR(p->_py_tags);
  Py_CLEAR(p->_cached_doc);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__MultiTagMatcher[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__MultiTagMatcher = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._MultiTagMatcher"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__MultiTagMatcher), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__MultiTagMatcher, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Match an xmlNode against a list of tags.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__MultiTagMatcher, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__MultiTagMatcher, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__MultiTagMatcher, /*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_4lxml_5etree__MultiTagMatcher, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator __pyx_vtable_4lxml_5etree__ElementMatchIterator;

static PyObject *__pyx_tp_new_4lxml_5etree__ElementMatchIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  p->_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p = (struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_node);
  Py_CLEAR(p->_matcher);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p = (struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o;
  if (p->_node) {
    e = (*v)(((PyObject*)p->_node), a); if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject*)p->_matcher), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementMatchIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementMatchIterator *p = (struct __pyx_obj_4lxml_5etree__ElementMatchIterator *)o;
  Py_CLEAR(p->_node);
  Py_CLEAR(p->_matcher);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementMatchIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ElementMatchIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementMatchIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ElementMatchIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementMatchIterator, /*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_4lxml_5etree__ElementMatchIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementChildIterator __pyx_vtable_4lxml_5etree_ElementChildIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementChildIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementChildIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementMatchIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementChildIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator*)__pyx_vtabptr_4lxml_5etree_ElementChildIterator;
  if (unlikely(__pyx_pw_4lxml_5etree_20ElementChildIterator_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementChildIterator[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementChildIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementChildIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementChildIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementChildIterator(self, node, tag=None, reversed=False)\n    Iterates over the children of an element.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  #else
  0, /*tp_iternext*/
  #endif
  __pyx_methods_4lxml_5etree_ElementChildIterator, /*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_4lxml_5etree_ElementChildIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_SiblingsIterator __pyx_vtable_4lxml_5etree_SiblingsIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_SiblingsIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_SiblingsIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementMatchIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_SiblingsIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator*)__pyx_vtabptr_4lxml_5etree_SiblingsIterator;
  if (unlikely(__pyx_pw_4lxml_5etree_16SiblingsIterator_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_SiblingsIterator[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_SiblingsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.SiblingsIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_SiblingsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("SiblingsIterator(self, node, tag=None, preceding=False)\n    Iterates over the siblings of an element.\n\n    You can pass the boolean keyword ``preceding`` to specify the direction.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  #else
  0, /*tp_iternext*/
  #endif
  __pyx_methods_4lxml_5etree_SiblingsIterator, /*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_4lxml_5etree_SiblingsIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_AncestorsIterator __pyx_vtable_4lxml_5etree_AncestorsIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_AncestorsIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_AncestorsIterator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementMatchIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_AncestorsIterator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementMatchIterator*)__pyx_vtabptr_4lxml_5etree_AncestorsIterator;
  if (unlikely(__pyx_pw_4lxml_5etree_17AncestorsIterator_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AncestorsIterator[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_AncestorsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.AncestorsIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_AncestorsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementMatchIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("AncestorsIterator(self, node, tag=None)\n    Iterates over the ancestors of an element (from parent to parent).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementMatchIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementMatchIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_21_ElementMatchIterator_3__next__, /*tp_iternext*/
  #else
  0, /*tp_iternext*/
  #endif
  __pyx_methods_4lxml_5etree_AncestorsIterator, /*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_4lxml_5etree_AncestorsIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementDepthFirstIterator __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementDepthFirstIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator;
  p->_next_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_top_node = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_next_node);
  Py_CLEAR(p->_top_node);
  Py_CLEAR(p->_matcher);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  if (p->_next_node) {
    e = (*v)(((PyObject*)p->_next_node), a); if (e) return e;
  }
  if (p->_top_node) {
    e = (*v)(((PyObject*)p->_top_node), a); if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject*)p->_matcher), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *p = (struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *)o;
  Py_CLEAR(p->_next_node);
  Py_CLEAR(p->_top_node);
  Py_CLEAR(p->_matcher);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDepthFirstIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementDepthFirstIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementDepthFirstIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementDepthFirstIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementDepthFirstIterator(self, node, tag=None, inclusive=True)\n    Iterates over an element and its sub-elements in document order (depth\n    first pre-order).\n\n    Note that this also includes comments, entities and processing\n    instructions.  To filter them out, check if the ``tag`` property\n    of the returned element is a string (i.e. not None and not a\n    factory function), or pass the ``Element`` factory for the ``tag``\n    argument to receive only Elements.\n\n    If the optional ``tag`` argument is not None, the iterator returns only\n    the elements that match the respective name and namespace.\n\n    The optional boolean argument 'inclusive' defaults to True and can be set\n    to False to exclude the start element itself.\n\n    Note that the behaviour of this iterator is completely undefined if the\n    tree it traverses is modified during iteration.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementDepthFirstIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementDepthFirstIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_25ElementDepthFirstIterator_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementDepthFirstIterator, /*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_4lxml_5etree_ElementDepthFirstIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementTextIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o);
  p->_nextEvent = Py_None; Py_INCREF(Py_None);
  p->_start_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_19ElementTextIterator_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_nextEvent);
  Py_CLEAR(p->_start_element);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementTextIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  if (p->_nextEvent) {
    e = (*v)(p->_nextEvent, a); if (e) return e;
  }
  if (p->_start_element) {
    e = (*v)(((PyObject*)p->_start_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementTextIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementTextIterator *p = (struct __pyx_obj_4lxml_5etree_ElementTextIterator *)o;
  Py_CLEAR(p->_nextEvent);
  Py_CLEAR(p->_start_element);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementTextIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementTextIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementTextIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementTextIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementTextIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementTextIterator(self, element, tag=None, with_tail=True)\n    Iterates over the text content of a subtree.\n\n    You can pass the ``tag`` keyword argument to restrict text content to a\n    specific tag name.\n\n    You can set the ``with_tail`` keyword argument to ``False`` to skip over\n    tail text (e.g. if you know that it's only whitespace from pretty-printing).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementTextIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementTextIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_19ElementTextIterator_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_19ElementTextIterator_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementTextIterator, /*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_4lxml_5etree_ElementTextIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_CDATA(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CDATA *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CDATA *)o);
  p->_utf8_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_5CDATA_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_CDATA(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_CDATA *p = (struct __pyx_obj_4lxml_5etree_CDATA *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  Py_CLEAR(p->_utf8_data);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_CDATA[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_CDATA = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.CDATA"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CDATA), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_CDATA, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("CDATA(data)\n\n    CDATA factory.  This factory creates an opaque data object that\n    can be used to set Element text.  The usual way to use it is::\n\n        >>> el = Element('content')\n        >>> el.text = CDATA('a string')\n\n        >>> print(el.text)\n        a string\n        >>> print(tostring(el, encoding=\"unicode\"))\n        <content><![CDATA[a string]]></content>\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CDATA, /*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_4lxml_5etree_CDATA, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy __pyx_vtable_4lxml_5etree__ReadOnlyProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyProxy(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  p->_source_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)Py_None); Py_INCREF(Py_None);
  p->_dependent_proxies = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_source_proxy);
  Py_CLEAR(p->_dependent_proxies);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  if (p->_source_proxy) {
    e = (*v)(((PyObject*)p->_source_proxy), a); if (e) return e;
  }
  if (p->_dependent_proxies) {
    e = (*v)(p->_dependent_proxies, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *p = (struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *)o;
  Py_CLEAR(p->_source_proxy);
  Py_CLEAR(p->_dependent_proxies);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__ReadOnlyProxy(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 PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tag(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3tag_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4text_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_4tail_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_10sourceline_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyProxy[] = {
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_11__deepcopy__, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_10__deepcopy__)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_13__copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_12__copy__)},
  {__Pyx_NAMESTR("iterchildren"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_17iterchildren, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_16iterchildren)},
  {__Pyx_NAMESTR("getchildren"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_19getchildren, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_18getchildren)},
  {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_21getparent, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_20getparent)},
  {__Pyx_NAMESTR("getnext"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_23getnext, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_22getnext)},
  {__Pyx_NAMESTR("getprevious"), (PyCFunction)__pyx_pw_4lxml_5etree_14_ReadOnlyProxy_25getprevious, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_14_ReadOnlyProxy_24getprevious)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyProxy[] = {
  {(char *)"tag", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tag, 0, __Pyx_DOCSTR(__pyx_k_Element_tag), 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_text, 0, __Pyx_DOCSTR(__pyx_k_Text_before_the_first_subelement), 0},
  {(char *)"tail", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_tail, 0, __Pyx_DOCSTR(__pyx_k_Text_after_this_element_s_end_ta), 0},
  {(char *)"sourceline", __pyx_getprop_4lxml_5etree_14_ReadOnlyProxy_sourceline, 0, __Pyx_DOCSTR(__pyx_k_Original_line_number_as_found_by), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__ReadOnlyProxy = {
  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*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_9__nonzero__, /*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__ReadOnlyProxy = {
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__ReadOnlyProxy, /*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__ReadOnlyProxy = {
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_7__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number__ReadOnlyProxy, /*tp_as_number*/
  &__pyx_tp_as_sequence__ReadOnlyProxy, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ReadOnlyProxy, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy class suitable for PIs/Comments (for internal use only!)."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyProxy, /*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_4lxml_5etree__ReadOnlyProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyPIProxy __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_16_ReadOnlyPIProxy_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_16_ReadOnlyPIProxy_6target_1__get__(o);
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyPIProxy[] = {
  {(char *)"target", __pyx_getprop_4lxml_5etree_16_ReadOnlyPIProxy_target, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyPIProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyPIProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy for processing instructions (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyPIProxy, /*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_4lxml_5etree__ReadOnlyPIProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyEntityProxy __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_20_ReadOnlyEntityProxy_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_20_ReadOnlyEntityProxy_4text_1__get__(o);
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_name, __pyx_setprop_4lxml_5etree_20_ReadOnlyEntityProxy_name, 0, 0},
  {(char *)"text", __pyx_getprop_4lxml_5etree_20_ReadOnlyEntityProxy_text, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyEntityProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyEntityProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy for entity references (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyEntityProxy, /*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_4lxml_5etree__ReadOnlyEntityProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyElementProxy __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6attrib_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_6prefix_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ReadOnlyElementProxy[] = {
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_1get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_get)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_3keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_2keys)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_5values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_4values)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pw_4lxml_5etree_21_ReadOnlyElementProxy_7items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21_ReadOnlyElementProxy_6items)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy[] = {
  {(char *)"attrib", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_attrib, 0, 0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_21_ReadOnlyElementProxy_prefix, 0, __Pyx_DOCSTR(__pyx_k_Namespace_prefix_or_None), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ReadOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ReadOnlyElementProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("The main read-only Element proxy class (for internal use only!)."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ReadOnlyElementProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ReadOnlyElementProxy, /*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_4lxml_5etree__ReadOnlyElementProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueNodeWrapper[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueNodeWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._OpaqueNodeWrapper"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueNodeWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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_4lxml_5etree__OpaqueNodeWrapper, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__OpaqueDocumentWrapper __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper;

static PyObject *__pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__OpaqueNodeWrapper(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__OpaqueDocumentWrapper[] = {
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_1append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_append)},
  {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_4lxml_5etree_22_OpaqueDocumentWrapper_3extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_OpaqueDocumentWrapper_2extend)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__OpaqueDocumentWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._OpaqueDocumentWrapper"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__OpaqueNodeWrapper, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*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_4lxml_5etree__OpaqueDocumentWrapper, /*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*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_18_OpaqueNodeWrapper_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__OpaqueDocumentWrapper, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_23_ModifyContentOnlyProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_23_ModifyContentOnlyProxy_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_23_ModifyContentOnlyProxy_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy[] = {
  {(char *)"text", __pyx_getprop_4lxml_5etree_23_ModifyContentOnlyProxy_text, __pyx_setprop_4lxml_5etree_23_ModifyContentOnlyProxy_text, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ModifyContentOnlyProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy that allows changing the text content.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyProxy, /*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_4lxml_5etree__ModifyContentOnlyProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyPIProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyPIProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_25_ModifyContentOnlyPIProxy_6target_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy[] = {
  {(char *)"target", __pyx_getprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target, __pyx_setprop_4lxml_5etree_25_ModifyContentOnlyPIProxy_target, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ModifyContentOnlyPIProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyPIProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy that allows changing the text/target content of a\n    processing instruction.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyPIProxy, /*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_4lxml_5etree__ModifyContentOnlyPIProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ModifyContentOnlyEntityProxy __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__ModifyContentOnlyEntityProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ModifyContentOnlyProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_29_ModifyContentOnlyEntityProxy_4name_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name, __pyx_setprop_4lxml_5etree_29_ModifyContentOnlyEntityProxy_name, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ModifyContentOnlyEntityProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ModifyContentOnlyEntityProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only proxy for entity references (for internal use only!)"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ModifyContentOnlyEntityProxy, /*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_4lxml_5etree__ModifyContentOnlyEntityProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__AppendOnlyElementProxy __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy;

static PyObject *__pyx_tp_new_4lxml_5etree__AppendOnlyElementProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ReadOnlyElementProxy(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ReadOnlyProxy*)__pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_23_AppendOnlyElementProxy_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_23_AppendOnlyElementProxy_text(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_4text_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__AppendOnlyElementProxy[] = {
  {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_1append, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_append)},
  {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_4lxml_5etree_23_AppendOnlyElementProxy_3extend, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_23_AppendOnlyElementProxy_2extend)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__AppendOnlyElementProxy[] = {
  {(char *)"text", __pyx_getprop_4lxml_5etree_23_AppendOnlyElementProxy_text, __pyx_setprop_4lxml_5etree_23_AppendOnlyElementProxy_text, __Pyx_DOCSTR(__pyx_k_Text_before_the_first_subelement_2), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__AppendOnlyElementProxy = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._AppendOnlyElementProxy"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ReadOnlyProxy, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A read-only element that allows adding children and changing the\n    text content (i.e. everything that adds to the subtree).\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ReadOnlyProxy, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ReadOnlyProxy, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_14_ReadOnlyProxy_15__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__AppendOnlyElementProxy, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__AppendOnlyElementProxy, /*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_4lxml_5etree__AppendOnlyElementProxy, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_4lxml_5etree__Element(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementBase[] = {
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) LxmlElementBaseType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementBase"), /*tp_name*/
  sizeof(struct LxmlElementBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_31__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementBase(*children, attrib=None, nsmap=None, **_extra)\n\n    The public Element class.  All custom Element classes must inherit\n    from this one.  To create an Element, use the `Element()` factory.\n\n    BIG FAT WARNING: Subclasses *must not* override __init__ or\n    __new__ as it is absolutely undefined when these objects will be\n    created or destroyed.  All persistent state of Elements must be\n    stored in the underlying XML.  If you really need to initialize\n    the object after creation, you can implement an ``_init(self)``\n    method that will be called directly after object creation.\n\n    Subclasses of this class can be instantiated to create a new\n    Element.  By default, the tag name will be the class name and the\n    namespace will be empty.  You can modify this with the following\n    class attributes:\n\n    * TAG - the tag name, possibly containing a namespace in Clark\n      notation\n\n    * NAMESPACE - the default namespace URI, unless provided as part\n      of the TAG attribute.\n\n    * HTML - flag if the class is an HTML tag, as opposed to an XML\n      tag.  This only applies to un-namespaced tags and defaults to\n      false (i.e. XML).\n\n    * PARSER - the parser that provides the configuration for the\n      newly created document.  Providing an HTML parser here will\n      default to creating an HTML element.\n\n    In user code, the latter three are commonly inherited in class\n    hierarchies that implement a common namespace.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_11ElementBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementBase, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_CommentBase __pyx_vtable_4lxml_5etree_CommentBase;

static PyObject *__pyx_tp_new_4lxml_5etree_CommentBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CommentBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Comment(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CommentBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_CommentBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CommentBase[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_CommentBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.CommentBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CommentBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Comment_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("All custom Comment classes must inherit from this one.\n\n    To create an XML Comment instance, use the ``Comment()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Comments must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CommentBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_11CommentBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CommentBase, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_PIBase __pyx_vtable_4lxml_5etree_PIBase;

static PyObject *__pyx_tp_new_4lxml_5etree_PIBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PIBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ProcessingInstruction(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PIBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_PIBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PIBase[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_PIBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.PIBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PIBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("All custom Processing Instruction classes must inherit from this one.\n\n    To create an XML ProcessingInstruction instance, use the ``PI()``\n    factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of PIs must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PIBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_6PIBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PIBase, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_EntityBase __pyx_vtable_4lxml_5etree_EntityBase;

static PyObject *__pyx_tp_new_4lxml_5etree_EntityBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_EntityBase *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_EntityBase *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree_EntityBase;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_EntityBase[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_EntityBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.EntityBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_EntityBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_7_Entity_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("All custom Entity classes must inherit from this one.\n\n    To create an XML Entity instance, use the ``Entity()`` factory.\n\n    Subclasses *must not* override __init__ or __new__ as it is\n    absolutely undefined when these objects will be created or\n    destroyed.  All persistent state of Entities must be stored in the\n    underlying XML.  If you really need to initialize the object after\n    creation, you can implement an ``_init(self)`` method that will be\n    called after object creation.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_EntityBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_10EntityBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_EntityBase, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementClassLookup(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_4lxml_5etree_18ElementClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementClassLookup[] = {
  {0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) LxmlElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementClassLookup"), /*tp_name*/
  sizeof(struct LxmlElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("ElementClassLookup(self)\n    Superclass of Element class lookups.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementClassLookup, /*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_4lxml_5etree_ElementClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup __pyx_vtable_4lxml_5etree_FallbackElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct LxmlFallbackElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_ElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct LxmlFallbackElementClassLookup *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  p->fallback = ((struct LxmlElementClassLookup *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->fallback);
  #if CYTHON_COMPILING_IN_CPYTHON
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  e = ((likely(__pyx_ptype_4lxml_5etree_ElementClassLookup)) ? ((__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse) ? __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup)); if (e) return e;
  if (p->fallback) {
    e = (*v)(((PyObject*)p->fallback), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(PyObject *o) {
  struct LxmlFallbackElementClassLookup *p = (struct LxmlFallbackElementClassLookup *)o;
  if (likely(__pyx_ptype_4lxml_5etree_ElementClassLookup)) { if (__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear) __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup);
  Py_CLEAR(p->fallback);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_26FallbackElementClassLookup_fallback(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_8fallback_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_FallbackElementClassLookup[] = {
  {__Pyx_NAMESTR("set_fallback"), (PyCFunction)__pyx_pw_4lxml_5etree_26FallbackElementClassLookup_5set_fallback, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26FallbackElementClassLookup_4set_fallback)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_FallbackElementClassLookup[] = {
  {(char *)"fallback", __pyx_getprop_4lxml_5etree_26FallbackElementClassLookup_fallback, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

DL_EXPORT(PyTypeObject) LxmlFallbackElementClassLookupType = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.FallbackElementClassLookup"), /*tp_name*/
  sizeof(struct LxmlFallbackElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("FallbackElementClassLookup(self, fallback=None)\n\n    Superclass of Element class lookups with additional fallback.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_FallbackElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_FallbackElementClassLookup, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_ElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o);
  p->element_class = Py_None; Py_INCREF(Py_None);
  p->comment_class = Py_None; Py_INCREF(Py_None);
  p->pi_class = Py_None; Py_INCREF(Py_None);
  p->entity_class = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->element_class);
  Py_CLEAR(p->comment_class);
  Py_CLEAR(p->pi_class);
  Py_CLEAR(p->entity_class);
  #if CYTHON_COMPILING_IN_CPYTHON
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree_ElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  e = ((likely(__pyx_ptype_4lxml_5etree_ElementClassLookup)) ? ((__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse) ? __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup)); if (e) return e;
  if (p->element_class) {
    e = (*v)(p->element_class, a); if (e) return e;
  }
  if (p->comment_class) {
    e = (*v)(p->comment_class, a); if (e) return e;
  }
  if (p->pi_class) {
    e = (*v)(p->pi_class, a); if (e) return e;
  }
  if (p->entity_class) {
    e = (*v)(p->entity_class, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup *)o;
  if (likely(__pyx_ptype_4lxml_5etree_ElementClassLookup)) { if (__pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear) __pyx_ptype_4lxml_5etree_ElementClassLookup->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup);
  Py_CLEAR(p->element_class);
  Py_CLEAR(p->comment_class);
  Py_CLEAR(p->pi_class);
  Py_CLEAR(p->entity_class);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_element_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13element_class_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_13comment_class_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_8pi_class_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_12entity_class_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementDefaultClassLookup[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_ElementDefaultClassLookup[] = {
  {(char *)"element_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_element_class, 0, 0, 0},
  {(char *)"comment_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_comment_class, 0, 0, 0},
  {(char *)"pi_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_pi_class, 0, 0, 0},
  {(char *)"entity_class", __pyx_getprop_4lxml_5etree_25ElementDefaultClassLookup_entity_class, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementDefaultClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementDefaultClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementDefaultClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementDefaultClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementDefaultClassLookup(self, element=None, comment=None, pi=None, entity=None)\n    Element class lookup scheme that always returns the default Element\n    class.\n\n    The keyword arguments ``element``, ``comment``, ``pi`` and ``entity``\n    accept the respective Element classes.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementDefaultClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementDefaultClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementDefaultClassLookup, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_ElementDefaultClassLookup, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_25ElementDefaultClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementDefaultClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_AttributeBasedElementClassLookup __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup;
  p->_class_mapping = Py_None; Py_INCREF(Py_None);
  p->_pytag = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_class_mapping);
  Py_CLEAR(p->_pytag);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  e = __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(o, v, a); if (e) return e;
  if (p->_class_mapping) {
    e = (*v)(p->_class_mapping, a); if (e) return e;
  }
  if (p->_pytag) {
    e = (*v)(p->_pytag, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *p = (struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup *)o;
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(o);
  Py_CLEAR(p->_class_mapping);
  Py_CLEAR(p->_pytag);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.AttributeBasedElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_AttributeBasedElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("AttributeBasedElementClassLookup(self, attribute_name, class_mapping, fallback=None)\n    Checks an attribute of an Element and looks up the value in a\n    class dictionary.\n\n    Arguments:\n      - attribute name - '{ns}name' style string\n      - class mapping  - Python dict mapping attribute values to Element classes\n      - fallback       - optional fallback lookup mechanism\n\n    A None key in the class mapping will be checked if the attribute is\n    missing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_AttributeBasedElementClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_32AttributeBasedElementClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_AttributeBasedElementClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ParserBasedElementClassLookup __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup;
  if (unlikely(__pyx_pw_4lxml_5etree_29ParserBasedElementClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ParserBasedElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ParserBasedElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ParserBasedElementClassLookup(self, fallback=None)\n    Element class lookup based on the XML parser.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ParserBasedElementClassLookup, /*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*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ParserBasedElementClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_CustomElementClassLookup __pyx_vtable_4lxml_5etree_CustomElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_CustomElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_CustomElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_CustomElementClassLookup;
  if (unlikely(__pyx_pw_4lxml_5etree_24CustomElementClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_CustomElementClassLookup[] = {
  {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_4lxml_5etree_24CustomElementClassLookup_3lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24CustomElementClassLookup_2lookup)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_CustomElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.CustomElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_CustomElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("CustomElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    You can inherit from this class and override the method::\n\n        lookup(self, type, doc, namespace, name)\n\n    to lookup the element class for a node. Arguments of the method:\n    * type:      one of 'element', 'comment', 'PI', 'entity'\n    * doc:       document that the node is in\n    * namespace: namespace URI of the node (or None for comments/PIs/entities)\n    * name:      name of the element/entity, None for comments, target for PIs\n\n    If you return None from this method, the fallback will be called.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_CustomElementClassLookup, /*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*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_CustomElementClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_PythonElementClassLookup __pyx_vtable_4lxml_5etree_PythonElementClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_PythonElementClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_PythonElementClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_PythonElementClassLookup;
  if (unlikely(__pyx_pw_4lxml_5etree_24PythonElementClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_PythonElementClassLookup[] = {
  {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_4lxml_5etree_24PythonElementClassLookup_3lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_24PythonElementClassLookup_2lookup)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_PythonElementClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.PythonElementClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_PythonElementClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("PythonElementClassLookup(self, fallback=None)\n    Element class lookup based on a subclass method.\n\n    This class lookup scheme allows access to the entire XML tree in\n    read-only mode.  To use it, re-implement the ``lookup(self, doc,\n    root)`` method in a subclass::\n\n        from lxml import etree, pyclasslookup\n\n        class MyElementClass(etree.ElementBase):\n            honkey = True\n\n        class MyLookup(pyclasslookup.PythonElementClassLookup):\n            def lookup(self, doc, root):\n                if root.tag == \"sometag\":\n                    return MyElementClass\n                else:\n                    for child in root:\n                        if child.tag == \"someothertag\":\n                            return MyElementClass\n                # delegate to default\n                return None\n\n    If you return None from this method, the fallback will be called.\n\n    The first argument is the opaque document instance that contains\n    the Element.  The second argument is a lightweight Element proxy\n    implementation that is only valid during the lookup.  Do not try\n    to keep a reference to it.  Once the lookup is done, the proxy\n    will be invalid.\n\n    Also, you cannot wrap such a read-only Element in an ElementTree,\n    and you must take care not to keep a reference to them outside of\n    the `lookup()` method.\n\n    Note that the API of the Element objects is not complete.  It is\n    purely read-only and does not support all features of the normal\n    `lxml.etree` API (such as XPath, extended slicing or some\n    iteration methods).\n\n    See http://codespeak.net/lxml/element_classes.html\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_PythonElementClassLookup, /*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*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_26FallbackElementClassLookup_3__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_PythonElementClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry __pyx_vtable_4lxml_5etree__NamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__NamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  p->_ns_uri = Py_None; Py_INCREF(Py_None);
  p->_ns_uri_utf = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_entries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_NamespaceRegistry_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_ns_uri);
  Py_CLEAR(p->_ns_uri_utf);
  Py_CLEAR(p->_entries);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  if (p->_ns_uri) {
    e = (*v)(p->_ns_uri, a); if (e) return e;
  }
  if (p->_entries) {
    e = (*v)(p->_entries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__NamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__NamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__NamespaceRegistry *)o;
  Py_CLEAR(p->_ns_uri);
  Py_CLEAR(p->_entries);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__NamespaceRegistry(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_4lxml_5etree__NamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript assignment not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
  else {
    return __pyx_pw_4lxml_5etree_18_NamespaceRegistry_7__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__NamespaceRegistry[] = {
  {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_3update, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_18_NamespaceRegistry_2update)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_11items, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_13iteritems, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pw_4lxml_5etree_18_NamespaceRegistry_15clear, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence__NamespaceRegistry = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__NamespaceRegistry, /*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__NamespaceRegistry = {
  0, /*mp_length*/
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_4lxml_5etree__NamespaceRegistry, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__NamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._NamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__NamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence__NamespaceRegistry, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__NamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Dictionary-like namespace registry"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__NamespaceRegistry, /*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_4lxml_5etree__NamespaceRegistry, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ClassNamespaceRegistry __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__ClassNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry;
  return o;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_1__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping && __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__ClassNamespaceRegistry[] = {
  {0, 0, 0, 0}
};

static PyMappingMethods __pyx_tp_as_mapping__ClassNamespaceRegistry = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_4lxml_5etree__ClassNamespaceRegistry, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__ClassNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ClassNamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ClassNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_23_ClassNamespaceRegistry_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__ClassNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Dictionary-like registry for namespace implementation classes"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ClassNamespaceRegistry, /*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_4lxml_5etree__ClassNamespaceRegistry, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ElementNamespaceClassLookup __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;

static PyObject *__pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_FallbackElementClassLookup(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup*)__pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup;
  p->_namespace_registries = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_namespace_registries);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree_FallbackElementClassLookup(o);
}

static int __pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  e = __pyx_tp_traverse_4lxml_5etree_FallbackElementClassLookup(o, v, a); if (e) return e;
  if (p->_namespace_registries) {
    e = (*v)(p->_namespace_registries, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *p = (struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup *)o;
  __pyx_tp_clear_4lxml_5etree_FallbackElementClassLookup(o);
  Py_CLEAR(p->_namespace_registries);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup[] = {
  {__Pyx_NAMESTR("get_namespace"), (PyCFunction)__pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_5get_namespace, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_27ElementNamespaceClassLookup_4get_namespace)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ElementNamespaceClassLookup = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ElementNamespaceClassLookup"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ElementNamespaceClassLookup), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_ElementNamespaceClassLookup, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ElementNamespaceClassLookup(self, fallback=None)\n\n    Element class lookup scheme that searches the Element class in the\n    Namespace registry.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_ElementNamespaceClassLookup, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_ElementNamespaceClassLookup, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ElementNamespaceClassLookup, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_27ElementNamespaceClassLookup_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ElementNamespaceClassLookup, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FunctionNamespaceRegistry __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__NamespaceRegistry(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  return o;
}

static int __pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_1__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping && __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_4lxml_5etree__NamespaceRegistry->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry[] = {
  {0, 0, 0, 0}
};

static PyMappingMethods __pyx_tp_as_mapping__FunctionNamespaceRegistry = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_5__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_4lxml_5etree__FunctionNamespaceRegistry, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__FunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FunctionNamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FunctionNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__FunctionNamespaceRegistry, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FunctionNamespaceRegistry, /*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_4lxml_5etree__FunctionNamespaceRegistry, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathFunctionNamespaceRegistry __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathFunctionNamespaceRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__FunctionNamespaceRegistry(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__NamespaceRegistry*)__pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry;
  p->_prefix = Py_None; Py_INCREF(Py_None);
  p->_prefix_utf = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_prefix);
  Py_CLEAR(p->_prefix_utf);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__NamespaceRegistry(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  e = __pyx_tp_traverse_4lxml_5etree__NamespaceRegistry(o, v, a); if (e) return e;
  if (p->_prefix) {
    e = (*v)(p->_prefix, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *p = (struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry *)o;
  __pyx_tp_clear_4lxml_5etree__NamespaceRegistry(o);
  Py_CLEAR(p->_prefix);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_3__get__(o);
}

static int __pyx_setprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_5__set__(o, v);
  }
  else {
    return __pyx_pw_4lxml_5etree_31_XPathFunctionNamespaceRegistry_6prefix_1__del__(o);
  }
}

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry[] = {
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix, __pyx_setprop_4lxml_5etree_31_XPathFunctionNamespaceRegistry_prefix, __Pyx_DOCSTR(__pyx_k_Namespace_prefix_for_extension_f), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XPathFunctionNamespaceRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathFunctionNamespaceRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_26_FunctionNamespaceRegistry_3__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathFunctionNamespaceRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_18_NamespaceRegistry_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XPathFunctionNamespaceRegistry, /*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_4lxml_5etree__XPathFunctionNamespaceRegistry, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__InputDocument(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__InputDocument *)o);
  p->_data_bytes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->_file = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_InputDocument_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__InputDocument(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_data_bytes);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_file);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__InputDocument(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->_file) {
    e = (*v)(p->_file, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__InputDocument(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__InputDocument *p = (struct __pyx_obj_4lxml_5etree__InputDocument *)o;
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_file);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__InputDocument[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__InputDocument = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._InputDocument"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__InputDocument), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__InputDocument, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__InputDocument, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__InputDocument, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__InputDocument, /*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_4lxml_5etree__InputDocument, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_Resolver(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Resolver(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_Resolver[] = {
  {__Pyx_NAMESTR("resolve"), (PyCFunction)__pyx_pw_4lxml_5etree_8Resolver_1resolve, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_resolve)},
  {__Pyx_NAMESTR("resolve_empty"), (PyCFunction)__pyx_pw_4lxml_5etree_8Resolver_3resolve_empty, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_2resolve_empty)},
  {__Pyx_NAMESTR("resolve_string"), (PyCFunction)__pyx_pw_4lxml_5etree_8Resolver_5resolve_string, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_4resolve_string)},
  {__Pyx_NAMESTR("resolve_filename"), (PyCFunction)__pyx_pw_4lxml_5etree_8Resolver_7resolve_filename, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_6resolve_filename)},
  {__Pyx_NAMESTR("resolve_file"), (PyCFunction)__pyx_pw_4lxml_5etree_8Resolver_9resolve_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_8Resolver_8resolve_file)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_Resolver = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.Resolver"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Resolver), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Resolver, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("This is the base class of all resolvers."), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_Resolver, /*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_4lxml_5etree_Resolver, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverRegistry __pyx_vtable_4lxml_5etree__ResolverRegistry;

static PyObject *__pyx_tp_new_4lxml_5etree__ResolverRegistry(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ResolverRegistry;
  p->_resolvers = Py_None; Py_INCREF(Py_None);
  p->_default_resolver = ((struct __pyx_obj_4lxml_5etree_Resolver *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_17_ResolverRegistry_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ResolverRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_default_resolver);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ResolverRegistry(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  if (p->_resolvers) {
    e = (*v)(p->_resolvers, a); if (e) return e;
  }
  if (p->_default_resolver) {
    e = (*v)(((PyObject*)p->_default_resolver), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ResolverRegistry(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverRegistry *p = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *)o;
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_default_resolver);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ResolverRegistry[] = {
  {__Pyx_NAMESTR("add"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ResolverRegistry_3add, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_2add)},
  {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ResolverRegistry_5remove, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_4remove)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ResolverRegistry_7copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_6copy)},
  {__Pyx_NAMESTR("resolve"), (PyCFunction)__pyx_pw_4lxml_5etree_17_ResolverRegistry_9resolve, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_17_ResolverRegistry_8resolve)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ResolverRegistry = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ResolverRegistry"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverRegistry), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ResolverRegistry, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_17_ResolverRegistry_11__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ResolverRegistry, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ResolverRegistry, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ResolverRegistry, /*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_4lxml_5etree__ResolverRegistry, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ResolverContext __pyx_vtable_4lxml_5etree__ResolverContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ResolverContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ExceptionContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ResolverContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__ResolverContext;
  p->_resolvers = ((struct __pyx_obj_4lxml_5etree__ResolverRegistry *)Py_None); Py_INCREF(Py_None);
  p->_storage = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_storage);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ExceptionContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ResolverContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ExceptionContext(o, v, a); if (e) return e;
  if (p->_resolvers) {
    e = (*v)(((PyObject*)p->_resolvers), a); if (e) return e;
  }
  if (p->_storage) {
    e = (*v)(((PyObject*)p->_storage), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ResolverContext *p = (struct __pyx_obj_4lxml_5etree__ResolverContext *)o;
  __pyx_tp_clear_4lxml_5etree__ExceptionContext(o);
  Py_CLEAR(p->_resolvers);
  Py_CLEAR(p->_storage);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree__ResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ResolverContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ResolverContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ResolverContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ResolverContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__ResolverContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserContext __pyx_vtable_4lxml_5etree__ParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ResolverContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__ParserContext;
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  p->_validator = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)Py_None); Py_INCREF(Py_None);
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_14_ParserContext_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_14_ParserContext_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_error_log);
  Py_CLEAR(p->_validator);
  Py_CLEAR(p->_doc);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ResolverContext(o, v, a); if (e) return e;
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  if (p->_validator) {
    e = (*v)(((PyObject*)p->_validator), a); if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserContext *p = (struct __pyx_obj_4lxml_5etree__ParserContext *)o;
  __pyx_tp_clear_4lxml_5etree__ResolverContext(o);
  Py_CLEAR(p->_error_log);
  Py_CLEAR(p->_validator);
  Py_CLEAR(p->_doc);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParserContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserContext, /*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_4lxml_5etree__ParserContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserContext __pyx_vtable_4lxml_5etree__SaxParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ParserContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__SaxParserContext;
  p->_target = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)Py_None); Py_INCREF(Py_None);
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_ns_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->events_iterator = ((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)Py_None); Py_INCREF(Py_None);
  p->_root = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_17_SaxParserContext_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->events_iterator);
  Py_CLEAR(p->_root);
  Py_CLEAR(p->_matcher);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__SaxParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ParserContext(o, v, a); if (e) return e;
  if (p->_target) {
    e = (*v)(((PyObject*)p->_target), a); if (e) return e;
  }
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  if (p->_ns_stack) {
    e = (*v)(p->_ns_stack, a); if (e) return e;
  }
  if (p->_node_stack) {
    e = (*v)(p->_node_stack, a); if (e) return e;
  }
  if (p->events_iterator) {
    e = (*v)(((PyObject*)p->events_iterator), a); if (e) return e;
  }
  if (p->_root) {
    e = (*v)(((PyObject*)p->_root), a); if (e) return e;
  }
  if (p->_matcher) {
    e = (*v)(((PyObject*)p->_matcher), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__SaxParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__SaxParserContext *p = (struct __pyx_obj_4lxml_5etree__SaxParserContext *)o;
  __pyx_tp_clear_4lxml_5etree__ParserContext(o);
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_ns_stack);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->events_iterator);
  Py_CLEAR(p->_root);
  Py_CLEAR(p->_matcher);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__SaxParserContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._SaxParserContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__SaxParserContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("This class maps SAX2 events to parser target events.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__SaxParserContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__SaxParserContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__SaxParserContext, /*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_4lxml_5etree__SaxParserContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__TargetParserContext __pyx_vtable_4lxml_5etree__TargetParserContext;

static PyObject *__pyx_tp_new_4lxml_5etree__TargetParserContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__TargetParserContext *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__TargetParserContext;
  p->_python_target = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__TargetParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_python_target);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__TargetParserContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__SaxParserContext(o, v, a); if (e) return e;
  if (p->_python_target) {
    e = (*v)(p->_python_target, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__TargetParserContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__TargetParserContext *p = (struct __pyx_obj_4lxml_5etree__TargetParserContext *)o;
  __pyx_tp_clear_4lxml_5etree__SaxParserContext(o);
  Py_CLEAR(p->_python_target);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree__TargetParserContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._TargetParserContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__TargetParserContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__TargetParserContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("This class maps SAX2 events to the ET parser target interface.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__TargetParserContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__TargetParserContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__TargetParserContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserSchemaValidationContext __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserSchemaValidationContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext;
  p->_schema = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_30_ParserSchemaValidationContext_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_schema);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  if (p->_schema) {
    e = (*v)(((PyObject*)p->_schema), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *p = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *)o;
  Py_CLEAR(p->_schema);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserSchemaValidationContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ParserSchemaValidationContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParserSchemaValidationContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserSchemaValidationContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserSchemaValidationContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserSchemaValidationContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserSchemaValidationContext, /*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_4lxml_5etree__ParserSchemaValidationContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__Validator __pyx_vtable_4lxml_5etree__Validator;

static PyObject *__pyx_tp_new_4lxml_5etree__Validator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__Validator *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__Validator *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__Validator;
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_10_Validator_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__Validator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_error_log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__Validator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__Validator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__Validator *p = (struct __pyx_obj_4lxml_5etree__Validator *)o;
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_10_Validator_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_10_Validator_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__Validator[] = {
  {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_3validate, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_2validate)},
  {__Pyx_NAMESTR("assertValid"), (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_5assertValid, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_4assertValid)},
  {__Pyx_NAMESTR("assert_"), (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_7assert_, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_10_Validator_6assert_)},
  {__Pyx_NAMESTR("_append_log_message"), (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_9_append_log_message, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_clear_error_log"), (PyCFunction)__pyx_pw_4lxml_5etree_10_Validator_11_clear_error_log, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__Validator[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_10_Validator_error_log, 0, __Pyx_DOCSTR(__pyx_k_The_log_of_validation_errors_and), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__Validator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._Validator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__Validator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Validator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Base class for XML validators."), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__Validator, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__Validator, /*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_4lxml_5etree__Validator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLSchema __pyx_vtable_4lxml_5etree_XMLSchema;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLSchema(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLSchema *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLSchema *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_XMLSchema;
  if (unlikely(__pyx_pw_4lxml_5etree_9XMLSchema_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XMLSchema(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_9XMLSchema_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLSchema[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XMLSchema = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XMLSchema"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLSchema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XMLSchema, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_9XMLSchema_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XMLSchema(self, etree=None, file=None)\n    Turn a document into an XML Schema validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n\n    Passing the ``attribute_defaults`` boolean option will make the\n    schema insert default/fixed attributes into validated documents.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLSchema, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_9XMLSchema_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLSchema, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ParserDictionaryContext __pyx_vtable_4lxml_5etree__ParserDictionaryContext;

static PyObject *__pyx_tp_new_4lxml_5etree__ParserDictionaryContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext;
  p->_default_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_implied_parser_contexts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_24_ParserDictionaryContext_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_24_ParserDictionaryContext_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_default_parser);
  Py_CLEAR(p->_implied_parser_contexts);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  if (p->_default_parser) {
    e = (*v)(((PyObject*)p->_default_parser), a); if (e) return e;
  }
  if (p->_implied_parser_contexts) {
    e = (*v)(p->_implied_parser_contexts, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParserDictionaryContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *p = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)o;
  Py_CLEAR(p->_default_parser);
  Py_CLEAR(p->_implied_parser_contexts);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParserDictionaryContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ParserDictionaryContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParserDictionaryContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParserDictionaryContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParserDictionaryContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParserDictionaryContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParserDictionaryContext, /*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_4lxml_5etree__ParserDictionaryContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FileReaderContext __pyx_vtable_4lxml_5etree__FileReaderContext;

static PyObject *__pyx_tp_new_4lxml_5etree__FileReaderContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FileReaderContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__FileReaderContext;
  p->_filelike = Py_None; Py_INCREF(Py_None);
  p->_encoding = Py_None; Py_INCREF(Py_None);
  p->_url = Py_None; Py_INCREF(Py_None);
  p->_bytes = Py_None; Py_INCREF(Py_None);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_FileReaderContext_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__FileReaderContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_url);
  Py_CLEAR(p->_bytes);
  Py_CLEAR(p->_exc_context);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__FileReaderContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  if (p->_filelike) {
    e = (*v)(p->_filelike, a); if (e) return e;
  }
  if (p->_encoding) {
    e = (*v)(p->_encoding, a); if (e) return e;
  }
  if (p->_url) {
    e = (*v)(p->_url, a); if (e) return e;
  }
  if (p->_bytes) {
    e = (*v)(p->_bytes, a); if (e) return e;
  }
  if (p->_exc_context) {
    e = (*v)(((PyObject*)p->_exc_context), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FileReaderContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileReaderContext *p = (struct __pyx_obj_4lxml_5etree__FileReaderContext *)o;
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_url);
  Py_CLEAR(p->_bytes);
  Py_CLEAR(p->_exc_context);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FileReaderContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__FileReaderContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FileReaderContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FileReaderContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FileReaderContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FileReaderContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FileReaderContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FileReaderContext, /*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_4lxml_5etree__FileReaderContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FeedParser __pyx_vtable_4lxml_5etree__FeedParser;

static PyObject *__pyx_tp_new_4lxml_5etree__FeedParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FeedParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FeedParser *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree__FeedParser;
  return o;
}

static PyObject *__pyx_getprop_4lxml_5etree_11_FeedParser_feed_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_11_FeedParser_14feed_error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__FeedParser[] = {
  {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pw_4lxml_5etree_11_FeedParser_1feed, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_FeedParser_feed)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_4lxml_5etree_11_FeedParser_3close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11_FeedParser_2close)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__FeedParser[] = {
  {(char *)"feed_error_log", __pyx_getprop_4lxml_5etree_11_FeedParser_feed_error_log, 0, __Pyx_DOCSTR(__pyx_k_The_error_log_of_the_last_or_cur), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__FeedParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FeedParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FeedParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FeedParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__FeedParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_11_BaseParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__FeedParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLParser __pyx_vtable_4lxml_5etree_XMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__FeedParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_XMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLParser[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XMLParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XMLParser(self, encoding=None, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, XMLSchema schema=None, remove_blank_text=False, resolve_entities=True, remove_comments=False, remove_pis=False, strip_cdata=True, target=None, compact=True)\n\n    The XML parser.\n\n    Parsers can be supplied as additional argument to various parse\n    functions of the lxml API.  A default parser is always available\n    and can be replaced by a call to the global function\n    'set_default_parser'.  New parsers can be created at any time\n    without a major run-time overhead.\n\n    The keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if DTD\n    validation or attribute default values are requested (unless you\n    additionally provide an XMLSchema from which the default\n    attributes can be read).\n\n    Available boolean keyword arguments:\n\n    - attribute_defaults - inject default attributes from DTD or XMLSchema\n    - dtd_validation     - validate against a DTD referenced by the document\n    - load_dtd           - use DTD for parsing\n    - no_network         - prevent network access for related files (default: True)\n    - ns_clean           - clean up redundant namespace declarations\n    - recover            - try hard to parse through broken XML\n    - remove_blank_text  - discard blank text nodes that appear ignorable\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - strip_cdata        - replace CDATA sections by normal text content (default: True)\n    - compact            - safe memory for short text content (default: True)\n    - resolve_entities   - replace entities by their text value (default: True)\n    - huge_tree          - disable security restrictions and support very deep trees\n                           and very long text content (only affects libxml2 2.7+)\n\n    Other keyword arguments:\n\n    - encoding - override the document encoding\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads.  While this is\n    not harmful, it is more efficient to use separate parsers.  This does not\n    apply to the default parser.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_9XMLParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XMLPullParser __pyx_vtable_4lxml_5etree_XMLPullParser;

static PyObject *__pyx_tp_new_4lxml_5etree_XMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XMLPullParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XMLParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XMLPullParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_XMLPullParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XMLPullParser[] = {
  {__Pyx_NAMESTR("read_events"), (PyCFunction)__pyx_pw_4lxml_5etree_13XMLPullParser_3read_events, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XMLPullParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XMLPullParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XMLPullParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XMLPullParser(self, events=None, *, tag=None, **kwargs)\n\n    XML parser that collects parse events in an iterator.\n\n    The collected events are the same as for iterparse(), but the\n    parser itself is non-blocking in the sense that it receives\n    data chunks incrementally through its .feed() method, instead\n    of reading them directly from a file(-like) object all by itself.\n\n    By default, it collects Element end events.  To change that,\n    pass any subset of the available events into the ``events``\n    argument: ``'start'``, ``'end'``, ``'start-ns'``,\n    ``'end-ns'``, ``'comment'``, ``'pi'``.\n\n    To support loading external dependencies relative to the input\n    source, you can pass the ``base_url``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XMLPullParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_13XMLPullParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XMLPullParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ETCompatXMLParser __pyx_vtable_4lxml_5etree_ETCompatXMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_ETCompatXMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XMLParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ETCompatXMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_ETCompatXMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ETCompatXMLParser[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ETCompatXMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ETCompatXMLParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ETCompatXMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ETCompatXMLParser(self, encoding=None, attribute_defaults=False,                  dtd_validation=False, load_dtd=False, no_network=True,                  ns_clean=False, recover=False, schema=None,                  huge_tree=False, remove_blank_text=False, resolve_entities=True,                  remove_comments=True, remove_pis=True, strip_cdata=True,                  target=None, compact=True)\n\n    An XML parser with an ElementTree compatible default setup.\n\n    See the XMLParser class for details.\n\n    This parser has ``remove_comments`` and ``remove_pis`` enabled by default\n    and thus ignores comments and processing instructions.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ETCompatXMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_17ETCompatXMLParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ETCompatXMLParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLParser __pyx_vtable_4lxml_5etree_HTMLParser;

static PyObject *__pyx_tp_new_4lxml_5etree_HTMLParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_HTMLParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__FeedParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_HTMLParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_HTMLParser[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_HTMLParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.HTMLParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("HTMLParser(self, encoding=None, remove_blank_text=False,                    remove_comments=False, remove_pis=False, strip_cdata=True,                    no_network=True, target=None, XMLSchema schema=None,                    recover=True, compact=True)\n\n    The HTML parser.\n\n    This parser allows reading HTML into a normal XML tree.  By\n    default, it can read broken (non well-formed) HTML, depending on\n    the capabilities of libxml2.  Use the 'recover' option to switch\n    this off.\n\n    Available boolean keyword arguments:\n\n    - recover            - try hard to parse through broken HTML (default: True)\n    - no_network         - prevent network access for related files (default: True)\n    - remove_blank_text  - discard empty text nodes that are ignorable (i.e. not actual text content)\n    - remove_comments    - discard comments\n    - remove_pis         - discard processing instructions\n    - strip_cdata        - replace CDATA sections by normal text content (default: True)\n    - compact            - safe memory for short text content (default: True)\n\n    Other keyword arguments:\n\n    - encoding - override the document encoding\n    - target   - a parser target object that will receive the parse events\n    - schema   - an XMLSchema to validate against\n\n    Note that you should avoid sharing parsers between threads for performance\n    reasons.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_HTMLParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_10HTMLParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_HTMLParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_HTMLPullParser __pyx_vtable_4lxml_5etree_HTMLPullParser;

static PyObject *__pyx_tp_new_4lxml_5etree_HTMLPullParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_HTMLPullParser *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_HTMLParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_HTMLPullParser *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseParser*)__pyx_vtabptr_4lxml_5etree_HTMLPullParser;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_HTMLPullParser[] = {
  {__Pyx_NAMESTR("read_events"), (PyCFunction)__pyx_pw_4lxml_5etree_14HTMLPullParser_3read_events, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_HTMLPullParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.HTMLPullParser"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_HTMLPullParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("HTMLPullParser(self, events=None, *, tag=None, base_url=None, **kwargs)\n\n    HTML parser that collects parse events in an iterator.\n\n    The collected events are the same as for iterparse(), but the\n    parser itself is non-blocking in the sense that it receives\n    data chunks incrementally through its .feed() method, instead\n    of reading them directly from a file(-like) object all by itself.\n\n    By default, it collects Element end events.  To change that,\n    pass any subset of the available events into the ``events``\n    argument: ``'start'``, ``'end'``, ``'start-ns'``,\n    ``'end-ns'``, ``'comment'``, ``'pi'``.\n\n    To support loading external dependencies relative to the input\n    source, you can pass the ``base_url``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseParser, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_HTMLPullParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_14HTMLPullParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_HTMLPullParser, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget __pyx_vtable_4lxml_5etree__SaxParserTarget;

static PyObject *__pyx_tp_new_4lxml_5etree__SaxParserTarget(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__SaxParserTarget *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__SaxParserTarget *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  if (unlikely(__pyx_pw_4lxml_5etree_16_SaxParserTarget_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__SaxParserTarget[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__SaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._SaxParserTarget"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__SaxParserTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*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_4lxml_5etree__SaxParserTarget, /*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_4lxml_5etree__SaxParserTarget, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__ParseEventsIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_20_ParseEventsIterator_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ParseEventsIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p = (struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_events);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ParseEventsIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p = (struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o;
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ParseEventsIterator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ParseEventsIterator *p = (struct __pyx_obj_4lxml_5etree__ParseEventsIterator *)o;
  Py_CLEAR(p->_events);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ParseEventsIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ParseEventsIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ParseEventsIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ParseEventsIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ParseEventsIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A reusable parse events iterator"), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ParseEventsIterator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ParseEventsIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_20_ParseEventsIterator_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_20_ParseEventsIterator_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ParseEventsIterator, /*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_4lxml_5etree__ParseEventsIterator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_TreeBuilder __pyx_vtable_4lxml_5etree_TreeBuilder;

static PyObject *__pyx_tp_new_4lxml_5etree_TreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserTarget(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_TreeBuilder *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget*)__pyx_vtabptr_4lxml_5etree_TreeBuilder;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  p->_factory = Py_None; Py_INCREF(Py_None);
  p->_data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_element_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_element_stack_pop = Py_None; Py_INCREF(Py_None);
  p->_last = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_TreeBuilder(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_factory);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_element_stack);
  Py_CLEAR(p->_element_stack_pop);
  Py_CLEAR(p->_last);
  #if CYTHON_COMPILING_IN_CPYTHON
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(o);
}

static int __pyx_tp_traverse_4lxml_5etree_TreeBuilder(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  e = ((likely(__pyx_ptype_4lxml_5etree__SaxParserTarget)) ? ((__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse) ? __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree_TreeBuilder)); if (e) return e;
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  if (p->_factory) {
    e = (*v)(p->_factory, a); if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  if (p->_element_stack) {
    e = (*v)(p->_element_stack, a); if (e) return e;
  }
  if (p->_element_stack_pop) {
    e = (*v)(p->_element_stack_pop, a); if (e) return e;
  }
  if (p->_last) {
    e = (*v)(((PyObject*)p->_last), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_TreeBuilder(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_TreeBuilder *p = (struct __pyx_obj_4lxml_5etree_TreeBuilder *)o;
  if (likely(__pyx_ptype_4lxml_5etree__SaxParserTarget)) { if (__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear) __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree_TreeBuilder);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_factory);
  Py_CLEAR(p->_data);
  Py_CLEAR(p->_element_stack);
  Py_CLEAR(p->_element_stack_pop);
  Py_CLEAR(p->_last);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_TreeBuilder[] = {
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_4lxml_5etree_11TreeBuilder_3close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_2close)},
  {__Pyx_NAMESTR("data"), (PyCFunction)__pyx_pw_4lxml_5etree_11TreeBuilder_5data, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_4data)},
  {__Pyx_NAMESTR("start"), (PyCFunction)__pyx_pw_4lxml_5etree_11TreeBuilder_7start, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_6start)},
  {__Pyx_NAMESTR("end"), (PyCFunction)__pyx_pw_4lxml_5etree_11TreeBuilder_9end, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_8end)},
  {__Pyx_NAMESTR("pi"), (PyCFunction)__pyx_pw_4lxml_5etree_11TreeBuilder_11pi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_10pi)},
  {__Pyx_NAMESTR("comment"), (PyCFunction)__pyx_pw_4lxml_5etree_11TreeBuilder_13comment, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_11TreeBuilder_12comment)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_TreeBuilder = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.TreeBuilder"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_TreeBuilder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_TreeBuilder, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("TreeBuilder(self, element_factory=None, parser=None)\n    Parser target that builds a tree.\n\n    The final tree is returned by the ``close()`` method.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_TreeBuilder, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_TreeBuilder, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_TreeBuilder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_11TreeBuilder_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_TreeBuilder, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__PythonSaxParserTarget __pyx_vtable_4lxml_5etree__PythonSaxParserTarget;

static PyObject *__pyx_tp_new_4lxml_5etree__PythonSaxParserTarget(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__SaxParserTarget(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__SaxParserTarget*)__pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget;
  p->_target_start = Py_None; Py_INCREF(Py_None);
  p->_target_end = Py_None; Py_INCREF(Py_None);
  p->_target_data = Py_None; Py_INCREF(Py_None);
  p->_target_doctype = Py_None; Py_INCREF(Py_None);
  p->_target_pi = Py_None; Py_INCREF(Py_None);
  p->_target_comment = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_22_PythonSaxParserTarget_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_target_start);
  Py_CLEAR(p->_target_end);
  Py_CLEAR(p->_target_data);
  Py_CLEAR(p->_target_doctype);
  Py_CLEAR(p->_target_pi);
  Py_CLEAR(p->_target_comment);
  #if CYTHON_COMPILING_IN_CPYTHON
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__SaxParserTarget(o);
}

static int __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  e = ((likely(__pyx_ptype_4lxml_5etree__SaxParserTarget)) ? ((__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse) ? __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget)); if (e) return e;
  if (p->_target_start) {
    e = (*v)(p->_target_start, a); if (e) return e;
  }
  if (p->_target_end) {
    e = (*v)(p->_target_end, a); if (e) return e;
  }
  if (p->_target_data) {
    e = (*v)(p->_target_data, a); if (e) return e;
  }
  if (p->_target_doctype) {
    e = (*v)(p->_target_doctype, a); if (e) return e;
  }
  if (p->_target_pi) {
    e = (*v)(p->_target_pi, a); if (e) return e;
  }
  if (p->_target_comment) {
    e = (*v)(p->_target_comment, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *p = (struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget *)o;
  if (likely(__pyx_ptype_4lxml_5etree__SaxParserTarget)) { if (__pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear) __pyx_ptype_4lxml_5etree__SaxParserTarget->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget);
  Py_CLEAR(p->_target_start);
  Py_CLEAR(p->_target_end);
  Py_CLEAR(p->_target_data);
  Py_CLEAR(p->_target_doctype);
  Py_CLEAR(p->_target_pi);
  Py_CLEAR(p->_target_comment);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__PythonSaxParserTarget[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__PythonSaxParserTarget = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._PythonSaxParserTarget"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__PythonSaxParserTarget), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__PythonSaxParserTarget, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__PythonSaxParserTarget, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__PythonSaxParserTarget, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__PythonSaxParserTarget, /*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_4lxml_5etree__PythonSaxParserTarget, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__FilelikeWriter __pyx_vtable_4lxml_5etree__FilelikeWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__FilelikeWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__FilelikeWriter;
  p->_filelike = Py_None; Py_INCREF(Py_None);
  p->_close_filelike = Py_None; Py_INCREF(Py_None);
  p->_exc_context = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  p->error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_15_FilelikeWriter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__FilelikeWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_close_filelike);
  Py_CLEAR(p->_exc_context);
  Py_CLEAR(p->error_log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__FilelikeWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  if (p->_filelike) {
    e = (*v)(p->_filelike, a); if (e) return e;
  }
  if (p->_close_filelike) {
    e = (*v)(p->_close_filelike, a); if (e) return e;
  }
  if (p->_exc_context) {
    e = (*v)(((PyObject*)p->_exc_context), a); if (e) return e;
  }
  if (p->error_log) {
    e = (*v)(((PyObject*)p->error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FilelikeWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FilelikeWriter *p = (struct __pyx_obj_4lxml_5etree__FilelikeWriter *)o;
  Py_CLEAR(p->_filelike);
  Py_CLEAR(p->_close_filelike);
  Py_CLEAR(p->_exc_context);
  Py_CLEAR(p->error_log);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FilelikeWriter[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__FilelikeWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FilelikeWriter"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FilelikeWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FilelikeWriter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FilelikeWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FilelikeWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FilelikeWriter, /*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_4lxml_5etree__FilelikeWriter, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_xmlfile(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_xmlfile *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_xmlfile *)o);
  p->output_file = Py_None; Py_INCREF(Py_None);
  p->encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_xmlfile(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_xmlfile *p = (struct __pyx_obj_4lxml_5etree_xmlfile *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->output_file);
  Py_CLEAR(p->encoding);
  Py_CLEAR(p->writer);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_xmlfile(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_xmlfile *p = (struct __pyx_obj_4lxml_5etree_xmlfile *)o;
  if (p->output_file) {
    e = (*v)(p->output_file, a); if (e) return e;
  }
  if (p->writer) {
    e = (*v)(((PyObject*)p->writer), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_xmlfile(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_xmlfile *p = (struct __pyx_obj_4lxml_5etree_xmlfile *)o;
  Py_CLEAR(p->output_file);
  Py_CLEAR(p->writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_xmlfile[] = {
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_4lxml_5etree_7xmlfile_3__enter__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_4lxml_5etree_7xmlfile_5__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_xmlfile = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.xmlfile"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_xmlfile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_xmlfile, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("xmlfile(self, output_file, encoding=None, compression=None)\n\n    A simple mechanism for incremental XML serialisation.\n\n    Usage example::\n\n         with xmlfile(\"somefile.xml\", encoding='utf-8') as xf:\n             xf.write_declaration(standalone=True)\n             xf.write_doctype('<!DOCTYPE root SYSTEM \"some.dtd\">')\n\n             # generate an element (the root element)\n             with xf.element('root'):\n                  # write a complete Element into the open root element\n                  xf.write(etree.Element('test'))\n\n                  # generate and write more Elements, e.g. through iterparse\n                  for element in generate_some_elements():\n                      # serialise generated elements into the XML file\n                      xf.write(element)\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_xmlfile, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_xmlfile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_xmlfile, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_7xmlfile_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_xmlfile, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__IncrementalFileWriter __pyx_vtable_4lxml_5etree__IncrementalFileWriter;

static PyObject *__pyx_tp_new_4lxml_5etree__IncrementalFileWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter;
  p->_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_target = ((struct __pyx_obj_4lxml_5etree__FilelikeWriter *)Py_None); Py_INCREF(Py_None);
  p->_element_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__IncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_22_IncrementalFileWriter_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_element_stack);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__IncrementalFileWriter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o;
  if (p->_target) {
    e = (*v)(((PyObject*)p->_target), a); if (e) return e;
  }
  if (p->_element_stack) {
    e = (*v)(p->_element_stack, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__IncrementalFileWriter(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *p = (struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)o;
  Py_CLEAR(p->_target);
  Py_CLEAR(p->_element_stack);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__IncrementalFileWriter[] = {
  {__Pyx_NAMESTR("write_declaration"), (PyCFunction)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_5write_declaration, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_4write_declaration)},
  {__Pyx_NAMESTR("write_doctype"), (PyCFunction)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_7write_doctype, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_6write_doctype)},
  {__Pyx_NAMESTR("element"), (PyCFunction)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_9element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_8element)},
  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_4lxml_5etree_22_IncrementalFileWriter_11write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_22_IncrementalFileWriter_10write)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__IncrementalFileWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._IncrementalFileWriter"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__IncrementalFileWriter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__IncrementalFileWriter, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__IncrementalFileWriter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__IncrementalFileWriter, /*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_4lxml_5etree__IncrementalFileWriter, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__FileWriterElement *__pyx_freelist_4lxml_5etree__FileWriterElement[8];
static int __pyx_freecount_4lxml_5etree__FileWriterElement = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__FileWriterElement(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__FileWriterElement > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__FileWriterElement[--__pyx_freecount_4lxml_5etree__FileWriterElement];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)o);
  p->_element = Py_None; Py_INCREF(Py_None);
  p->_writer = ((struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_18_FileWriterElement_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__FileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p = (struct __pyx_obj_4lxml_5etree__FileWriterElement *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element);
  Py_CLEAR(p->_writer);
  if ((__pyx_freecount_4lxml_5etree__FileWriterElement < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement))) {
    __pyx_freelist_4lxml_5etree__FileWriterElement[__pyx_freecount_4lxml_5etree__FileWriterElement++] = ((struct __pyx_obj_4lxml_5etree__FileWriterElement *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__FileWriterElement(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p = (struct __pyx_obj_4lxml_5etree__FileWriterElement *)o;
  if (p->_element) {
    e = (*v)(p->_element, a); if (e) return e;
  }
  if (p->_writer) {
    e = (*v)(((PyObject*)p->_writer), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__FileWriterElement(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__FileWriterElement *p = (struct __pyx_obj_4lxml_5etree__FileWriterElement *)o;
  Py_CLEAR(p->_element);
  Py_CLEAR(p->_writer);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__FileWriterElement[] = {
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_4lxml_5etree_18_FileWriterElement_3__enter__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__FileWriterElement = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._FileWriterElement"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__FileWriterElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__FileWriterElement, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__FileWriterElement, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__FileWriterElement, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__FileWriterElement, /*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_4lxml_5etree__FileWriterElement, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_iterparse __pyx_vtable_4lxml_5etree_iterparse;

static PyObject *__pyx_tp_new_4lxml_5etree_iterparse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_iterparse *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_iterparse *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_iterparse;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__FeedParser *)Py_None); Py_INCREF(Py_None);
  p->_tag = Py_None; Py_INCREF(Py_None);
  p->_events = Py_None; Py_INCREF(Py_None);
  p->root = Py_None; Py_INCREF(Py_None);
  p->_source = Py_None; Py_INCREF(Py_None);
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->_error = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_iterparse(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_tag);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->root);
  Py_CLEAR(p->_source);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_error);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_iterparse(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  if (p->_tag) {
    e = (*v)(p->_tag, a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->root) {
    e = (*v)(p->root, a); if (e) return e;
  }
  if (p->_source) {
    e = (*v)(p->_source, a); if (e) return e;
  }
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->_error) {
    e = (*v)(p->_error, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_iterparse(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterparse *p = (struct __pyx_obj_4lxml_5etree_iterparse *)o;
  Py_CLEAR(p->_parser);
  Py_CLEAR(p->_tag);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->root);
  Py_CLEAR(p->_source);
  Py_CLEAR(p->_filename);
  Py_CLEAR(p->_error);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_9error_log_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_resolvers(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_9resolvers_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_7version_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_9iterparse_root(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_9iterparse_4root_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterparse[] = {
  {__Pyx_NAMESTR("set_element_class_lookup"), (PyCFunction)__pyx_pw_4lxml_5etree_9iterparse_3set_element_class_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9iterparse_2set_element_class_lookup)},
  {__Pyx_NAMESTR("makeelement"), (PyCFunction)__pyx_pw_4lxml_5etree_9iterparse_5makeelement, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9iterparse_4makeelement)},
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_9iterparse_9__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_iterparse[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_9iterparse_error_log, 0, __Pyx_DOCSTR(__pyx_k_The_error_log_of_the_last_or_cur_2), 0},
  {(char *)"resolvers", __pyx_getprop_4lxml_5etree_9iterparse_resolvers, 0, __Pyx_DOCSTR(__pyx_k_The_custom_resolver_registry_of_2), 0},
  {(char *)"version", __pyx_getprop_4lxml_5etree_9iterparse_version, 0, __Pyx_DOCSTR(__pyx_k_The_version_of_the_underlying_XM), 0},
  {(char *)"root", __pyx_getprop_4lxml_5etree_9iterparse_root, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_iterparse = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.iterparse"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_iterparse), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_iterparse, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("iterparse(self, source, events=(\"end\",), tag=None,                   attribute_defaults=False, dtd_validation=False,                   load_dtd=False, no_network=True, remove_blank_text=False,                   remove_comments=False, remove_pis=False, encoding=None,                   html=False, recover=None, huge_tree=False, schema=None)\n\n    Incremental parser.\n\n    Parses XML into a tree and generates tuples (event, element) in a\n    SAX-like fashion. ``event`` is any of 'start', 'end', 'start-ns',\n    'end-ns'.\n\n    For 'start' and 'end', ``element`` is the Element that the parser just\n    found opening or closing.  For 'start-ns', it is a tuple (prefix, URI) of\n    a new namespace declaration.  For 'end-ns', it is simply None.  Note that\n    all start and end events are guaranteed to be properly nested.\n\n    The keyword argument ``events`` specifies a sequence of event type names\n    that should be generated.  By default, only 'end' events will be\n    generated.\n\n    The additional ``tag`` argument restricts the 'start' and 'end' events to\n    those elements that match the given tag.  By default, events are generated\n    for all elements.  Note that the 'start-ns' and 'end-ns' events are not\n    impacted by this restriction.\n\n    The other keyword arguments in the constructor are mainly based on the\n    libxml2 parser configuration.  A DTD will also be loaded if validation or\n    attribute default values are requested.\n\n    Available boolean keyword arguments:\n     - attribute_defaults: read default attributes from DTD\n     - dtd_validation: validate (if DTD is available)\n     - load_dtd: use DTD for parsing\n     - no_network: prevent network access for related files\n     - remove_blank_text: discard blank text nodes\n     - remove_comments: discard comments\n     - remove_pis: discard processing instructions\n     - strip_cdata: replace CDATA sections by normal text content (default: True)\n     - compact: safe memory for short text content (default: True)\n     - resolve_entities: replace entities by their text value (default: True)\n     - huge_tree: disable security restrictions and support very deep trees\n                  and very long text content (only affects libxml2 2.7+)\n     - html: parse input as HTML (default: XML)\n     - recover: try hard to parse through broken input (default: True for HTML,\n                False otherwise)\n\n    Other keyword arguments:\n     - encoding: override the document encoding\n     - schema: an XMLSchema to validate against\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_iterparse, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_iterparse, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_9iterparse_7__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_9iterparse_9__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_iterparse, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_iterparse, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_9iterparse_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_iterparse, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_iterwalk __pyx_vtable_4lxml_5etree_iterwalk;

static PyObject *__pyx_tp_new_4lxml_5etree_iterwalk(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_iterwalk *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_iterwalk;
  p->_matcher = ((struct __pyx_obj_4lxml_5etree__MultiTagMatcher *)Py_None); Py_INCREF(Py_None);
  p->_node_stack = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_events = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_pop_event = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_iterwalk(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_matcher);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_pop_event);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_iterwalk(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  if (p->_matcher) {
    e = (*v)(((PyObject*)p->_matcher), a); if (e) return e;
  }
  if (p->_node_stack) {
    e = (*v)(p->_node_stack, a); if (e) return e;
  }
  if (p->_events) {
    e = (*v)(p->_events, a); if (e) return e;
  }
  if (p->_pop_event) {
    e = (*v)(p->_pop_event, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_iterwalk(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_iterwalk *p = (struct __pyx_obj_4lxml_5etree_iterwalk *)o;
  Py_CLEAR(p->_matcher);
  Py_CLEAR(p->_node_stack);
  Py_CLEAR(p->_events);
  Py_CLEAR(p->_pop_event);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_iterwalk[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4lxml_5etree_8iterwalk_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_iterwalk = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.iterwalk"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_iterwalk), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_iterwalk, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("iterwalk(self, element_or_tree, events=(\"end\",), tag=None)\n\n    A tree walker that generates events from an existing tree as if it\n    was parsing XML data with ``iterparse()``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_iterwalk, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_iterwalk, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_8iterwalk_3__iter__, /*tp_iter*/
  __pyx_pw_4lxml_5etree_8iterwalk_5__next__, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_iterwalk, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_8iterwalk_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_iterwalk, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__IDDict __pyx_vtable_4lxml_5etree__IDDict;

static PyObject *__pyx_tp_new_4lxml_5etree__IDDict(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__IDDict *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__IDDict *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__IDDict;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_keys = Py_None; Py_INCREF(Py_None);
  p->_items = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_7_IDDict_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__IDDict(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_keys);
  Py_CLEAR(p->_items);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__IDDict(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_keys) {
    e = (*v)(p->_keys, a); if (e) return e;
  }
  if (p->_items) {
    e = (*v)(p->_items, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__IDDict(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__IDDict *p = (struct __pyx_obj_4lxml_5etree__IDDict *)o;
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_keys);
  Py_CLEAR(p->_items);
  return 0;
}
static PyObject *__pyx_sq_item_4lxml_5etree__IDDict(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 PyMethodDef __pyx_methods_4lxml_5etree__IDDict[] = {
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_3copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_7get, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_11has_key, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_15keys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_19iterkeys, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_23items, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_25iteritems, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_27values, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pw_4lxml_5etree_7_IDDict_29itervalues, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence__IDDict = {
  __pyx_pw_4lxml_5etree_7_IDDict_21__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_4lxml_5etree__IDDict, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_4lxml_5etree_7_IDDict_9__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__IDDict = {
  __pyx_pw_4lxml_5etree_7_IDDict_21__len__, /*mp_length*/
  __pyx_pw_4lxml_5etree_7_IDDict_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_4lxml_5etree__IDDict = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._IDDict"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__IDDict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__IDDict, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_7_IDDict_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence__IDDict, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__IDDict, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("IDDict(self, etree)\n    A dictionary-like proxy class that mapps ID attributes to elements.\n\n    The dictionary must be instantiated with the root element of a parsed XML\n    document, otherwise the behaviour is undefined.  Elements and XML trees\n    that were created or modified 'by hand' are not supported.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__IDDict, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__IDDict, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_4lxml_5etree_7_IDDict_17__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__IDDict, /*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_4lxml_5etree__IDDict, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree_XInclude(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XInclude *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XInclude *)o);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XInclude(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_error_log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XInclude(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XInclude(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XInclude *p = (struct __pyx_obj_4lxml_5etree_XInclude *)o;
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_8XInclude_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_8XInclude_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XInclude[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XInclude[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_8XInclude_error_log, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XInclude = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XInclude"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XInclude), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XInclude, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_8XInclude_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XInclude(self)\n    XInclude processor.\n\n    Create an instance and call it on an Element to run XInclude\n    processing.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XInclude, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XInclude, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XInclude, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XInclude, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_8XInclude_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XInclude, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__ExsltRegExp __pyx_vtable_4lxml_5etree__ExsltRegExp;

static PyObject *__pyx_tp_new_4lxml_5etree__ExsltRegExp(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__ExsltRegExp;
  p->_compile_map = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_12_ExsltRegExp_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ExsltRegExp(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_compile_map);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ExsltRegExp(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  if (p->_compile_map) {
    e = (*v)(p->_compile_map, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ExsltRegExp(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ExsltRegExp *p = (struct __pyx_obj_4lxml_5etree__ExsltRegExp *)o;
  Py_CLEAR(p->_compile_map);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__ExsltRegExp[] = {
  {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ExsltRegExp_3test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("match"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ExsltRegExp_5match, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("replace"), (PyCFunction)__pyx_pw_4lxml_5etree_12_ExsltRegExp_7replace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ExsltRegExp = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ExsltRegExp"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ExsltRegExp), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ExsltRegExp, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ExsltRegExp, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ExsltRegExp, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ExsltRegExp, /*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_4lxml_5etree__ExsltRegExp, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__BaseContext __pyx_vtable_4lxml_5etree__BaseContext;

static PyObject *__pyx_tp_new_4lxml_5etree__BaseContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__BaseContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__BaseContext;
  p->_doc = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  p->_extensions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_global_namespaces = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_utf_refs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_function_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_eval_context_dict = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_temp_refs = ((struct __pyx_obj_4lxml_5etree__TempStore *)Py_None); Py_INCREF(Py_None);
  p->_temp_documents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_exc = ((struct __pyx_obj_4lxml_5etree__ExceptionContext *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_12_BaseContext_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__BaseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_extensions);
  Py_CLEAR(p->_namespaces);
  Py_CLEAR(p->_global_namespaces);
  Py_CLEAR(p->_utf_refs);
  Py_CLEAR(p->_function_cache);
  Py_CLEAR(p->_eval_context_dict);
  Py_CLEAR(p->_temp_refs);
  Py_CLEAR(p->_temp_documents);
  Py_CLEAR(p->_exc);
  Py_CLEAR(p->_error_log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__BaseContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  if (p->_doc) {
    e = (*v)(((PyObject*)p->_doc), a); if (e) return e;
  }
  if (p->_extensions) {
    e = (*v)(p->_extensions, a); if (e) return e;
  }
  if (p->_namespaces) {
    e = (*v)(p->_namespaces, a); if (e) return e;
  }
  if (p->_global_namespaces) {
    e = (*v)(p->_global_namespaces, a); if (e) return e;
  }
  if (p->_utf_refs) {
    e = (*v)(p->_utf_refs, a); if (e) return e;
  }
  if (p->_function_cache) {
    e = (*v)(p->_function_cache, a); if (e) return e;
  }
  if (p->_eval_context_dict) {
    e = (*v)(p->_eval_context_dict, a); if (e) return e;
  }
  if (p->_temp_refs) {
    e = (*v)(((PyObject*)p->_temp_refs), a); if (e) return e;
  }
  if (p->_temp_documents) {
    e = (*v)(p->_temp_documents, a); if (e) return e;
  }
  if (p->_exc) {
    e = (*v)(((PyObject*)p->_exc), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__BaseContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__BaseContext *p = (struct __pyx_obj_4lxml_5etree__BaseContext *)o;
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->_extensions);
  Py_CLEAR(p->_namespaces);
  Py_CLEAR(p->_global_namespaces);
  Py_CLEAR(p->_utf_refs);
  Py_CLEAR(p->_function_cache);
  Py_CLEAR(p->_eval_context_dict);
  Py_CLEAR(p->_temp_refs);
  Py_CLEAR(p->_temp_documents);
  Py_CLEAR(p->_exc);
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_12_BaseContext_context_node(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_BaseContext_12context_node_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_12_BaseContext_eval_context(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_12_BaseContext_12eval_context_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__BaseContext[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__BaseContext[] = {
  {(char *)"context_node", __pyx_getprop_4lxml_5etree_12_BaseContext_context_node, 0, 0, 0},
  {(char *)"eval_context", __pyx_getprop_4lxml_5etree_12_BaseContext_eval_context, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__BaseContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._BaseContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__BaseContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__BaseContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__BaseContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__BaseContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__BaseContext, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__BaseContext, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_12_BaseContext_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__BaseContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__ElementUnicodeResult(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p;
  PyObject *o = (&PyUnicode_Type)->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o);
  p->_parent = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  p->attrname = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->attrname);
  #if CYTHON_COMPILING_IN_CPYTHON
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  (&PyUnicode_Type)->tp_dealloc(o);
}

static int __pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  if (!(&PyUnicode_Type)->tp_traverse); else { e = (&PyUnicode_Type)->tp_traverse(o,v,a); if (e) return e; }
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  if (p->attrname) {
    e = (*v)(p->attrname, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__ElementUnicodeResult(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *p = (struct __pyx_obj_4lxml_5etree__ElementUnicodeResult *)o;
  if (!(&PyUnicode_Type)->tp_clear); else (&PyUnicode_Type)->tp_clear(o);
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->attrname);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_8attrname_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_tail_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_7is_text_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_21_ElementUnicodeResult_12is_attribute_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__ElementUnicodeResult[] = {
  {__Pyx_NAMESTR("getparent"), (PyCFunction)__pyx_pw_4lxml_5etree_21_ElementUnicodeResult_1getparent, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__ElementUnicodeResult[] = {
  {(char *)"attrname", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_attrname, 0, 0, 0},
  {(char *)"is_tail", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_tail, 0, 0, 0},
  {(char *)"is_text", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_text, 0, 0, 0},
  {(char *)"is_attribute", __pyx_getprop_4lxml_5etree_21_ElementUnicodeResult_is_attribute, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__ElementUnicodeResult = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._ElementUnicodeResult"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__ElementUnicodeResult), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__ElementUnicodeResult, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__ElementUnicodeResult, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__ElementUnicodeResult, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__ElementUnicodeResult, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__ElementUnicodeResult, /*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_4lxml_5etree__ElementUnicodeResult, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathContext __pyx_vtable_4lxml_5etree__XPathContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseContext*)__pyx_vtabptr_4lxml_5etree__XPathContext;
  p->_variables = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_variables);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseContext(o, v, a); if (e) return e;
  if (p->_variables) {
    e = (*v)(p->_variables, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathContext *p = (struct __pyx_obj_4lxml_5etree__XPathContext *)o;
  __pyx_tp_clear_4lxml_5etree__BaseContext(o);
  Py_CLEAR(p->_variables);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__XPathContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XPathContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_13_XPathContext_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase __pyx_vtable_4lxml_5etree__XPathEvaluatorBase;

static PyObject *__pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  p->_context = ((struct __pyx_obj_4lxml_5etree__XPathContext *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_error_log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  if (p->_context) {
    e = (*v)(((PyObject*)p->_context), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *p = (struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *)o;
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_error_log);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__XPathEvaluatorBase[] = {
  {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_7evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_19_XPathEvaluatorBase_6evaluate)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XPathEvaluatorBase[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_19_XPathEvaluatorBase_error_log, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__XPathEvaluatorBase = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XPathEvaluatorBase"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XPathEvaluatorBase, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XPathEvaluatorBase, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_19_XPathEvaluatorBase_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathElementEvaluator __pyx_vtable_4lxml_5etree_XPathElementEvaluator;

static PyObject *__pyx_tp_new_4lxml_5etree_XPathElementEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  p->_element = ((struct LxmlElement *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_element);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  e = __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase(o, v, a); if (e) return e;
  if (p->_element) {
    e = (*v)(((PyObject*)p->_element), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *p = (struct __pyx_obj_4lxml_5etree_XPathElementEvaluator *)o;
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase(o);
  Py_CLEAR(p->_element);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPathElementEvaluator[] = {
  {__Pyx_NAMESTR("register_namespace"), (PyCFunction)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_3register_namespace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_2register_namespace)},
  {__Pyx_NAMESTR("register_namespaces"), (PyCFunction)__pyx_pw_4lxml_5etree_21XPathElementEvaluator_5register_namespaces, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_21XPathElementEvaluator_4register_namespaces)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XPathElementEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XPathElementEvaluator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathElementEvaluator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_21XPathElementEvaluator_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an element.\n\n    Absolute XPath expressions (starting with '/') will be evaluated against\n    the ElementTree as returned by getroottree().\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPathElementEvaluator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_21XPathElementEvaluator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPathElementEvaluator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XPathDocumentEvaluator __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;

static PyObject *__pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XPathElementEvaluator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPathDocumentEvaluator[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XPathDocumentEvaluator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XPathDocumentEvaluator"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPathDocumentEvaluator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPathElementEvaluator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XPathDocumentEvaluator(self, etree, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    Create an XPath evaluator for an ElementTree.\n\n    Additional namespace declarations can be passed with the\n    'namespace' keyword argument.  EXSLT regular expression support\n    can be disabled with the 'regexp' boolean keyword (defaults to\n    True).  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XPathElementEvaluator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree_XPathElementEvaluator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPathDocumentEvaluator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_22XPathDocumentEvaluator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPathDocumentEvaluator, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XPath __pyx_vtable_4lxml_5etree_XPath;

static PyObject *__pyx_tp_new_4lxml_5etree_XPath(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XPath *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XPath *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_XPath;
  p->_path = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_5XPath_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XPath(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XPath *p = (struct __pyx_obj_4lxml_5etree_XPath *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_5XPath_7__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_path);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__XPathEvaluatorBase(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_5XPath_path(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_5XPath_4path_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XPath[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XPath[] = {
  {(char *)"path", __pyx_getprop_4lxml_5etree_5XPath_path, 0, __Pyx_DOCSTR(__pyx_k_The_literal_XPath_expression), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XPath = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XPath"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XPath), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPath, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_5XPath_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_5XPath_5__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True)\n    A compiled XPath expression that can be called on Elements and ElementTrees.\n\n    Besides the XPath expression, you can pass prefix-namespace\n    mappings and extension functions to the constructor through the\n    keyword arguments ``namespaces`` and ``extensions``.  EXSLT\n    regular expression support can be disabled with the 'regexp'\n    boolean keyword (defaults to True).  Smart strings will be\n    returned for string results unless you pass\n    ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XPath, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XPath, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_5XPath_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XPath, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_ETXPath __pyx_vtable_4lxml_5etree_ETXPath;

static PyObject *__pyx_tp_new_4lxml_5etree_ETXPath(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_ETXPath *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_XPath(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_ETXPath *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__XPathEvaluatorBase*)__pyx_vtabptr_4lxml_5etree_ETXPath;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree_ETXPath[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_ETXPath = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.ETXPath"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_ETXPath), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XPath, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_5XPath_9__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_5XPath_5__call__, /*tp_call*/
  #else
  0, /*tp_call*/
  #endif
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ETXPath(self, path, extensions=None, regexp=True, smart_strings=True)\n    Special XPath class that supports the ElementTree {uri} notation for namespaces.\n\n    Note that this class does not accept the ``namespace`` keyword\n    argument. All namespaces must be passed as part of the path\n    string.  Smart strings will be returned for string results unless\n    you pass ``smart_strings=False``.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XPathEvaluatorBase, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XPathEvaluatorBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_ETXPath, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_7ETXPath_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_ETXPath, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResolverContext __pyx_vtable_4lxml_5etree__XSLTResolverContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResolverContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ResolverContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o);
  p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ExceptionContext*)__pyx_vtabptr_4lxml_5etree__XSLTResolverContext;
  p->_parser = ((struct __pyx_obj_4lxml_5etree__BaseParser *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parser);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ResolverContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTResolverContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ResolverContext(o, v, a); if (e) return e;
  if (p->_parser) {
    e = (*v)(((PyObject*)p->_parser), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTResolverContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResolverContext *p = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)o;
  __pyx_tp_clear_4lxml_5etree__ResolverContext(o);
  Py_CLEAR(p->_parser);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResolverContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTResolverContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResolverContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTResolverContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTResolverContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTResolverContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTResolverContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTAccessControl __pyx_vtable_4lxml_5etree_XSLTAccessControl;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLTAccessControl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLTAccessControl *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLTAccessControl;
  if (unlikely(__pyx_pw_4lxml_5etree_17XSLTAccessControl_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_17XSLTAccessControl_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17XSLTAccessControl_options(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17XSLTAccessControl_7options_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTAccessControl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLTAccessControl[] = {
  {(char *)"options", __pyx_getprop_4lxml_5etree_17XSLTAccessControl_options, 0, __Pyx_DOCSTR(__pyx_k_The_access_control_configuration), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XSLTAccessControl = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XSLTAccessControl"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTAccessControl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLTAccessControl, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_17XSLTAccessControl_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("XSLTAccessControl(self, read_file=True, write_file=True, create_dir=True, read_network=True, write_network=True)\n\n    Access control for XSLT: reading/writing files, directories and\n    network I/O.  Access to a type of resource is granted or denied by\n    passing any of the following boolean keyword arguments.  All of\n    them default to True to allow access.\n\n    - read_file\n    - write_file\n    - create_dir\n    - read_network\n    - write_network\n\n    For convenience, there is also a class member `DENY_ALL` that\n    provides an XSLTAccessControl instance that is readily configured\n    to deny everything, and a `DENY_WRITE` member that denies all\n    write access but allows read access.\n\n    See `XSLT`.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLTAccessControl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XSLTAccessControl, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_17XSLTAccessControl_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLTAccessControl, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTContext __pyx_vtable_4lxml_5etree__XSLTContext;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__BaseContext(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__BaseContext*)__pyx_vtabptr_4lxml_5etree__XSLTContext;
  p->_extension_element_proxy = ((struct __pyx_obj_4lxml_5etree__ReadOnlyElementProxy *)Py_None); Py_INCREF(Py_None);
  p->_extension_elements = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_12_XSLTContext_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_extension_element_proxy);
  Py_CLEAR(p->_extension_elements);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__BaseContext(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  e = __pyx_tp_traverse_4lxml_5etree__BaseContext(o, v, a); if (e) return e;
  if (p->_extension_element_proxy) {
    e = (*v)(((PyObject*)p->_extension_element_proxy), a); if (e) return e;
  }
  if (p->_extension_elements) {
    e = (*v)(p->_extension_elements, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTContext(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTContext *p = (struct __pyx_obj_4lxml_5etree__XSLTContext *)o;
  __pyx_tp_clear_4lxml_5etree__BaseContext(o);
  Py_CLEAR(p->_extension_element_proxy);
  Py_CLEAR(p->_extension_elements);
  return 0;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTContext[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTContext"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTContext, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTContext, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_12_XSLTContext_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTContext, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[8];
static int __pyx_freecount_4lxml_5etree__XSLTQuotedStringParam = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTQuotedStringParam(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[--__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o);
  p->strval = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_22_XSLTQuotedStringParam_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *p = (struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o;
  Py_CLEAR(p->strval);
  if ((__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam))) {
    __pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam++] = ((struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTQuotedStringParam[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTQuotedStringParam = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTQuotedStringParam"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTQuotedStringParam), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTQuotedStringParam, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  __Pyx_DOCSTR("A wrapper class for literal XSLT string parameters that require\n    quote escaping.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTQuotedStringParam, /*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_4lxml_5etree__XSLTQuotedStringParam, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLT __pyx_vtable_4lxml_5etree_XSLT;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLT *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLT *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLT;
  p->_context = ((struct __pyx_obj_4lxml_5etree__XSLTContext *)Py_None); Py_INCREF(Py_None);
  p->_xslt_resolver_context = ((struct __pyx_obj_4lxml_5etree__XSLTResolverContext *)Py_None); Py_INCREF(Py_None);
  p->_access_control = ((struct __pyx_obj_4lxml_5etree_XSLTAccessControl *)Py_None); Py_INCREF(Py_None);
  p->_error_log = ((struct __pyx_obj_4lxml_5etree__ErrorLog *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_4XSLT_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLT(PyObject *o) {
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_4XSLT_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_context);
  Py_CLEAR(p->_xslt_resolver_context);
  Py_CLEAR(p->_access_control);
  Py_CLEAR(p->_error_log);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_4lxml_5etree_XSLT(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree_XSLT *p = (struct __pyx_obj_4lxml_5etree_XSLT *)o;
  if (p->_context) {
    e = (*v)(((PyObject*)p->_context), a); if (e) return e;
  }
  if (p->_xslt_resolver_context) {
    e = (*v)(((PyObject*)p->_xslt_resolver_context), a); if (e) return e;
  }
  if (p->_access_control) {
    e = (*v)(((PyObject*)p->_access_control), a); if (e) return e;
  }
  if (p->_error_log) {
    e = (*v)(((PyObject*)p->_error_log), a); if (e) return e;
  }
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_4XSLT_error_log(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_4XSLT_9error_log_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLT[] = {
  {__Pyx_NAMESTR("strparam"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_7strparam, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_6strparam)},
  {__Pyx_NAMESTR("set_global_max_depth"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_9set_global_max_depth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_8set_global_max_depth)},
  {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_11apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_10apply)},
  {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_13tostring, METH_O, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_4XSLT_12tostring)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_15__deepcopy__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_4lxml_5etree_4XSLT_17__copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_XSLT[] = {
  {(char *)"error_log", __pyx_getprop_4lxml_5etree_4XSLT_error_log, 0, __Pyx_DOCSTR(__pyx_k_The_log_of_errors_and_warnings_o), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XSLT = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XSLT"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLT), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLT, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_4XSLT_19__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)\n\n    Turn an XSL document into an XSLT object.\n\n    Calling this object on a tree or Element will execute the XSLT::\n\n        transform = etree.XSLT(xsl_tree)\n        result = transform(xml_tree)\n\n    Keyword arguments of the constructor:\n\n    - extensions: a dict mapping ``(namespace, name)`` pairs to\n      extension functions or extension elements\n    - regexp: enable exslt regular expression support in XPath\n      (default: True)\n    - access_control: access restrictions for network or file\n      system (see `XSLTAccessControl`)\n\n    Keyword arguments of the XSLT call:\n\n    - profile_run: enable XSLT profiling (default: False)\n\n    Other keyword arguments of the call are passed to the stylesheet\n    as parameters.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree_XSLT, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLT, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_XSLT, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_4XSLT_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_XSLT, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTResultTree __pyx_vtable_4lxml_5etree__XSLTResultTree;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTResultTree(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__ElementTree(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__ElementTree*)__pyx_vtabptr_4lxml_5etree__XSLTResultTree;
  p->_xslt = ((struct __pyx_obj_4lxml_5etree_XSLT *)Py_None); Py_INCREF(Py_None);
  p->_profile = ((struct LxmlDocument *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_4lxml_5etree_15_XSLTResultTree_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__XSLTResultTree(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_xslt);
  Py_CLEAR(p->_profile);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__ElementTree(o);
}

static int __pyx_tp_traverse_4lxml_5etree__XSLTResultTree(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  e = __pyx_tp_traverse_4lxml_5etree__ElementTree(o, v, a); if (e) return e;
  if (p->_xslt) {
    e = (*v)(((PyObject*)p->_xslt), a); if (e) return e;
  }
  if (p->_profile) {
    e = (*v)(((PyObject*)p->_profile), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__XSLTResultTree(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__XSLTResultTree *p = (struct __pyx_obj_4lxml_5etree__XSLTResultTree *)o;
  __pyx_tp_clear_4lxml_5etree__ElementTree(o);
  Py_CLEAR(p->_xslt);
  Py_CLEAR(p->_profile);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_15_XSLTResultTree_xslt_profile(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_1__get__(o);
}

static int __pyx_setprop_4lxml_5etree_15_XSLTResultTree_xslt_profile(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    PyErr_SetString(PyExc_NotImplementedError, "__set__");
    return -1;
  }
  else {
    return __pyx_pw_4lxml_5etree_15_XSLTResultTree_12xslt_profile_3__del__(o);
  }
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTResultTree[] = {
  {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_4lxml_5etree_15_XSLTResultTree_5__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__XSLTResultTree[] = {
  {(char *)"xslt_profile", __pyx_getprop_4lxml_5etree_15_XSLTResultTree_xslt_profile, __pyx_setprop_4lxml_5etree_15_XSLTResultTree_xslt_profile, __Pyx_DOCSTR(__pyx_k_Return_an_ElementTree_with_profi), 0},
  {0, 0, 0, 0, 0}
};

static PyBufferProcs __pyx_tp_as_buffer__XSLTResultTree = {
  #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
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_7__getbuffer__, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_9__releasebuffer__, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTResultTree = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTResultTree"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTResultTree), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__XSLTResultTree, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_4lxml_5etree_15_XSLTResultTree_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__XSLTResultTree, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__XSLTResultTree, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__XSLTResultTree, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTResultTree, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__XSLTResultTree, /*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_4lxml_5etree__XSLTResultTree, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree__XSLTProcessingInstruction __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;

static PyObject *__pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree_PIBase(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction *)o);
  p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree___ContentOnlyElement*)__pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction;
  return o;
}

static PyMethodDef __pyx_methods_4lxml_5etree__XSLTProcessingInstruction[] = {
  {__Pyx_NAMESTR("parseXSL"), (PyCFunction)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_1parseXSL, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_parseXSL)},
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pw_4lxml_5etree_26_XSLTProcessingInstruction_3set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_26_XSLTProcessingInstruction_2set)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__XSLTProcessingInstruction = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._XSLTProcessingInstruction"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__XSLTProcessingInstruction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__Element, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_22_ProcessingInstruction_1__repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Element, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_8_Element_41__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__XSLTProcessingInstruction, /*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*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_4lxml_5etree_6PIBase_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree__XSLTProcessingInstruction, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_XSLTExtension __pyx_vtable_4lxml_5etree_XSLTExtension;

static PyObject *__pyx_tp_new_4lxml_5etree_XSLTExtension(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree_XSLTExtension *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_XSLTExtension *)o);
  p->__pyx_vtab = __pyx_vtabptr_4lxml_5etree_XSLTExtension;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_XSLTExtension(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_XSLTExtension[] = {
  {__Pyx_NAMESTR("execute"), (PyCFunction)__pyx_pw_4lxml_5etree_13XSLTExtension_1execute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_execute)},
  {__Pyx_NAMESTR("apply_templates"), (PyCFunction)__pyx_pw_4lxml_5etree_13XSLTExtension_3apply_templates, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_2apply_templates)},
  {__Pyx_NAMESTR("process_children"), (PyCFunction)__pyx_pw_4lxml_5etree_13XSLTExtension_5process_children, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_13XSLTExtension_4process_children)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_XSLTExtension = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.XSLTExtension"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_XSLTExtension), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_XSLTExtension, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("Base class of an XSLT extension element.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_XSLTExtension, /*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_4lxml_5etree_XSLTExtension, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *__pyx_freelist_4lxml_5etree__DTDElementContentDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDElementContentDecl = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementContentDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__DTDElementContentDecl > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDElementContentDecl[--__pyx_freecount_4lxml_5etree__DTDElementContentDecl];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDElementContentDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  if ((__pyx_freecount_4lxml_5etree__DTDElementContentDecl < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl))) {
    __pyx_freelist_4lxml_5etree__DTDElementContentDecl[__pyx_freecount_4lxml_5etree__DTDElementContentDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDElementContentDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o;
  if (p->_dtd) {
    e = (*v)(((PyObject*)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDElementContentDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementContentDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_occur(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5occur_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_left(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_4left_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_right(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_5right_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDElementContentDecl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDElementContentDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_name, 0, 0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_type, 0, 0, 0},
  {(char *)"occur", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_occur, 0, 0, 0},
  {(char *)"left", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_left, 0, 0, 0},
  {(char *)"right", __pyx_getprop_4lxml_5etree_22_DTDElementContentDecl_right, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__DTDElementContentDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._DTDElementContentDecl"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementContentDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDElementContentDecl, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_22_DTDElementContentDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDElementContentDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDElementContentDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDElementContentDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDElementContentDecl, /*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_4lxml_5etree__DTDElementContentDecl, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *__pyx_freelist_4lxml_5etree__DTDAttributeDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDAttributeDecl = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__DTDAttributeDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__DTDAttributeDecl > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDAttributeDecl[--__pyx_freecount_4lxml_5etree__DTDAttributeDecl];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDAttributeDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p = (struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  if ((__pyx_freecount_4lxml_5etree__DTDAttributeDecl < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl))) {
    __pyx_freelist_4lxml_5etree__DTDAttributeDecl[__pyx_freecount_4lxml_5etree__DTDAttributeDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDAttributeDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p = (struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o;
  if (p->_dtd) {
    e = (*v)(((PyObject*)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDAttributeDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *p = (struct __pyx_obj_4lxml_5etree__DTDAttributeDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_elemname(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_8elemname_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_7default_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default_value(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_13default_value_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDAttributeDecl[] = {
  {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_3itervalues, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pw_4lxml_5etree_17_DTDAttributeDecl_6values, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDAttributeDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_name, 0, 0, 0},
  {(char *)"elemname", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_elemname, 0, 0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_prefix, 0, 0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_type, 0, 0, 0},
  {(char *)"default", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default, 0, 0, 0},
  {(char *)"default_value", __pyx_getprop_4lxml_5etree_17_DTDAttributeDecl_default_value, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__DTDAttributeDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._DTDAttributeDecl"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDAttributeDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDAttributeDecl, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_17_DTDAttributeDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDAttributeDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDAttributeDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDAttributeDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDAttributeDecl, /*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_4lxml_5etree__DTDAttributeDecl, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__DTDElementDecl *__pyx_freelist_4lxml_5etree__DTDElementDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDElementDecl = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__DTDElementDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__DTDElementDecl > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDElementDecl[--__pyx_freecount_4lxml_5etree__DTDElementDecl];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDElementDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  if ((__pyx_freecount_4lxml_5etree__DTDElementDecl < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl))) {
    __pyx_freelist_4lxml_5etree__DTDElementDecl[__pyx_freecount_4lxml_5etree__DTDElementDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDElementDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o;
  if (p->_dtd) {
    e = (*v)(((PyObject*)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDElementDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDElementDecl *p = (struct __pyx_obj_4lxml_5etree__DTDElementDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_prefix(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_6prefix_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_15_DTDElementDecl_content(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_15_DTDElementDecl_7content_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDElementDecl[] = {
  {__Pyx_NAMESTR("iterattributes"), (PyCFunction)__pyx_pw_4lxml_5etree_15_DTDElementDecl_3iterattributes, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("attributes"), (PyCFunction)__pyx_pw_4lxml_5etree_15_DTDElementDecl_6attributes, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDElementDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_name, 0, 0, 0},
  {(char *)"prefix", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_prefix, 0, 0, 0},
  {(char *)"type", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_type, 0, 0, 0},
  {(char *)"content", __pyx_getprop_4lxml_5etree_15_DTDElementDecl_content, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__DTDElementDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._DTDElementDecl"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDElementDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDElementDecl, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_15_DTDElementDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDElementDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDElementDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDElementDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDElementDecl, /*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_4lxml_5etree__DTDElementDecl, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree__DTDEntityDecl *__pyx_freelist_4lxml_5etree__DTDEntityDecl[8];
static int __pyx_freecount_4lxml_5etree__DTDEntityDecl = 0;

static PyObject *__pyx_tp_new_4lxml_5etree__DTDEntityDecl(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p;
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree__DTDEntityDecl > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDEntityDecl[--__pyx_freecount_4lxml_5etree__DTDEntityDecl];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o);
  p->_dtd = ((struct __pyx_obj_4lxml_5etree_DTD *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__DTDEntityDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p = (struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_dtd);
  if ((__pyx_freecount_4lxml_5etree__DTDEntityDecl < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl))) {
    __pyx_freelist_4lxml_5etree__DTDEntityDecl[__pyx_freecount_4lxml_5etree__DTDEntityDecl++] = ((struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree__DTDEntityDecl(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p = (struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o;
  if (p->_dtd) {
    e = (*v)(((PyObject*)p->_dtd), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree__DTDEntityDecl(PyObject *o) {
  struct __pyx_obj_4lxml_5etree__DTDEntityDecl *p = (struct __pyx_obj_4lxml_5etree__DTDEntityDecl *)o;
  Py_CLEAR(p->_dtd);
  return 0;
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_orig(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_4orig_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_14_DTDEntityDecl_content(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_14_DTDEntityDecl_7content_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__DTDEntityDecl[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree__DTDEntityDecl[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_name, 0, 0, 0},
  {(char *)"orig", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_orig, 0, 0, 0},
  {(char *)"content", __pyx_getprop_4lxml_5etree_14_DTDEntityDecl_content, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__DTDEntityDecl = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._DTDEntityDecl"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__DTDEntityDecl), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__DTDEntityDecl, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_4lxml_5etree_14_DTDEntityDecl_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__DTDEntityDecl, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__DTDEntityDecl, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__DTDEntityDecl, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree__DTDEntityDecl, /*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_4lxml_5etree__DTDEntityDecl, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_DTD __pyx_vtable_4lxml_5etree_DTD;

static PyObject *__pyx_tp_new_4lxml_5etree_DTD(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_DTD *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_DTD *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_DTD;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_DTD(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_3DTD_13__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_3DTD_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_3DTD_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_3DTD_external_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_3DTD_11external_id_1__get__(o);
}

static PyObject *__pyx_getprop_4lxml_5etree_3DTD_system_url(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4lxml_5etree_3DTD_10system_url_1__get__(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_DTD[] = {
  {__Pyx_NAMESTR("iterelements"), (PyCFunction)__pyx_pw_4lxml_5etree_3DTD_3iterelements, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("elements"), (PyCFunction)__pyx_pw_4lxml_5etree_3DTD_6elements, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("iterentities"), (PyCFunction)__pyx_pw_4lxml_5etree_3DTD_8iterentities, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("entities"), (PyCFunction)__pyx_pw_4lxml_5etree_3DTD_11entities, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4lxml_5etree_DTD[] = {
  {(char *)"name", __pyx_getprop_4lxml_5etree_3DTD_name, 0, 0, 0},
  {(char *)"external_id", __pyx_getprop_4lxml_5etree_3DTD_external_id, 0, 0, 0},
  {(char *)"system_url", __pyx_getprop_4lxml_5etree_3DTD_system_url, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_DTD = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.DTD"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_DTD), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_DTD, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_3DTD_15__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("DTD(self, file=None, external_id=None)\n    A DTD validator.\n\n    Can load from filesystem directly given a filename or file-like object.\n    Alternatively, pass the keyword parameter ``external_id`` to load from a\n    catalog.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_DTD, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4lxml_5etree_DTD, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_3DTD_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_DTD, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_RelaxNG __pyx_vtable_4lxml_5etree_RelaxNG;

static PyObject *__pyx_tp_new_4lxml_5etree_RelaxNG(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_RelaxNG *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_RelaxNG *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_RelaxNG;
  if (unlikely(__pyx_pw_4lxml_5etree_7RelaxNG_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_RelaxNG(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_7RelaxNG_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_RelaxNG[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_RelaxNG = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.RelaxNG"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_RelaxNG), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_RelaxNG, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_7RelaxNG_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("RelaxNG(self, etree=None, file=None)\n    Turn a document into a Relax NG validator.\n\n    Either pass a schema as Element or ElementTree, or pass a file or\n    filename through the ``file`` keyword argument.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_RelaxNG, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_7RelaxNG_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_RelaxNG, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_4lxml_5etree_Schematron __pyx_vtable_4lxml_5etree_Schematron;

static PyObject *__pyx_tp_new_4lxml_5etree_Schematron(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4lxml_5etree_Schematron *p;
  PyObject *o = __pyx_tp_new_4lxml_5etree__Validator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4lxml_5etree_Schematron *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lxml_5etree__Validator*)__pyx_vtabptr_4lxml_5etree_Schematron;
  if (unlikely(__pyx_pw_4lxml_5etree_10Schematron_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree_Schematron(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_4lxml_5etree_10Schematron_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_4lxml_5etree__Validator(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree_Schematron[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree_Schematron = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.Schematron"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree_Schematron), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree_Schematron, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4lxml_5etree_10Schematron_7__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Schematron(self, etree=None, file=None)\n    A Schematron validator.\n\n    Pass a root Element or an ElementTree to turn it into a validator.\n    Alternatively, pass a filename as keyword argument 'file' to parse from\n    the file system.\n\n    Schematron is a less well known, but very powerful schema language.  The main\n    idea is to use the capabilities of XPath to put restrictions on the structure\n    and the content of XML documents.  Here is a simple example::\n\n      >>> schematron = Schematron(XML('''\n      ... <schema xmlns=\"http://www.ascc.net/xml/schematron\" >\n      ...   <pattern name=\"id is the only permited attribute name\">\n      ...     <rule context=\"*\">\n      ...       <report test=\"@*[not(name()='id')]\">Attribute\n      ...         <name path=\"@*[not(name()='id')]\"/> is forbidden<name/>\n      ...       </report>\n      ...     </rule>\n      ...   </pattern>\n      ... </schema>\n      ... '''))\n\n      >>> xml = XML('''\n      ... <AAA name=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC color=\"ccc\"/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      0\n\n      >>> xml = XML('''\n      ... <AAA id=\"aaa\">\n      ...   <BBB id=\"bbb\"/>\n      ...   <CCC/>\n      ... </AAA>\n      ... ''')\n\n      >>> schematron.validate(xml)\n      1\n\n    Schematron was added to libxml2 in version 2.6.21.  Before version 2.6.32,\n    however, Schematron lacked support for error reporting other than to stderr.\n    This version is therefore required to retrieve validation warnings and\n    errors in lxml.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree__Validator, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree__Validator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree_Schematron, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4lxml_5etree_10Schematron_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree_Schematron, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_4lxml_5etree__MemDebug(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree__MemDebug(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4lxml_5etree__MemDebug[] = {
  {__Pyx_NAMESTR("bytes_used"), (PyCFunction)__pyx_pw_4lxml_5etree_9_MemDebug_1bytes_used, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_MemDebug_bytes_used)},
  {__Pyx_NAMESTR("blocks_used"), (PyCFunction)__pyx_pw_4lxml_5etree_9_MemDebug_3blocks_used, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_MemDebug_2blocks_used)},
  {__Pyx_NAMESTR("dict_size"), (PyCFunction)__pyx_pw_4lxml_5etree_9_MemDebug_5dict_size, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_MemDebug_4dict_size)},
  {__Pyx_NAMESTR("dump"), (PyCFunction)__pyx_pw_4lxml_5etree_9_MemDebug_7dump, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_MemDebug_6dump)},
  {__Pyx_NAMESTR("show"), (PyCFunction)__pyx_pw_4lxml_5etree_9_MemDebug_9show, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4lxml_5etree_9_MemDebug_8show)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4lxml_5etree__MemDebug = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree._MemDebug"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree__MemDebug), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree__MemDebug, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  __Pyx_DOCSTR("Debugging support for the memory allocation in libxml2.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4lxml_5etree__MemDebug, /*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_4lxml_5etree__MemDebug, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *__pyx_freelist_4lxml_5etree___pyx_scope_struct__itervalues[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues = 0;

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct__itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct__itervalues[--__pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct__itervalues(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if ((__pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct__itervalues[__pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct__itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree___pyx_scope_struct__itervalues(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues *)o;
  Py_CLEAR(p->__pyx_v_self);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct__itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.__pyx_scope_struct__itervalues"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct__itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct__itervalues, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct__itervalues, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree___pyx_scope_struct__itervalues, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct__itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *__pyx_freelist_4lxml_5etree___pyx_scope_struct_1_iterattributes[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes = 0;

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_1_iterattributes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_1_iterattributes[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1_iterattributes(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  if ((__pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_1_iterattributes[__pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1_iterattributes(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *)o;
  if (p->__pyx_v_node) {
    e = (*v)(((PyObject*)p->__pyx_v_node), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree___pyx_scope_struct_1_iterattributes(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes *)o;
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_1_iterattributes = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.__pyx_scope_struct_1_iterattributes"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_1_iterattributes), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_1_iterattributes, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_1_iterattributes, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree___pyx_scope_struct_1_iterattributes, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_1_iterattributes, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *__pyx_freelist_4lxml_5etree___pyx_scope_struct_2_iterelements[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements = 0;

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_2_iterelements(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_2_iterelements[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2_iterelements(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  if ((__pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_2_iterelements[__pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2_iterelements(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *)o;
  if (p->__pyx_v_node) {
    e = (*v)(((PyObject*)p->__pyx_v_node), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree___pyx_scope_struct_2_iterelements(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements *)o;
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_2_iterelements = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.__pyx_scope_struct_2_iterelements"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_2_iterelements), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_2_iterelements, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_2_iterelements, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree___pyx_scope_struct_2_iterelements, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_2_iterelements, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *__pyx_freelist_4lxml_5etree___pyx_scope_struct_3_iterentities[8];
static int __pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities = 0;

static PyObject *__pyx_tp_new_4lxml_5etree___pyx_scope_struct_3_iterentities(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((__pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities)))) {
    o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_3_iterentities[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities];
    memset(o, 0, sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3_iterentities(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  if ((__pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities))) {
    __pyx_freelist_4lxml_5etree___pyx_scope_struct_3_iterentities[__pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities++] = ((struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3_iterentities(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *)o;
  if (p->__pyx_v_node) {
    e = (*v)(((PyObject*)p->__pyx_v_node), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4lxml_5etree___pyx_scope_struct_3_iterentities(PyObject *o) {
  struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *p = (struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities *)o;
  Py_CLEAR(p->__pyx_v_node);
  Py_CLEAR(p->__pyx_v_self);
  return 0;
}

static PyTypeObject __pyx_type_4lxml_5etree___pyx_scope_struct_3_iterentities = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("lxml.etree.__pyx_scope_struct_3_iterentities"), /*tp_name*/
  sizeof(struct __pyx_obj_4lxml_5etree___pyx_scope_struct_3_iterentities), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4lxml_5etree___pyx_scope_struct_3_iterentities, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4lxml_5etree___pyx_scope_struct_3_iterentities, /*tp_traverse*/
  __pyx_tp_clear_4lxml_5etree___pyx_scope_struct_3_iterentities, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4lxml_5etree___pyx_scope_struct_3_iterentities, /*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
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    __Pyx_NAMESTR("etree"),
    __Pyx_DOCSTR(__pyx_k_The_lxml_etree_module_implements), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    (freefunc)__pyx_module_cleanup /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_0_9, __pyx_k_0_9, sizeof(__pyx_k_0_9), 0, 1, 0, 0},
  {&__pyx_n_b_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 0, 1},
  {&__pyx_n_b_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 0, 1},
  {&__pyx_n_u_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 1, 0, 1},
  {&__pyx_kp_s_A_libxml2_error_that_occurred_du, __pyx_k_A_libxml2_error_that_occurred_du, sizeof(__pyx_k_A_libxml2_error_that_occurred_du), 0, 0, 1, 0},
  {&__pyx_kp_s_All_strings_must_be_XML_compatib, __pyx_k_All_strings_must_be_XML_compatib, sizeof(__pyx_k_All_strings_must_be_XML_compatib), 0, 0, 1, 0},
  {&__pyx_kp_u_Argument_is_not_a_file_like_obje, __pyx_k_Argument_is_not_a_file_like_obje, sizeof(__pyx_k_Argument_is_not_a_file_like_obje), 0, 1, 0, 0},
  {&__pyx_kp_s_Argument_must_be_bytes_or_unicod, __pyx_k_Argument_must_be_bytes_or_unicod, sizeof(__pyx_k_Argument_must_be_bytes_or_unicod), 0, 0, 1, 0},
  {&__pyx_kp_s_Argument_must_be_string_or_unico, __pyx_k_Argument_must_be_string_or_unico, sizeof(__pyx_k_Argument_must_be_string_or_unico), 0, 0, 1, 0},
  {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeBasedElementClassLookup, __pyx_k_AttributeBasedElementClassLookup, sizeof(__pyx_k_AttributeBasedElementClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_BaseException, __pyx_k_BaseException, sizeof(__pyx_k_BaseException), 0, 0, 1, 1},
  {&__pyx_kp_s_Base_class_for_DTD_errors, __pyx_k_Base_class_for_DTD_errors, sizeof(__pyx_k_Base_class_for_DTD_errors), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_for_RelaxNG_errors, __pyx_k_Base_class_for_RelaxNG_errors, sizeof(__pyx_k_Base_class_for_RelaxNG_errors), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_for_all_syntax_errors, __pyx_k_Base_class_for_all_syntax_errors, sizeof(__pyx_k_Base_class_for_all_syntax_errors), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_of_all_Schematron_err, __pyx_k_Base_class_of_all_Schematron_err, sizeof(__pyx_k_Base_class_of_all_Schematron_err), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_of_all_XML_Schema_err, __pyx_k_Base_class_of_all_XML_Schema_err, sizeof(__pyx_k_Base_class_of_all_XML_Schema_err), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_of_all_XPath_errors, __pyx_k_Base_class_of_all_XPath_errors, sizeof(__pyx_k_Base_class_of_all_XPath_errors), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_of_all_XSLT_errors, __pyx_k_Base_class_of_all_XSLT_errors, sizeof(__pyx_k_Base_class_of_all_XSLT_errors), 0, 0, 1, 0},
  {&__pyx_kp_s_Base_class_of_lxml_registry_erro, __pyx_k_Base_class_of_lxml_registry_erro, sizeof(__pyx_k_Base_class_of_lxml_registry_erro), 0, 0, 1, 0},
  {&__pyx_n_s_BytesIO, __pyx_k_BytesIO, sizeof(__pyx_k_BytesIO), 0, 0, 1, 1},
  {&__pyx_n_s_C14NError, __pyx_k_C14NError, sizeof(__pyx_k_C14NError), 0, 0, 1, 1},
  {&__pyx_kp_u_C14N_failed, __pyx_k_C14N_failed, sizeof(__pyx_k_C14N_failed), 0, 1, 0, 0},
  {&__pyx_n_s_CDATA, __pyx_k_CDATA, sizeof(__pyx_k_CDATA), 0, 0, 1, 1},
  {&__pyx_n_s_CRITICAL, __pyx_k_CRITICAL, sizeof(__pyx_k_CRITICAL), 0, 0, 1, 1},
  {&__pyx_kp_s_Can_only_discard_comments_in_C14, __pyx_k_Can_only_discard_comments_in_C14, sizeof(__pyx_k_Can_only_discard_comments_in_C14), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_enable_XML_declaration_in, __pyx_k_Cannot_enable_XML_declaration_in, sizeof(__pyx_k_Cannot_enable_XML_declaration_in), 0, 0, 1, 0},
  {&__pyx_kp_u_Cannot_parse_stylesheet, __pyx_k_Cannot_parse_stylesheet, sizeof(__pyx_k_Cannot_parse_stylesheet), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_resolve_URI_s, __pyx_k_Cannot_resolve_URI_s, sizeof(__pyx_k_Cannot_resolve_URI_s), 0, 1, 0, 0},
  {&__pyx_kp_s_Cannot_specify_encoding_with_C14, __pyx_k_Cannot_specify_encoding_with_C14, sizeof(__pyx_k_Cannot_specify_encoding_with_C14), 0, 0, 1, 0},
  {&__pyx_kp_b_Char_out_of_XML_range, __pyx_k_Char_out_of_XML_range, sizeof(__pyx_k_Char_out_of_XML_range), 0, 0, 0, 0},
  {&__pyx_n_s_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 0, 0, 1, 1},
  {&__pyx_n_s_CommentBase, __pyx_k_CommentBase, sizeof(__pyx_k_CommentBase), 0, 0, 1, 1},
  {&__pyx_kp_u_Could_not_create_I_O_writer_cont, __pyx_k_Could_not_create_I_O_writer_cont, sizeof(__pyx_k_Could_not_create_I_O_writer_cont), 0, 1, 0, 0},
  {&__pyx_kp_u_Could_not_find_root_node, __pyx_k_Could_not_find_root_node, sizeof(__pyx_k_Could_not_find_root_node), 0, 1, 0, 0},
  {&__pyx_n_s_CustomElementClassLookup, __pyx_k_CustomElementClassLookup, sizeof(__pyx_k_CustomElementClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 0, 1, 1},
  {&__pyx_n_s_DENY_ALL, __pyx_k_DENY_ALL, sizeof(__pyx_k_DENY_ALL), 0, 0, 1, 1},
  {&__pyx_n_s_DENY_WRITE, __pyx_k_DENY_WRITE, sizeof(__pyx_k_DENY_WRITE), 0, 0, 1, 1},
  {&__pyx_kp_s_DOCTYPE_already_written_or_canno, __pyx_k_DOCTYPE_already_written_or_canno, sizeof(__pyx_k_DOCTYPE_already_written_or_canno), 0, 0, 1, 0},
  {&__pyx_kp_u_DOCTYPE_s, __pyx_k_DOCTYPE_s, sizeof(__pyx_k_DOCTYPE_s), 0, 1, 0, 0},
  {&__pyx_kp_u_DOCTYPE_s_PUBLIC_s, __pyx_k_DOCTYPE_s_PUBLIC_s, sizeof(__pyx_k_DOCTYPE_s_PUBLIC_s), 0, 1, 0, 0},
  {&__pyx_kp_u_DOCTYPE_s_PUBLIC_s_s, __pyx_k_DOCTYPE_s_PUBLIC_s_s, sizeof(__pyx_k_DOCTYPE_s_PUBLIC_s_s), 0, 1, 0, 0},
  {&__pyx_kp_u_DOCTYPE_s_SYSTEM_s, __pyx_k_DOCTYPE_s_SYSTEM_s, sizeof(__pyx_k_DOCTYPE_s_SYSTEM_s), 0, 1, 0, 0},
  {&__pyx_n_s_DTD, __pyx_k_DTD, sizeof(__pyx_k_DTD), 0, 0, 1, 1},
  {&__pyx_n_s_DTDError, __pyx_k_DTDError, sizeof(__pyx_k_DTDError), 0, 0, 1, 1},
  {&__pyx_n_s_DTDParseError, __pyx_k_DTDParseError, sizeof(__pyx_k_DTDParseError), 0, 0, 1, 1},
  {&__pyx_n_s_DTDValidateError, __pyx_k_DTDValidateError, sizeof(__pyx_k_DTDValidateError), 0, 0, 1, 1},
  {&__pyx_kp_s_DTD_not_initialised, __pyx_k_DTD_not_initialised, sizeof(__pyx_k_DTD_not_initialised), 0, 0, 1, 0},
  {&__pyx_n_s_DocumentInvalid, __pyx_k_DocumentInvalid, sizeof(__pyx_k_DocumentInvalid), 0, 0, 1, 1},
  {&__pyx_kp_u_Document_does_not_comply_with_sc, __pyx_k_Document_does_not_comply_with_sc, sizeof(__pyx_k_Document_does_not_comply_with_sc), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_Relax_NG, __pyx_k_Document_is_not_Relax_NG, sizeof(__pyx_k_Document_is_not_Relax_NG), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_XML_Schema, __pyx_k_Document_is_not_XML_Schema, sizeof(__pyx_k_Document_is_not_XML_Schema), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_a_valid_Schematr, __pyx_k_Document_is_not_a_valid_Schematr, sizeof(__pyx_k_Document_is_not_a_valid_Schematr), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_parsable_as_Rela, __pyx_k_Document_is_not_parsable_as_Rela, sizeof(__pyx_k_Document_is_not_parsable_as_Rela), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_valid_Relax_NG, __pyx_k_Document_is_not_valid_Relax_NG, sizeof(__pyx_k_Document_is_not_valid_Relax_NG), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_valid_XML_Schema, __pyx_k_Document_is_not_valid_XML_Schema, sizeof(__pyx_k_Document_is_not_valid_XML_Schema), 0, 1, 0, 0},
  {&__pyx_kp_u_Document_is_not_well_formed, __pyx_k_Document_is_not_well_formed, sizeof(__pyx_k_Document_is_not_well_formed), 0, 1, 0, 0},
  {&__pyx_n_s_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 0, 0, 1, 1},
  {&__pyx_kp_u_ERR_ENCODING_NAME_79_ERR_HYPHEN, __pyx_k_ERR_ENCODING_NAME_79_ERR_HYPHEN, sizeof(__pyx_k_ERR_ENCODING_NAME_79_ERR_HYPHEN), 0, 1, 0, 0},
  {&__pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER, __pyx_k_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER, sizeof(__pyx_k_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER), 0, 1, 0, 0},
  {&__pyx_n_s_ERR_UNDECLARED_ENTITY, __pyx_k_ERR_UNDECLARED_ENTITY, sizeof(__pyx_k_ERR_UNDECLARED_ENTITY), 0, 0, 1, 1},
  {&__pyx_n_s_ETCompatXMLParser, __pyx_k_ETCompatXMLParser, sizeof(__pyx_k_ETCompatXMLParser), 0, 0, 1, 1},
  {&__pyx_n_s_ETXPath, __pyx_k_ETXPath, sizeof(__pyx_k_ETXPath), 0, 0, 1, 1},
  {&__pyx_n_s_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 0, 1, 1},
  {&__pyx_n_s_ElementBase, __pyx_k_ElementBase, sizeof(__pyx_k_ElementBase), 0, 0, 1, 1},
  {&__pyx_n_s_ElementClassLookup, __pyx_k_ElementClassLookup, sizeof(__pyx_k_ElementClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s_ElementDefaultClassLookup, __pyx_k_ElementDefaultClassLookup, sizeof(__pyx_k_ElementDefaultClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s_ElementNamespaceClassLookup, __pyx_k_ElementNamespaceClassLookup, sizeof(__pyx_k_ElementNamespaceClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s_ElementStringResult, __pyx_k_ElementStringResult, sizeof(__pyx_k_ElementStringResult), 0, 0, 1, 1},
  {&__pyx_n_s_ElementStringResult_getparent, __pyx_k_ElementStringResult_getparent, sizeof(__pyx_k_ElementStringResult_getparent), 0, 0, 1, 1},
  {&__pyx_n_s_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 0, 0, 1, 1},
  {&__pyx_kp_u_ElementTree_not_initialized_miss, __pyx_k_ElementTree_not_initialized_miss, sizeof(__pyx_k_ElementTree_not_initialized_miss), 0, 1, 0, 0},
  {&__pyx_kp_u_Element_is_not_a_child_of_this_n, __pyx_k_Element_is_not_a_child_of_this_n, sizeof(__pyx_k_Element_is_not_a_child_of_this_n), 0, 1, 0, 0},
  {&__pyx_kp_u_Element_is_not_in_this_tree, __pyx_k_Element_is_not_in_this_tree, sizeof(__pyx_k_Element_is_not_in_this_tree), 0, 1, 0, 0},
  {&__pyx_kp_u_Element_s_at_0x_x, __pyx_k_Element_s_at_0x_x, sizeof(__pyx_k_Element_s_at_0x_x), 0, 1, 0, 0},
  {&__pyx_kp_u_Empty_tag_name, __pyx_k_Empty_tag_name, sizeof(__pyx_k_Empty_tag_name), 0, 1, 0, 0},
  {&__pyx_kp_b_Encoding_error, __pyx_k_Encoding_error, sizeof(__pyx_k_Encoding_error), 0, 0, 0, 0},
  {&__pyx_n_s_Entity, __pyx_k_Entity, sizeof(__pyx_k_Entity), 0, 0, 1, 1},
  {&__pyx_n_s_EntityBase, __pyx_k_EntityBase, sizeof(__pyx_k_EntityBase), 0, 0, 1, 1},
  {&__pyx_kp_u_Entity_class_must_be_subclass_of, __pyx_k_Entity_class_must_be_subclass_of, sizeof(__pyx_k_Entity_class_must_be_subclass_of), 0, 1, 0, 0},
  {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1},
  {&__pyx_n_s_ErrorDomains, __pyx_k_ErrorDomains, sizeof(__pyx_k_ErrorDomains), 0, 0, 1, 1},
  {&__pyx_n_s_ErrorLevels, __pyx_k_ErrorLevels, sizeof(__pyx_k_ErrorLevels), 0, 0, 1, 1},
  {&__pyx_n_s_ErrorTypes, __pyx_k_ErrorTypes, sizeof(__pyx_k_ErrorTypes), 0, 0, 1, 1},
  {&__pyx_kp_u_Error_applying_stylesheet, __pyx_k_Error_applying_stylesheet, sizeof(__pyx_k_Error_applying_stylesheet), 0, 1, 0, 0},
  {&__pyx_kp_u_Error_applying_stylesheet_line_d, __pyx_k_Error_applying_stylesheet_line_d, sizeof(__pyx_k_Error_applying_stylesheet_line_d), 0, 1, 0, 0},
  {&__pyx_kp_s_Error_during_C14N_serialisation, __pyx_k_Error_during_C14N_serialisation, sizeof(__pyx_k_Error_during_C14N_serialisation), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_during_XInclude_processing, __pyx_k_Error_during_XInclude_processing, sizeof(__pyx_k_Error_during_XInclude_processing), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_during_XPath_evaluation, __pyx_k_Error_during_XPath_evaluation, sizeof(__pyx_k_Error_during_XPath_evaluation), 0, 0, 1, 0},
  {&__pyx_kp_u_Error_during_serialisation_out_o, __pyx_k_Error_during_serialisation_out_o, sizeof(__pyx_k_Error_during_serialisation_out_o), 0, 1, 0, 0},
  {&__pyx_kp_s_Error_handling_an_XPath_result, __pyx_k_Error_handling_an_XPath_result, sizeof(__pyx_k_Error_handling_an_XPath_result), 0, 0, 1, 0},
  {&__pyx_kp_u_Error_in_xpath_expression, __pyx_k_Error_in_xpath_expression, sizeof(__pyx_k_Error_in_xpath_expression), 0, 1, 0, 0},
  {&__pyx_kp_s_Error_parsing_a_stylesheet_docum, __pyx_k_Error_parsing_a_stylesheet_docum, sizeof(__pyx_k_Error_parsing_a_stylesheet_docum), 0, 0, 1, 0},
  {&__pyx_kp_u_Error_reading_file_s_s, __pyx_k_Error_reading_file_s_s, sizeof(__pyx_k_Error_reading_file_s_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Error_reading_s, __pyx_k_Error_reading_s, sizeof(__pyx_k_Error_reading_s), 0, 1, 0, 0},
  {&__pyx_kp_s_Error_registering_a_namespace_ex, __pyx_k_Error_registering_a_namespace_ex, sizeof(__pyx_k_Error_registering_a_namespace_ex), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_registering_an_XSLT_extens, __pyx_k_Error_registering_an_XSLT_extens, sizeof(__pyx_k_Error_registering_an_XSLT_extens), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_running_an_XSL_transformat, __pyx_k_Error_running_an_XSL_transformat, sizeof(__pyx_k_Error_running_an_XSL_transformat), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_serialising_an_XSLT_result, __pyx_k_Error_serialising_an_XSLT_result, sizeof(__pyx_k_Error_serialising_an_XSLT_result), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_parsing_a_DTD, __pyx_k_Error_while_parsing_a_DTD, sizeof(__pyx_k_Error_while_parsing_a_DTD), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_parsing_an_XML_docum, __pyx_k_Error_while_parsing_an_XML_docum, sizeof(__pyx_k_Error_while_parsing_an_XML_docum), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_parsing_an_XML_docum_2, __pyx_k_Error_while_parsing_an_XML_docum_2, sizeof(__pyx_k_Error_while_parsing_an_XML_docum_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_parsing_an_XML_docum_3, __pyx_k_Error_while_parsing_an_XML_docum_3, sizeof(__pyx_k_Error_while_parsing_an_XML_docum_3), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_validating_an_XML_do, __pyx_k_Error_while_validating_an_XML_do, sizeof(__pyx_k_Error_while_validating_an_XML_do), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_validating_an_XML_do_2, __pyx_k_Error_while_validating_an_XML_do_2, sizeof(__pyx_k_Error_while_validating_an_XML_do_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_validating_an_XML_do_3, __pyx_k_Error_while_validating_an_XML_do_3, sizeof(__pyx_k_Error_while_validating_an_XML_do_3), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_while_validating_an_XML_do_4, __pyx_k_Error_while_validating_an_XML_do_4, sizeof(__pyx_k_Error_while_validating_an_XML_do_4), 0, 0, 1, 0},
  {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  {&__pyx_kp_b_Expected_for_variable_reference, __pyx_k_Expected_for_variable_reference, sizeof(__pyx_k_Expected_for_variable_reference), 0, 0, 0, 0},
  {&__pyx_n_s_Extension, __pyx_k_Extension, sizeof(__pyx_k_Extension), 0, 0, 1, 1},
  {&__pyx_n_s_FATAL, __pyx_k_FATAL, sizeof(__pyx_k_FATAL), 0, 0, 1, 1},
  {&__pyx_kp_s_Failed_to_create_file_s, __pyx_k_Failed_to_create_file_s, sizeof(__pyx_k_Failed_to_create_file_s), 0, 0, 1, 0},
  {&__pyx_kp_u_Failed_to_create_validation_cont, __pyx_k_Failed_to_create_validation_cont, sizeof(__pyx_k_Failed_to_create_validation_cont), 0, 1, 0, 0},
  {&__pyx_n_s_FallbackElementClassLookup, __pyx_k_FallbackElementClassLookup, sizeof(__pyx_k_FallbackElementClassLookup), 0, 0, 1, 1},
  {&__pyx_kp_u_File_is_already_closed, __pyx_k_File_is_already_closed, sizeof(__pyx_k_File_is_already_closed), 0, 1, 0, 0},
  {&__pyx_kp_u_File_or_filename_expected_got_s, __pyx_k_File_or_filename_expected_got_s, sizeof(__pyx_k_File_or_filename_expected_got_s), 0, 1, 0, 0},
  {&__pyx_n_s_FunctionNamespace, __pyx_k_FunctionNamespace, sizeof(__pyx_k_FunctionNamespace), 0, 0, 1, 1},
  {&__pyx_kp_u_FunctionNamespace_r, __pyx_k_FunctionNamespace_r, sizeof(__pyx_k_FunctionNamespace_r), 0, 1, 0, 0},
  {&__pyx_n_s_FutureWarning, __pyx_k_FutureWarning, sizeof(__pyx_k_FutureWarning), 0, 0, 1, 1},
  {&__pyx_n_u_GlobalErrorLog, __pyx_k_GlobalErrorLog, sizeof(__pyx_k_GlobalErrorLog), 0, 1, 0, 1},
  {&__pyx_n_s_GzipFile, __pyx_k_GzipFile, sizeof(__pyx_k_GzipFile), 0, 0, 1, 1},
  {&__pyx_n_s_HTML, __pyx_k_HTML, sizeof(__pyx_k_HTML), 0, 0, 1, 1},
  {&__pyx_n_s_HTMLParser, __pyx_k_HTMLParser, sizeof(__pyx_k_HTMLParser), 0, 0, 1, 1},
  {&__pyx_kp_u_I18N_NO_OUTPUT_6004_BUF_OVERFLOW, __pyx_k_I18N_NO_OUTPUT_6004_BUF_OVERFLOW, sizeof(__pyx_k_I18N_NO_OUTPUT_6004_BUF_OVERFLOW), 0, 1, 0, 0},
  {&__pyx_kp_u_ID_attribute_not_found, __pyx_k_ID_attribute_not_found, sizeof(__pyx_k_ID_attribute_not_found), 0, 1, 0, 0},
  {&__pyx_n_s_IGNORECASE, __pyx_k_IGNORECASE, sizeof(__pyx_k_IGNORECASE), 0, 0, 1, 1},
  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
  {&__pyx_kp_s_Illegal_Unicode_kind_d, __pyx_k_Illegal_Unicode_kind_d, sizeof(__pyx_k_Illegal_Unicode_kind_d), 0, 0, 1, 0},
  {&__pyx_n_s_ImmutableMapping, __pyx_k_ImmutableMapping, sizeof(__pyx_k_ImmutableMapping), 0, 0, 1, 1},
  {&__pyx_n_s_ImmutableMapping___contains, __pyx_k_ImmutableMapping___contains, sizeof(__pyx_k_ImmutableMapping___contains), 0, 0, 1, 1},
  {&__pyx_n_s_ImmutableMapping___delitem, __pyx_k_ImmutableMapping___delitem, sizeof(__pyx_k_ImmutableMapping___delitem), 0, 0, 1, 1},
  {&__pyx_n_s_ImmutableMapping___getitem, __pyx_k_ImmutableMapping___getitem, sizeof(__pyx_k_ImmutableMapping___getitem), 0, 0, 1, 1},
  {&__pyx_n_s_ImmutableMapping___iter, __pyx_k_ImmutableMapping___iter, sizeof(__pyx_k_ImmutableMapping___iter), 0, 0, 1, 1},
  {&__pyx_n_s_ImmutableMapping___len, __pyx_k_ImmutableMapping___len, sizeof(__pyx_k_ImmutableMapping___len), 0, 0, 1, 1},
  {&__pyx_n_s_ImmutableMapping___setitem, __pyx_k_ImmutableMapping___setitem, sizeof(__pyx_k_ImmutableMapping___setitem), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_u_Input_object_has_no_document_s, __pyx_k_Input_object_has_no_document_s, sizeof(__pyx_k_Input_object_has_no_document_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Input_object_has_no_element_s, __pyx_k_Input_object_has_no_element_s, sizeof(__pyx_k_Input_object_has_no_element_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_error_in_DTD_validation, __pyx_k_Internal_error_in_DTD_validation, sizeof(__pyx_k_Internal_error_in_DTD_validation), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_error_in_Relax_NG_valid, __pyx_k_Internal_error_in_Relax_NG_valid, sizeof(__pyx_k_Internal_error_in_Relax_NG_valid), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_error_in_Schematron_val, __pyx_k_Internal_error_in_Schematron_val, sizeof(__pyx_k_Internal_error_in_Schematron_val), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_error_in_XML_Schema_val, __pyx_k_Internal_error_in_XML_Schema_val, sizeof(__pyx_k_Internal_error_in_XML_Schema_val), 0, 1, 0, 0},
  {&__pyx_kp_s_Internal_error_looking_up_an_XPa, __pyx_k_Internal_error_looking_up_an_XPa, sizeof(__pyx_k_Internal_error_looking_up_an_XPa), 0, 0, 1, 0},
  {&__pyx_kp_s_Internal_lxml_parser_error, __pyx_k_Internal_lxml_parser_error, sizeof(__pyx_k_Internal_lxml_parser_error), 0, 0, 1, 0},
  {&__pyx_kp_u_Invalid_HTML_tag_name_r, __pyx_k_Invalid_HTML_tag_name_r, sizeof(__pyx_k_Invalid_HTML_tag_name_r), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_URL_must_not_contain_or, __pyx_k_Invalid_URL_must_not_contain_or, sizeof(__pyx_k_Invalid_URL_must_not_contain_or), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_attribute_dictionary_s, __pyx_k_Invalid_attribute_dictionary_s, sizeof(__pyx_k_Invalid_attribute_dictionary_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_attribute_name_r, __pyx_k_Invalid_attribute_name_r, sizeof(__pyx_k_Invalid_attribute_name_r), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_character_reference_s, __pyx_k_Invalid_character_reference_s, sizeof(__pyx_k_Invalid_character_reference_s), 0, 1, 0, 0},
  {&__pyx_kp_s_Invalid_child_type_r, __pyx_k_Invalid_child_type_r, sizeof(__pyx_k_Invalid_child_type_r), 0, 0, 1, 0},
  {&__pyx_kp_b_Invalid_context_position, __pyx_k_Invalid_context_position, sizeof(__pyx_k_Invalid_context_position), 0, 0, 0, 0},
  {&__pyx_kp_b_Invalid_context_size, __pyx_k_Invalid_context_size, sizeof(__pyx_k_Invalid_context_size), 0, 0, 0, 0},
  {&__pyx_kp_u_Invalid_entity_name_s, __pyx_k_Invalid_entity_name_s, sizeof(__pyx_k_Invalid_entity_name_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_entity_reference_s, __pyx_k_Invalid_entity_reference_s, sizeof(__pyx_k_Invalid_entity_reference_s), 0, 1, 0, 0},
  {&__pyx_kp_b_Invalid_expression, __pyx_k_Invalid_expression, sizeof(__pyx_k_Invalid_expression), 0, 0, 0, 0},
  {&__pyx_kp_u_Invalid_input_object_s, __pyx_k_Invalid_input_object_s, sizeof(__pyx_k_Invalid_input_object_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_input_tag_of_type_r, __pyx_k_Invalid_input_tag_of_type_r, sizeof(__pyx_k_Invalid_input_tag_of_type_r), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_namespace_URI_r, __pyx_k_Invalid_namespace_URI_r, sizeof(__pyx_k_Invalid_namespace_URI_r), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_namespace_prefix_r, __pyx_k_Invalid_namespace_prefix_r, sizeof(__pyx_k_Invalid_namespace_prefix_r), 0, 1, 0, 0},
  {&__pyx_kp_b_Invalid_number_of_arguments, __pyx_k_Invalid_number_of_arguments, sizeof(__pyx_k_Invalid_number_of_arguments), 0, 0, 0, 0},
  {&__pyx_kp_b_Invalid_operand, __pyx_k_Invalid_operand, sizeof(__pyx_k_Invalid_operand), 0, 0, 0, 0},
  {&__pyx_kp_b_Invalid_or_incomplete_context, __pyx_k_Invalid_or_incomplete_context, sizeof(__pyx_k_Invalid_or_incomplete_context), 0, 0, 0, 0},
  {&__pyx_kp_b_Invalid_predicate, __pyx_k_Invalid_predicate, sizeof(__pyx_k_Invalid_predicate), 0, 0, 0, 0},
  {&__pyx_kp_u_Invalid_tag_name, __pyx_k_Invalid_tag_name, sizeof(__pyx_k_Invalid_tag_name), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_tag_name_r, __pyx_k_Invalid_tag_name_r, sizeof(__pyx_k_Invalid_tag_name_r), 0, 1, 0, 0},
  {&__pyx_kp_b_Invalid_type, __pyx_k_Invalid_type, sizeof(__pyx_k_Invalid_type), 0, 0, 0, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_LIBXML_COMPILED_VERSION, __pyx_k_LIBXML_COMPILED_VERSION, sizeof(__pyx_k_LIBXML_COMPILED_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_LIBXML_VERSION, __pyx_k_LIBXML_VERSION, sizeof(__pyx_k_LIBXML_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_LIBXSLT_COMPILED_VERSION, __pyx_k_LIBXSLT_COMPILED_VERSION, sizeof(__pyx_k_LIBXSLT_COMPILED_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_LIBXSLT_VERSION, __pyx_k_LIBXSLT_VERSION, sizeof(__pyx_k_LIBXSLT_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_LXML_VERSION, __pyx_k_LXML_VERSION, sizeof(__pyx_k_LXML_VERSION), 0, 0, 1, 1},
  {&__pyx_kp_s_Libxml2_RelaxNG_error_types, __pyx_k_Libxml2_RelaxNG_error_types, sizeof(__pyx_k_Libxml2_RelaxNG_error_types), 0, 0, 1, 0},
  {&__pyx_kp_s_Libxml2_error_domains, __pyx_k_Libxml2_error_domains, sizeof(__pyx_k_Libxml2_error_domains), 0, 0, 1, 0},
  {&__pyx_kp_s_Libxml2_error_levels, __pyx_k_Libxml2_error_levels, sizeof(__pyx_k_Libxml2_error_levels), 0, 0, 1, 0},
  {&__pyx_kp_s_Libxml2_error_types, __pyx_k_Libxml2_error_types, sizeof(__pyx_k_Libxml2_error_types), 0, 0, 1, 0},
  {&__pyx_n_s_LookupError, __pyx_k_LookupError, sizeof(__pyx_k_LookupError), 0, 0, 1, 1},
  {&__pyx_n_s_LxmlError, __pyx_k_LxmlError, sizeof(__pyx_k_LxmlError), 0, 0, 1, 1},
  {&__pyx_n_s_LxmlError___init, __pyx_k_LxmlError___init, sizeof(__pyx_k_LxmlError___init), 0, 0, 1, 1},
  {&__pyx_n_s_LxmlRegistryError, __pyx_k_LxmlRegistryError, sizeof(__pyx_k_LxmlRegistryError), 0, 0, 1, 1},
  {&__pyx_n_s_LxmlSyntaxError, __pyx_k_LxmlSyntaxError, sizeof(__pyx_k_LxmlSyntaxError), 0, 0, 1, 1},
  {&__pyx_kp_s_Main_exception_base_class_for_lx, __pyx_k_Main_exception_base_class_for_lx, sizeof(__pyx_k_Main_exception_base_class_for_lx), 0, 0, 1, 0},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_kp_b_Memory_allocation_error, __pyx_k_Memory_allocation_error, sizeof(__pyx_k_Memory_allocation_error), 0, 0, 0, 0},
  {&__pyx_kp_b_Missing_closing_curly_brace, __pyx_k_Missing_closing_curly_brace, sizeof(__pyx_k_Missing_closing_curly_brace), 0, 0, 0, 0},
  {&__pyx_n_s_MutableMapping, __pyx_k_MutableMapping, sizeof(__pyx_k_MutableMapping), 0, 0, 1, 1},
  {&__pyx_n_s_MutableMapping_keys, __pyx_k_MutableMapping_keys, sizeof(__pyx_k_MutableMapping_keys), 0, 0, 1, 1},
  {&__pyx_n_s_NAMESPACE, __pyx_k_NAMESPACE, sizeof(__pyx_k_NAMESPACE), 0, 0, 1, 1},
  {&__pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE, __pyx_k_NONE_0_PARSER_1_TREE_2_NAMESPACE, sizeof(__pyx_k_NONE_0_PARSER_1_TREE_2_NAMESPACE), 0, 1, 0, 0},
  {&__pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3, __pyx_k_NONE_0_WARNING_1_ERROR_2_FATAL_3, sizeof(__pyx_k_NONE_0_WARNING_1_ERROR_2_FATAL_3), 0, 1, 0, 0},
  {&__pyx_kp_u_Name_not_registered, __pyx_k_Name_not_registered, sizeof(__pyx_k_Name_not_registered), 0, 1, 0, 0},
  {&__pyx_n_s_NamespaceRegistryError, __pyx_k_NamespaceRegistryError, sizeof(__pyx_k_NamespaceRegistryError), 0, 0, 1, 1},
  {&__pyx_kp_u_Namespace_r, __pyx_k_Namespace_r, sizeof(__pyx_k_Namespace_r), 0, 1, 0, 0},
  {&__pyx_kp_u_No_ID_dictionary_available, __pyx_k_No_ID_dictionary_available, sizeof(__pyx_k_No_ID_dictionary_available), 0, 1, 0, 0},
  {&__pyx_kp_u_No_tree_or_file_given, __pyx_k_No_tree_or_file_given, sizeof(__pyx_k_No_tree_or_file_given), 0, 1, 0, 0},
  {&__pyx_kp_u_Node_must_not_be_None, __pyx_k_Node_must_not_be_None, sizeof(__pyx_k_Node_must_not_be_None), 0, 1, 0, 0},
  {&__pyx_kp_u_Non_Element_values_not_supported, __pyx_k_Non_Element_values_not_supported, sizeof(__pyx_k_Non_Element_values_not_supported), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_kp_u_Not_yet_implemented_result_node, __pyx_k_Not_yet_implemented_result_node, sizeof(__pyx_k_Not_yet_implemented_result_node), 0, 1, 0, 0},
  {&__pyx_kp_b_Number_encoding, __pyx_k_Number_encoding, sizeof(__pyx_k_Number_encoding), 0, 0, 0, 0},
  {&__pyx_n_b_Ok, __pyx_k_Ok, sizeof(__pyx_k_Ok), 0, 0, 0, 1},
  {&__pyx_kp_u_Only_elements_can_be_the_root_of, __pyx_k_Only_elements_can_be_the_root_of, sizeof(__pyx_k_Only_elements_can_be_the_root_of), 0, 1, 0, 0},
  {&__pyx_kp_u_Only_processing_instructions_and, __pyx_k_Only_processing_instructions_and, sizeof(__pyx_k_Only_processing_instructions_and), 0, 1, 0, 0},
  {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1},
  {&__pyx_n_s_PARSER, __pyx_k_PARSER, sizeof(__pyx_k_PARSER), 0, 0, 1, 1},
  {&__pyx_n_s_PI, __pyx_k_PI, sizeof(__pyx_k_PI), 0, 0, 1, 1},
  {&__pyx_n_u_PI, __pyx_k_PI, sizeof(__pyx_k_PI), 0, 1, 0, 1},
  {&__pyx_n_s_PIBase, __pyx_k_PIBase, sizeof(__pyx_k_PIBase), 0, 0, 1, 1},
  {&__pyx_kp_u_PI_class_must_be_subclass_of_PIB, __pyx_k_PI_class_must_be_subclass_of_PIB, sizeof(__pyx_k_PI_class_must_be_subclass_of_PIB), 0, 1, 0, 0},
  {&__pyx_kp_u_PI_lacks_content, __pyx_k_PI_lacks_content, sizeof(__pyx_k_PI_lacks_content), 0, 1, 0, 0},
  {&__pyx_n_s_ParseError, __pyx_k_ParseError, sizeof(__pyx_k_ParseError), 0, 0, 1, 1},
  {&__pyx_n_s_ParseError___init, __pyx_k_ParseError___init, sizeof(__pyx_k_ParseError___init), 0, 0, 1, 1},
  {&__pyx_n_s_ParserBasedElementClassLookup, __pyx_k_ParserBasedElementClassLookup, sizeof(__pyx_k_ParserBasedElementClassLookup), 0, 0, 1, 1},
  {&__pyx_n_u_ParserDictionaryContext, __pyx_k_ParserDictionaryContext, sizeof(__pyx_k_ParserDictionaryContext), 0, 1, 0, 1},
  {&__pyx_n_s_ParserError, __pyx_k_ParserError, sizeof(__pyx_k_ParserError), 0, 0, 1, 1},
  {&__pyx_kp_s_ParserSchemaValidationContext_n, __pyx_k_ParserSchemaValidationContext_n, sizeof(__pyx_k_ParserSchemaValidationContext_n), 0, 0, 1, 0},
  {&__pyx_kp_u_Parsing_requires_string_data, __pyx_k_Parsing_requires_string_data, sizeof(__pyx_k_Parsing_requires_string_data), 0, 1, 0, 0},
  {&__pyx_kp_s_Prefix_format_reserved_for_inter, __pyx_k_Prefix_format_reserved_for_inter, sizeof(__pyx_k_Prefix_format_reserved_for_inter), 0, 0, 1, 0},
  {&__pyx_n_s_ProcessingInstruction, __pyx_k_ProcessingInstruction, sizeof(__pyx_k_ProcessingInstruction), 0, 0, 1, 1},
  {&__pyx_kp_s_Proxy_invalidated, __pyx_k_Proxy_invalidated, sizeof(__pyx_k_Proxy_invalidated), 0, 0, 1, 0},
  {&__pyx_kp_u_Proxy_invalidated, __pyx_k_Proxy_invalidated, sizeof(__pyx_k_Proxy_invalidated), 0, 1, 0, 0},
  {&__pyx_n_s_PyErrorLog, __pyx_k_PyErrorLog, sizeof(__pyx_k_PyErrorLog), 0, 0, 1, 1},
  {&__pyx_n_s_PythonElementClassLookup, __pyx_k_PythonElementClassLookup, sizeof(__pyx_k_PythonElementClassLookup), 0, 0, 1, 1},
  {&__pyx_n_s_QName, __pyx_k_QName, sizeof(__pyx_k_QName), 0, 0, 1, 1},
  {&__pyx_n_s_RELAXNGV, __pyx_k_RELAXNGV, sizeof(__pyx_k_RELAXNGV), 0, 0, 1, 1},
  {&__pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY, __pyx_k_RELAXNG_OK_0_RELAXNG_ERR_MEMORY, sizeof(__pyx_k_RELAXNG_OK_0_RELAXNG_ERR_MEMORY), 0, 1, 0, 0},
  {&__pyx_kp_u_RNGP_ATTRIBUTE_CONTENT_1003_RNGP, __pyx_k_RNGP_ATTRIBUTE_CONTENT_1003_RNGP, sizeof(__pyx_k_RNGP_ATTRIBUTE_CONTENT_1003_RNGP), 0, 1, 0, 0},
  {&__pyx_kp_u_RNGP_PAT_DATA_EXCEPT_ONEMORE_107, __pyx_k_RNGP_PAT_DATA_EXCEPT_ONEMORE_107, sizeof(__pyx_k_RNGP_PAT_DATA_EXCEPT_ONEMORE_107), 0, 1, 0, 0},
  {&__pyx_n_s_ReferenceError, __pyx_k_ReferenceError, sizeof(__pyx_k_ReferenceError), 0, 0, 1, 1},
  {&__pyx_kp_u_Registered_element_classes_must, __pyx_k_Registered_element_classes_must, sizeof(__pyx_k_Registered_element_classes_must), 0, 1, 0, 0},
  {&__pyx_kp_u_Registered_functions_must_be_cal, __pyx_k_Registered_functions_must_be_cal, sizeof(__pyx_k_Registered_functions_must_be_cal), 0, 1, 0, 0},
  {&__pyx_n_s_RelaxNG, __pyx_k_RelaxNG, sizeof(__pyx_k_RelaxNG), 0, 0, 1, 1},
  {&__pyx_n_s_RelaxNGError, __pyx_k_RelaxNGError, sizeof(__pyx_k_RelaxNGError), 0, 0, 1, 1},
  {&__pyx_n_s_RelaxNGErrorTypes, __pyx_k_RelaxNGErrorTypes, sizeof(__pyx_k_RelaxNGErrorTypes), 0, 0, 1, 1},
  {&__pyx_n_s_RelaxNGParseError, __pyx_k_RelaxNGParseError, sizeof(__pyx_k_RelaxNGParseError), 0, 0, 1, 1},
  {&__pyx_n_s_RelaxNGValidateError, __pyx_k_RelaxNGValidateError, sizeof(__pyx_k_RelaxNGValidateError), 0, 0, 1, 1},
  {&__pyx_kp_s_RelaxNG_instance_not_initialised, __pyx_k_RelaxNG_instance_not_initialised, sizeof(__pyx_k_RelaxNG_instance_not_initialised), 0, 0, 1, 0},
  {&__pyx_n_s_Resolver, __pyx_k_Resolver, sizeof(__pyx_k_Resolver), 0, 0, 1, 1},
  {&__pyx_kp_b_Resource_error, __pyx_k_Resource_error, sizeof(__pyx_k_Resource_error), 0, 0, 0, 0},
  {&__pyx_kp_u_SCHEMAP_CVC_SIMPLE_TYPE_3062_SCH, __pyx_k_SCHEMAP_CVC_SIMPLE_TYPE_3062_SCH, sizeof(__pyx_k_SCHEMAP_CVC_SIMPLE_TYPE_3062_SCH), 0, 1, 0, 0},
  {&__pyx_kp_u_SCHEMAP_DEF_AND_PREFIX_1768_SCHE, __pyx_k_SCHEMAP_DEF_AND_PREFIX_1768_SCHE, sizeof(__pyx_k_SCHEMAP_DEF_AND_PREFIX_1768_SCHE), 0, 1, 0, 0},
  {&__pyx_kp_u_SCHEMAP_EXTENSION_NO_BASE_1707_S, __pyx_k_SCHEMAP_EXTENSION_NO_BASE_1707_S, sizeof(__pyx_k_SCHEMAP_EXTENSION_NO_BASE_1707_S), 0, 1, 0, 0},
  {&__pyx_kp_u_SCHEMAP_SRC_RESOLVE_3004_SCHEMAP, __pyx_k_SCHEMAP_SRC_RESOLVE_3004_SCHEMAP, sizeof(__pyx_k_SCHEMAP_SRC_RESOLVE_3004_SCHEMAP), 0, 1, 0, 0},
  {&__pyx_kp_u_SCHEMAV_CVC_MINLENGTH_VALID_1831, __pyx_k_SCHEMAV_CVC_MINLENGTH_VALID_1831, sizeof(__pyx_k_SCHEMAV_CVC_MINLENGTH_VALID_1831), 0, 1, 0, 0},
  {&__pyx_kp_s_Schema_instance_not_initialised, __pyx_k_Schema_instance_not_initialised, sizeof(__pyx_k_Schema_instance_not_initialised), 0, 0, 1, 0},
  {&__pyx_n_s_Schematron, __pyx_k_Schematron, sizeof(__pyx_k_Schematron), 0, 0, 1, 1},
  {&__pyx_n_s_SchematronError, __pyx_k_SchematronError, sizeof(__pyx_k_SchematronError), 0, 0, 1, 1},
  {&__pyx_n_s_SchematronParseError, __pyx_k_SchematronParseError, sizeof(__pyx_k_SchematronParseError), 0, 0, 1, 1},
  {&__pyx_n_s_SchematronValidateError, __pyx_k_SchematronValidateError, sizeof(__pyx_k_SchematronValidateError), 0, 0, 1, 1},
  {&__pyx_kp_s_Schematron_instance_not_initiali, __pyx_k_Schematron_instance_not_initiali, sizeof(__pyx_k_Schematron_instance_not_initiali), 0, 0, 1, 0},
  {&__pyx_n_s_SerialisationError, __pyx_k_SerialisationError, sizeof(__pyx_k_SerialisationError), 0, 0, 1, 1},
  {&__pyx_kp_u_Serialisation_to_unicode_must_no, __pyx_k_Serialisation_to_unicode_must_no, sizeof(__pyx_k_Serialisation_to_unicode_must_no), 0, 1, 0, 0},
  {&__pyx_kp_b_Stack_usage_error, __pyx_k_Stack_usage_error, sizeof(__pyx_k_Stack_usage_error), 0, 0, 0, 0},
  {&__pyx_kp_b_Start_of_literal, __pyx_k_Start_of_literal, sizeof(__pyx_k_Start_of_literal), 0, 0, 0, 0},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s_StringIO, __pyx_k_StringIO, sizeof(__pyx_k_StringIO), 0, 0, 1, 1},
  {&__pyx_n_s_SubElement, __pyx_k_SubElement, sizeof(__pyx_k_SubElement), 0, 0, 1, 1},
  {&__pyx_kp_b_Sub_resource_error, __pyx_k_Sub_resource_error, sizeof(__pyx_k_Sub_resource_error), 0, 0, 0, 0},
  {&__pyx_n_s_SyntaxError, __pyx_k_SyntaxError, sizeof(__pyx_k_SyntaxError), 0, 0, 1, 1},
  {&__pyx_kp_b_Syntax_error, __pyx_k_Syntax_error, sizeof(__pyx_k_Syntax_error), 0, 0, 0, 0},
  {&__pyx_kp_s_Syntax_error_while_parsing_an_XM, __pyx_k_Syntax_error_while_parsing_an_XM, sizeof(__pyx_k_Syntax_error_while_parsing_an_XM), 0, 0, 1, 0},
  {&__pyx_kp_s_Syntax_error_while_parsing_an_XM_2, __pyx_k_Syntax_error_while_parsing_an_XM_2, sizeof(__pyx_k_Syntax_error_while_parsing_an_XM_2), 0, 0, 1, 0},
  {&__pyx_n_s_TAG, __pyx_k_TAG, sizeof(__pyx_k_TAG), 0, 0, 1, 1},
  {&__pyx_kp_u_TREE_NOT_UTF8_1303_SAVE_NOT_UTF8, __pyx_k_TREE_NOT_UTF8_1303_SAVE_NOT_UTF8, sizeof(__pyx_k_TREE_NOT_UTF8_1303_SAVE_NOT_UTF8), 0, 1, 0, 0},
  {&__pyx_n_s_TargetParserResult, __pyx_k_TargetParserResult, sizeof(__pyx_k_TargetParserResult), 0, 0, 1, 1},
  {&__pyx_n_s_TargetParserResult___init, __pyx_k_TargetParserResult___init, sizeof(__pyx_k_TargetParserResult___init), 0, 0, 1, 1},
  {&__pyx_kp_u_The_behavior_of_this_method_will, __pyx_k_The_behavior_of_this_method_will, sizeof(__pyx_k_The_behavior_of_this_method_will), 0, 1, 0, 0},
  {&__pyx_kp_u_This_class_cannot_be_instantiate, __pyx_k_This_class_cannot_be_instantiate, sizeof(__pyx_k_This_class_cannot_be_instantiate), 0, 1, 0, 0},
  {&__pyx_kp_u_This_is_not_a_supported_node_set, __pyx_k_This_is_not_a_supported_node_set, sizeof(__pyx_k_This_is_not_a_supported_node_set), 0, 1, 0, 0},
  {&__pyx_kp_u_This_type_cannot_be_instantiated, __pyx_k_This_type_cannot_be_instantiated, sizeof(__pyx_k_This_type_cannot_be_instantiated), 0, 1, 0, 0},
  {&__pyx_kp_u_This_version_of_libxml2_has_a_kn, __pyx_k_This_version_of_libxml2_has_a_kn, sizeof(__pyx_k_This_version_of_libxml2_has_a_kn), 0, 1, 0, 0},
  {&__pyx_n_s_TreeBuilder, __pyx_k_TreeBuilder, sizeof(__pyx_k_TreeBuilder), 0, 0, 1, 1},
  {&__pyx_kp_u_Tried_to_unregister_unknown_prox, __pyx_k_Tried_to_unregister_unknown_prox, sizeof(__pyx_k_Tried_to_unregister_unknown_prox), 0, 1, 0, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_u_Type_s_cannot_be_serialized, __pyx_k_Type_s_cannot_be_serialized, sizeof(__pyx_k_Type_s_cannot_be_serialized), 0, 1, 0, 0},
  {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1},
  {&__pyx_n_s_UNICODE, __pyx_k_UNICODE, sizeof(__pyx_k_UNICODE), 0, 0, 1, 1},
  {&__pyx_kp_u_US_ASCII, __pyx_k_US_ASCII, sizeof(__pyx_k_US_ASCII), 0, 1, 0, 0},
  {&__pyx_n_u_UTF8, __pyx_k_UTF8, sizeof(__pyx_k_UTF8), 0, 1, 0, 1},
  {&__pyx_kp_s_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 0, 1, 0},
  {&__pyx_kp_u_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 1, 0, 0},
  {&__pyx_kp_b_Undefined_namespace_prefix, __pyx_k_Undefined_namespace_prefix, sizeof(__pyx_k_Undefined_namespace_prefix), 0, 0, 0, 0},
  {&__pyx_kp_b_Undefined_variable, __pyx_k_Undefined_variable, sizeof(__pyx_k_Undefined_variable), 0, 0, 0, 0},
  {&__pyx_kp_u_Undefined_xpath_result, __pyx_k_Undefined_xpath_result, sizeof(__pyx_k_Undefined_xpath_result), 0, 1, 0, 0},
  {&__pyx_kp_b_Unfinished_literal, __pyx_k_Unfinished_literal, sizeof(__pyx_k_Unfinished_literal), 0, 0, 0, 0},
  {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
  {&__pyx_n_s_UnicodeEncodeError, __pyx_k_UnicodeEncodeError, sizeof(__pyx_k_UnicodeEncodeError), 0, 0, 1, 1},
  {&__pyx_kp_u_Unicode_parsing_is_not_supported, __pyx_k_Unicode_parsing_is_not_supported, sizeof(__pyx_k_Unicode_parsing_is_not_supported), 0, 1, 0, 0},
  {&__pyx_kp_u_Unicode_strings_with_encoding_de, __pyx_k_Unicode_strings_with_encoding_de, sizeof(__pyx_k_Unicode_strings_with_encoding_de), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_libxml2_version_s, __pyx_k_Unknown_libxml2_version_s, sizeof(__pyx_k_Unknown_libxml2_version_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_node_type_s, __pyx_k_Unknown_node_type_s, sizeof(__pyx_k_Unknown_node_type_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_return_type_s, __pyx_k_Unknown_return_type_s, sizeof(__pyx_k_Unknown_return_type_s), 0, 1, 0, 0},
  {&__pyx_kp_u_Unknown_xpath_result_s, __pyx_k_Unknown_xpath_result_s, sizeof(__pyx_k_Unknown_xpath_result_s), 0, 1, 0, 0},
  {&__pyx_kp_b_Unregistered_function, __pyx_k_Unregistered_function, sizeof(__pyx_k_Unregistered_function), 0, 0, 0, 0},
  {&__pyx_kp_s_Unsupported_element_type_d, __pyx_k_Unsupported_element_type_d, sizeof(__pyx_k_Unsupported_element_type_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Unsupported_node_type_d, __pyx_k_Unsupported_node_type_d, sizeof(__pyx_k_Unsupported_node_type_d), 0, 0, 1, 0},
  {&__pyx_n_s_UserDict, __pyx_k_UserDict, sizeof(__pyx_k_UserDict), 0, 0, 1, 1},
  {&__pyx_kp_s_Validation_error_Raised_by_all_d, __pyx_k_Validation_error_Raised_by_all_d, sizeof(__pyx_k_Validation_error_Raised_by_all_d), 0, 0, 1, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_WARNING, __pyx_k_WARNING, sizeof(__pyx_k_WARNING), 0, 0, 1, 1},
  {&__pyx_n_s_WAR_UNDECLARED_ENTITY, __pyx_k_WAR_UNDECLARED_ENTITY, sizeof(__pyx_k_WAR_UNDECLARED_ENTITY), 0, 0, 1, 1},
  {&__pyx_n_s_XInclude, __pyx_k_XInclude, sizeof(__pyx_k_XInclude), 0, 0, 1, 1},
  {&__pyx_n_s_XIncludeError, __pyx_k_XIncludeError, sizeof(__pyx_k_XIncludeError), 0, 0, 1, 1},
  {&__pyx_kp_s_XInclude_instance_not_initialise, __pyx_k_XInclude_instance_not_initialise, sizeof(__pyx_k_XInclude_instance_not_initialise), 0, 0, 1, 0},
  {&__pyx_kp_u_XInclude_processing_failed, __pyx_k_XInclude_processing_failed, sizeof(__pyx_k_XInclude_processing_failed), 0, 1, 0, 0},
  {&__pyx_n_s_XML, __pyx_k_XML, sizeof(__pyx_k_XML), 0, 0, 1, 1},
  {&__pyx_n_s_XMLDTDID, __pyx_k_XMLDTDID, sizeof(__pyx_k_XMLDTDID), 0, 0, 1, 1},
  {&__pyx_n_s_XMLID, __pyx_k_XMLID, sizeof(__pyx_k_XMLID), 0, 0, 1, 1},
  {&__pyx_n_s_XMLParser, __pyx_k_XMLParser, sizeof(__pyx_k_XMLParser), 0, 0, 1, 1},
  {&__pyx_n_s_XMLSchema, __pyx_k_XMLSchema, sizeof(__pyx_k_XMLSchema), 0, 0, 1, 1},
  {&__pyx_n_s_XMLSchemaError, __pyx_k_XMLSchemaError, sizeof(__pyx_k_XMLSchemaError), 0, 0, 1, 1},
  {&__pyx_n_s_XMLSchemaParseError, __pyx_k_XMLSchemaParseError, sizeof(__pyx_k_XMLSchemaParseError), 0, 0, 1, 1},
  {&__pyx_n_s_XMLSchemaValidateError, __pyx_k_XMLSchemaValidateError, sizeof(__pyx_k_XMLSchemaValidateError), 0, 0, 1, 1},
  {&__pyx_n_s_XMLSyntaxError, __pyx_k_XMLSyntaxError, sizeof(__pyx_k_XMLSyntaxError), 0, 0, 1, 1},
  {&__pyx_n_s_XMLTreeBuilder, __pyx_k_XMLTreeBuilder, sizeof(__pyx_k_XMLTreeBuilder), 0, 0, 1, 1},
  {&__pyx_kp_s_XML_declaration_already_written, __pyx_k_XML_declaration_already_written, sizeof(__pyx_k_XML_declaration_already_written), 0, 0, 1, 0},
  {&__pyx_kp_u_XML_line_2987, __pyx_k_XML_line_2987, sizeof(__pyx_k_XML_line_2987), 0, 1, 0, 0},
  {&__pyx_kp_u_XML_text_parser_None_base_url_No, __pyx_k_XML_text_parser_None_base_url_No, sizeof(__pyx_k_XML_text_parser_None_base_url_No), 0, 1, 0, 0},
  {&__pyx_n_u_XPATH_LOCATIONSET, __pyx_k_XPATH_LOCATIONSET, sizeof(__pyx_k_XPATH_LOCATIONSET), 0, 1, 0, 1},
  {&__pyx_n_u_XPATH_POINT, __pyx_k_XPATH_POINT, sizeof(__pyx_k_XPATH_POINT), 0, 1, 0, 1},
  {&__pyx_n_u_XPATH_RANGE, __pyx_k_XPATH_RANGE, sizeof(__pyx_k_XPATH_RANGE), 0, 1, 0, 1},
  {&__pyx_n_u_XPATH_USERS, __pyx_k_XPATH_USERS, sizeof(__pyx_k_XPATH_USERS), 0, 1, 0, 1},
  {&__pyx_n_s_XPath, __pyx_k_XPath, sizeof(__pyx_k_XPath), 0, 0, 1, 1},
  {&__pyx_n_s_XPathDocumentEvaluator, __pyx_k_XPathDocumentEvaluator, sizeof(__pyx_k_XPathDocumentEvaluator), 0, 0, 1, 1},
  {&__pyx_n_s_XPathError, __pyx_k_XPathError, sizeof(__pyx_k_XPathError), 0, 0, 1, 1},
  {&__pyx_n_s_XPathEvalError, __pyx_k_XPathEvalError, sizeof(__pyx_k_XPathEvalError), 0, 0, 1, 1},
  {&__pyx_n_s_XPathEvaluator, __pyx_k_XPathEvaluator, sizeof(__pyx_k_XPathEvaluator), 0, 0, 1, 1},
  {&__pyx_n_s_XPathFunctionError, __pyx_k_XPathFunctionError, sizeof(__pyx_k_XPathFunctionError), 0, 0, 1, 1},
  {&__pyx_n_s_XPathResultError, __pyx_k_XPathResultError, sizeof(__pyx_k_XPathResultError), 0, 0, 1, 1},
  {&__pyx_n_s_XPathSyntaxError, __pyx_k_XPathSyntaxError, sizeof(__pyx_k_XPathSyntaxError), 0, 0, 1, 1},
  {&__pyx_kp_u_XPath_context_is_only_usable_dur, __pyx_k_XPath_context_is_only_usable_dur, sizeof(__pyx_k_XPath_context_is_only_usable_dur), 0, 1, 0, 0},
  {&__pyx_kp_s_XPath_context_not_initialised, __pyx_k_XPath_context_not_initialised, sizeof(__pyx_k_XPath_context_not_initialised), 0, 0, 1, 0},
  {&__pyx_kp_u_XPath_evaluator_locking_failed, __pyx_k_XPath_evaluator_locking_failed, sizeof(__pyx_k_XPath_evaluator_locking_failed), 0, 1, 0, 0},
  {&__pyx_kp_s_XPath_evaluator_not_initialised, __pyx_k_XPath_evaluator_not_initialised, sizeof(__pyx_k_XPath_evaluator_not_initialised), 0, 0, 1, 0},
  {&__pyx_kp_u_XPath_function_s_not_found, __pyx_k_XPath_function_s_not_found, sizeof(__pyx_k_XPath_function_s_not_found), 0, 1, 0, 0},
  {&__pyx_n_s_XSLT, __pyx_k_XSLT, sizeof(__pyx_k_XSLT), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTAccessControl, __pyx_k_XSLTAccessControl, sizeof(__pyx_k_XSLTAccessControl), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTApplyError, __pyx_k_XSLTApplyError, sizeof(__pyx_k_XSLTApplyError), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTError, __pyx_k_XSLTError, sizeof(__pyx_k_XSLTError), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTExtension, __pyx_k_XSLTExtension, sizeof(__pyx_k_XSLTExtension), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTExtensionError, __pyx_k_XSLTExtensionError, sizeof(__pyx_k_XSLTExtensionError), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTParseError, __pyx_k_XSLTParseError, sizeof(__pyx_k_XSLTParseError), 0, 0, 1, 1},
  {&__pyx_n_s_XSLTSaveError, __pyx_k_XSLTSaveError, sizeof(__pyx_k_XSLTSaveError), 0, 0, 1, 1},
  {&__pyx_kp_s_XSLT_context_not_initialised, __pyx_k_XSLT_context_not_initialised, sizeof(__pyx_k_XSLT_context_not_initialised), 0, 0, 1, 0},
  {&__pyx_kp_s_XSLT_stylesheet_not_initialised, __pyx_k_XSLT_stylesheet_not_initialised, sizeof(__pyx_k_XSLT_stylesheet_not_initialised), 0, 0, 1, 0},
  {&__pyx_kp_u__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 1, 0, 0},
  {&__pyx_kp_b__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 0, 0},
  {&__pyx_kp_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 0},
  {&__pyx_kp_u__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 1, 0, 0},
  {&__pyx_kp_b__201, __pyx_k__201, sizeof(__pyx_k__201), 0, 0, 0, 0},
  {&__pyx_kp_b__203, __pyx_k__203, sizeof(__pyx_k__203), 0, 0, 0, 0},
  {&__pyx_kp_s__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 0, 1, 0},
  {&__pyx_kp_u__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 1, 0, 0},
  {&__pyx_kp_b__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 0, 0, 0},
  {&__pyx_kp_u__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 1, 0, 0},
  {&__pyx_kp_b__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 0, 0},
  {&__pyx_kp_u__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 1, 0, 0},
  {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  {&__pyx_kp_s__30, __pyx_k__30, sizeof(__pyx_k__30), 0, 0, 1, 0},
  {&__pyx_kp_b__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 0, 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_b__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 0, 0},
  {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
  {&__pyx_n_s__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 0, 1, 1},
  {&__pyx_n_u__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 1, 0, 1},
  {&__pyx_kp_u__53, __pyx_k__53, sizeof(__pyx_k__53), 0, 1, 0, 0},
  {&__pyx_kp_b__60, __pyx_k__60, sizeof(__pyx_k__60), 0, 0, 0, 0},
  {&__pyx_kp_u__63, __pyx_k__63, sizeof(__pyx_k__63), 0, 1, 0, 0},
  {&__pyx_kp_u__92, __pyx_k__92, sizeof(__pyx_k__92), 0, 1, 0, 0},
  {&__pyx_n_s_abspath, __pyx_k_abspath, sizeof(__pyx_k_abspath), 0, 0, 1, 1},
  {&__pyx_n_s_accepted_domains, __pyx_k_accepted_domains, sizeof(__pyx_k_accepted_domains), 0, 0, 1, 1},
  {&__pyx_n_s_access_control, __pyx_k_access_control, sizeof(__pyx_k_access_control), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_u_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 1, 0, 1},
  {&__pyx_kp_u_ambiguous_reference_to_embedded, __pyx_k_ambiguous_reference_to_embedded, sizeof(__pyx_k_ambiguous_reference_to_embedded), 0, 1, 0, 0},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_s_append_log_message, __pyx_k_append_log_message, sizeof(__pyx_k_append_log_message), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_kp_s_argument_must_be_a_byte_string_o, __pyx_k_argument_must_be_a_byte_string_o, sizeof(__pyx_k_argument_must_be_a_byte_string_o), 0, 0, 1, 0},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_n_u_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 1, 0, 1},
  {&__pyx_kp_u_attempt_to_assign_sequence_of_si, __pyx_k_attempt_to_assign_sequence_of_si, sizeof(__pyx_k_attempt_to_assign_sequence_of_si), 0, 1, 0, 0},
  {&__pyx_n_s_attrib, __pyx_k_attrib, sizeof(__pyx_k_attrib), 0, 0, 1, 1},
  {&__pyx_n_s_attribute_defaults, __pyx_k_attribute_defaults, sizeof(__pyx_k_attribute_defaults), 0, 0, 1, 1},
  {&__pyx_n_s_attribute_name, __pyx_k_attribute_name, sizeof(__pyx_k_attribute_name), 0, 0, 1, 1},
  {&__pyx_n_s_attribute_names, __pyx_k_attribute_names, sizeof(__pyx_k_attribute_names), 0, 0, 1, 1},
  {&__pyx_n_s_attrname, __pyx_k_attrname, sizeof(__pyx_k_attrname), 0, 0, 1, 1},
  {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
  {&__pyx_n_s_base_url, __pyx_k_base_url, sizeof(__pyx_k_base_url), 0, 0, 1, 1},
  {&__pyx_n_u_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 1, 0, 1},
  {&__pyx_n_s_block_count, __pyx_k_block_count, sizeof(__pyx_k_block_count), 0, 0, 1, 1},
  {&__pyx_kp_u_boolean_xs_attribute_default_or, __pyx_k_boolean_xs_attribute_default_or, sizeof(__pyx_k_boolean_xs_attribute_default_or), 0, 1, 0, 0},
  {&__pyx_n_s_build_smart_strings, __pyx_k_build_smart_strings, sizeof(__pyx_k_build_smart_strings), 0, 0, 1, 1},
  {&__pyx_n_s_builtin, __pyx_k_builtin, sizeof(__pyx_k_builtin), 0, 0, 1, 1},
  {&__pyx_n_s_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 1, 1},
  {&__pyx_n_s_byte_count, __pyx_k_byte_count, sizeof(__pyx_k_byte_count), 0, 0, 1, 1},
  {&__pyx_n_s_c14n, __pyx_k_c14n, sizeof(__pyx_k_c14n), 0, 0, 1, 1},
  {&__pyx_n_s_c_doc, __pyx_k_c_doc, sizeof(__pyx_k_c_doc), 0, 0, 1, 1},
  {&__pyx_n_s_c_name, __pyx_k_c_name, sizeof(__pyx_k_c_name), 0, 0, 1, 1},
  {&__pyx_n_s_c_next, __pyx_k_c_next, sizeof(__pyx_k_c_next), 0, 0, 1, 1},
  {&__pyx_n_s_c_node, __pyx_k_c_node, sizeof(__pyx_k_c_node), 0, 0, 1, 1},
  {&__pyx_n_s_c_node_copy, __pyx_k_c_node_copy, sizeof(__pyx_k_c_node_copy), 0, 0, 1, 1},
  {&__pyx_n_s_c_ns_tags, __pyx_k_c_ns_tags, sizeof(__pyx_k_c_ns_tags), 0, 0, 1, 1},
  {&__pyx_n_s_c_tag_count, __pyx_k_c_tag_count, sizeof(__pyx_k_c_tag_count), 0, 0, 1, 1},
  {&__pyx_kp_u_can_only_parse_strings, __pyx_k_can_only_parse_strings, sizeof(__pyx_k_can_only_parse_strings), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_append_document_already_h, __pyx_k_cannot_append_document_already_h, sizeof(__pyx_k_cannot_append_document_already_h), 0, 1, 0, 0},
  {&__pyx_kp_s_cannot_append_parent_to_itself, __pyx_k_cannot_append_parent_to_itself, sizeof(__pyx_k_cannot_append_parent_to_itself), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_append_trailing_element_t, __pyx_k_cannot_append_trailing_element_t, sizeof(__pyx_k_cannot_append_trailing_element_t), 0, 0, 1, 0},
  {&__pyx_kp_u_cannot_assign_None, __pyx_k_cannot_assign_None, sizeof(__pyx_k_cannot_assign_None), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_parse_from_s, __pyx_k_cannot_parse_from_s, sizeof(__pyx_k_cannot_parse_from_s), 0, 1, 0, 0},
  {&__pyx_kp_s_cannot_set_a_maximum_stylesheet, __pyx_k_cannot_set_a_maximum_stylesheet, sizeof(__pyx_k_cannot_set_a_maximum_stylesheet), 0, 0, 1, 0},
  {&__pyx_n_s_cdata, __pyx_k_cdata, sizeof(__pyx_k_cdata), 0, 0, 1, 1},
  {&__pyx_n_s_child, __pyx_k_child, sizeof(__pyx_k_child), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_class_mapping, __pyx_k_class_mapping, sizeof(__pyx_k_class_mapping), 0, 0, 1, 1},
  {&__pyx_n_s_cleanup_namespaces, __pyx_k_cleanup_namespaces, sizeof(__pyx_k_cleanup_namespaces), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_clear_error_log, __pyx_k_clear_error_log, sizeof(__pyx_k_clear_error_log), 0, 0, 1, 1},
  {&__pyx_n_s_clear_error_log_2, __pyx_k_clear_error_log_2, sizeof(__pyx_k_clear_error_log_2), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_close_file, __pyx_k_close_file, sizeof(__pyx_k_close_file), 0, 0, 1, 1},
  {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
  {&__pyx_n_s_column, __pyx_k_column, sizeof(__pyx_k_column), 0, 0, 1, 1},
  {&__pyx_n_s_comment, __pyx_k_comment, sizeof(__pyx_k_comment), 0, 0, 1, 1},
  {&__pyx_n_u_comment, __pyx_k_comment, sizeof(__pyx_k_comment), 0, 1, 0, 1},
  {&__pyx_kp_u_comment_class_must_be_subclass_o, __pyx_k_comment_class_must_be_subclass_o, sizeof(__pyx_k_comment_class_must_be_subclass_o), 0, 1, 0, 0},
  {&__pyx_n_s_compact, __pyx_k_compact, sizeof(__pyx_k_compact), 0, 0, 1, 1},
  {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
  {&__pyx_n_s_compression, __pyx_k_compression, sizeof(__pyx_k_compression), 0, 0, 1, 1},
  {&__pyx_n_s_compresslevel, __pyx_k_compresslevel, sizeof(__pyx_k_compresslevel), 0, 0, 1, 1},
  {&__pyx_n_s_contains, __pyx_k_contains, sizeof(__pyx_k_contains), 0, 0, 1, 1},
  {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_copy_2, __pyx_k_copy_2, sizeof(__pyx_k_copy_2), 0, 0, 1, 1},
  {&__pyx_n_s_create_dir, __pyx_k_create_dir, sizeof(__pyx_k_create_dir), 0, 0, 1, 1},
  {&__pyx_n_u_create_dir, __pyx_k_create_dir, sizeof(__pyx_k_create_dir), 0, 1, 0, 1},
  {&__pyx_n_s_ctxt, __pyx_k_ctxt, sizeof(__pyx_k_ctxt), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_b_dc, __pyx_k_dc, sizeof(__pyx_k_dc), 0, 0, 0, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_default_resolver, __pyx_k_default_resolver, sizeof(__pyx_k_default_resolver), 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_delitem, __pyx_k_delitem, sizeof(__pyx_k_delitem), 0, 0, 1, 1},
  {&__pyx_n_u_dev, __pyx_k_dev, sizeof(__pyx_k_dev), 0, 1, 0, 1},
  {&__pyx_n_s_dic, __pyx_k_dic, sizeof(__pyx_k_dic), 0, 0, 1, 1},
  {&__pyx_n_u_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 1, 0, 1},
  {&__pyx_n_s_discard, __pyx_k_discard, sizeof(__pyx_k_discard), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_doc_2, __pyx_k_doc_2, sizeof(__pyx_k_doc_2), 0, 0, 1, 1},
  {&__pyx_n_s_doc_3, __pyx_k_doc_3, sizeof(__pyx_k_doc_3), 0, 0, 1, 1},
  {&__pyx_n_s_docformat, __pyx_k_docformat, sizeof(__pyx_k_docformat), 0, 0, 1, 1},
  {&__pyx_n_s_docstring, __pyx_k_docstring, sizeof(__pyx_k_docstring), 0, 0, 1, 1},
  {&__pyx_n_s_doctype, __pyx_k_doctype, sizeof(__pyx_k_doctype), 0, 0, 1, 1},
  {&__pyx_kp_u_document_context_is_missing, __pyx_k_document_context_is_missing, sizeof(__pyx_k_document_context_is_missing), 0, 1, 0, 0},
  {&__pyx_kp_u_document_external_context_nodes, __pyx_k_document_external_context_nodes, sizeof(__pyx_k_document_external_context_nodes), 0, 1, 0, 0},
  {&__pyx_n_s_domain, __pyx_k_domain, sizeof(__pyx_k_domain), 0, 0, 1, 1},
  {&__pyx_n_s_domain_name, __pyx_k_domain_name, sizeof(__pyx_k_domain_name), 0, 0, 1, 1},
  {&__pyx_n_s_domains, __pyx_k_domains, sizeof(__pyx_k_domains), 0, 0, 1, 1},
  {&__pyx_kp_u_double_registering_proxy, __pyx_k_double_registering_proxy, sizeof(__pyx_k_double_registering_proxy), 0, 1, 0, 0},
  {&__pyx_n_s_dtd_validation, __pyx_k_dtd_validation, sizeof(__pyx_k_dtd_validation), 0, 0, 1, 1},
  {&__pyx_n_s_dump, __pyx_k_dump, sizeof(__pyx_k_dump), 0, 0, 1, 1},
  {&__pyx_kp_u_either_filename_or_external_ID_r, __pyx_k_either_filename_or_external_ID_r, sizeof(__pyx_k_either_filename_or_external_ID_r), 0, 1, 0, 0},
  {&__pyx_n_s_elem, __pyx_k_elem, sizeof(__pyx_k_elem), 0, 0, 1, 1},
  {&__pyx_n_s_element, __pyx_k_element, sizeof(__pyx_k_element), 0, 0, 1, 1},
  {&__pyx_n_u_element, __pyx_k_element, sizeof(__pyx_k_element), 0, 1, 0, 1},
  {&__pyx_kp_u_element_class_must_be_subclass_o, __pyx_k_element_class_must_be_subclass_o, sizeof(__pyx_k_element_class_must_be_subclass_o), 0, 1, 0, 0},
  {&__pyx_n_s_element_config, __pyx_k_element_config, sizeof(__pyx_k_element_config), 0, 0, 1, 1},
  {&__pyx_n_s_element_factory, __pyx_k_element_factory, sizeof(__pyx_k_element_factory), 0, 0, 1, 1},
  {&__pyx_n_s_element_or_tree, __pyx_k_element_or_tree, sizeof(__pyx_k_element_or_tree), 0, 0, 1, 1},
  {&__pyx_n_s_elementpath, __pyx_k_elementpath, sizeof(__pyx_k_elementpath), 0, 0, 1, 1},
  {&__pyx_n_s_elements_only, __pyx_k_elements_only, sizeof(__pyx_k_elements_only), 0, 0, 1, 1},
  {&__pyx_n_s_elemname, __pyx_k_elemname, sizeof(__pyx_k_elemname), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_kp_u_empty_namespace_prefix_is_not_su, __pyx_k_empty_namespace_prefix_is_not_su, sizeof(__pyx_k_empty_namespace_prefix_is_not_su), 0, 1, 0, 0},
  {&__pyx_kp_u_empty_prefix_is_not_supported_in, __pyx_k_empty_prefix_is_not_supported_in, sizeof(__pyx_k_empty_prefix_is_not_supported_in), 0, 1, 0, 0},
  {&__pyx_n_s_enable_regexp, __pyx_k_enable_regexp, sizeof(__pyx_k_enable_regexp), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_u_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 1, 0, 1},
  {&__pyx_kp_s_end_ns, __pyx_k_end_ns, sizeof(__pyx_k_end_ns), 0, 0, 1, 0},
  {&__pyx_kp_u_end_ns, __pyx_k_end_ns, sizeof(__pyx_k_end_ns), 0, 1, 0, 0},
  {&__pyx_kp_u_end_tag_mismatch_expected_s_got, __pyx_k_end_tag_mismatch_expected_s_got, sizeof(__pyx_k_end_tag_mismatch_expected_s_got), 0, 1, 0, 0},
  {&__pyx_n_s_entities, __pyx_k_entities, sizeof(__pyx_k_entities), 0, 0, 1, 1},
  {&__pyx_n_s_entity, __pyx_k_entity, sizeof(__pyx_k_entity), 0, 0, 1, 1},
  {&__pyx_n_u_entity, __pyx_k_entity, sizeof(__pyx_k_entity), 0, 1, 0, 1},
  {&__pyx_n_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_enumeration, __pyx_k_enumeration, sizeof(__pyx_k_enumeration), 0, 0, 1, 1},
  {&__pyx_n_s_error_log, __pyx_k_error_log, sizeof(__pyx_k_error_log), 0, 0, 1, 1},
  {&__pyx_kp_u_error_parsing_DTD, __pyx_k_error_parsing_DTD, sizeof(__pyx_k_error_parsing_DTD), 0, 1, 0, 0},
  {&__pyx_n_s_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 0, 1, 1},
  {&__pyx_n_s_etree_or_element, __pyx_k_etree_or_element, sizeof(__pyx_k_etree_or_element), 0, 0, 1, 1},
  {&__pyx_n_s_etree_or_element_2, __pyx_k_etree_or_element_2, sizeof(__pyx_k_etree_or_element_2), 0, 0, 1, 1},
  {&__pyx_n_s_eval_arg, __pyx_k_eval_arg, sizeof(__pyx_k_eval_arg), 0, 0, 1, 1},
  {&__pyx_n_s_events, __pyx_k_events, sizeof(__pyx_k_events), 0, 0, 1, 1},
  {&__pyx_n_s_exc_context, __pyx_k_exc_context, sizeof(__pyx_k_exc_context), 0, 0, 1, 1},
  {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1},
  {&__pyx_n_s_exc_tb, __pyx_k_exc_tb, sizeof(__pyx_k_exc_tb), 0, 0, 1, 1},
  {&__pyx_n_s_exc_type, __pyx_k_exc_type, sizeof(__pyx_k_exc_type), 0, 0, 1, 1},
  {&__pyx_n_s_exc_val, __pyx_k_exc_val, sizeof(__pyx_k_exc_val), 0, 0, 1, 1},
  {&__pyx_n_s_exclusive, __pyx_k_exclusive, sizeof(__pyx_k_exclusive), 0, 0, 1, 1},
  {&__pyx_n_s_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_kp_u_extension_element_s_not_found, __pyx_k_extension_element_s_not_found, sizeof(__pyx_k_extension_element_s_not_found), 0, 1, 0, 0},
  {&__pyx_n_s_extensions, __pyx_k_extensions, sizeof(__pyx_k_extensions), 0, 0, 1, 1},
  {&__pyx_kp_u_extensions_must_have_non_empty_n, __pyx_k_extensions_must_have_non_empty_n, sizeof(__pyx_k_extensions_must_have_non_empty_n), 0, 1, 0, 0},
  {&__pyx_kp_u_extensions_must_not_have_empty_n, __pyx_k_extensions_must_not_have_empty_n, sizeof(__pyx_k_extensions_must_not_have_empty_n), 0, 1, 0, 0},
  {&__pyx_n_s_external_id, __pyx_k_external_id, sizeof(__pyx_k_external_id), 0, 0, 1, 1},
  {&__pyx_n_s_extra, __pyx_k_extra, sizeof(__pyx_k_extra), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_fallback, __pyx_k_fallback, sizeof(__pyx_k_fallback), 0, 0, 1, 1},
  {&__pyx_n_s_feed, __pyx_k_feed, sizeof(__pyx_k_feed), 0, 0, 1, 1},
  {&__pyx_n_s_feed_error_log, __pyx_k_feed_error_log, sizeof(__pyx_k_feed_error_log), 0, 0, 1, 1},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_kp_u_file_must_be_a_filename_or_file, __pyx_k_file_must_be_a_filename_or_file, sizeof(__pyx_k_file_must_be_a_filename_or_file), 0, 1, 0, 0},
  {&__pyx_n_s_filelike, __pyx_k_filelike, sizeof(__pyx_k_filelike), 0, 0, 1, 1},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_fileobj, __pyx_k_fileobj, sizeof(__pyx_k_fileobj), 0, 0, 1, 1},
  {&__pyx_n_s_filter_from_errors, __pyx_k_filter_from_errors, sizeof(__pyx_k_filter_from_errors), 0, 0, 1, 1},
  {&__pyx_n_s_filter_from_level, __pyx_k_filter_from_level, sizeof(__pyx_k_filter_from_level), 0, 0, 1, 1},
  {&__pyx_n_s_filter_types, __pyx_k_filter_types, sizeof(__pyx_k_filter_types), 0, 0, 1, 1},
  {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1},
  {&__pyx_n_s_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 0, 0, 1, 1},
  {&__pyx_n_s_findtext, __pyx_k_findtext, sizeof(__pyx_k_findtext), 0, 0, 1, 1},
  {&__pyx_n_s_first_error, __pyx_k_first_error, sizeof(__pyx_k_first_error), 0, 0, 1, 1},
  {&__pyx_n_s_fixed, __pyx_k_fixed, sizeof(__pyx_k_fixed), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_for_html, __pyx_k_for_html, sizeof(__pyx_k_for_html), 0, 0, 1, 1},
  {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1},
  {&__pyx_n_s_fromstringlist, __pyx_k_fromstringlist, sizeof(__pyx_k_fromstringlist), 0, 0, 1, 1},
  {&__pyx_n_s_function_mapping, __pyx_k_function_mapping, sizeof(__pyx_k_function_mapping), 0, 0, 1, 1},
  {&__pyx_n_s_function_name, __pyx_k_function_name, sizeof(__pyx_k_function_name), 0, 0, 1, 1},
  {&__pyx_n_s_functions, __pyx_k_functions, sizeof(__pyx_k_functions), 0, 0, 1, 1},
  {&__pyx_n_u_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 1, 0, 1},
  {&__pyx_kp_u_g_1_g_2, __pyx_k_g_1_g_2, sizeof(__pyx_k_g_1_g_2), 0, 1, 0, 0},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_getName, __pyx_k_getName, sizeof(__pyx_k_getName), 0, 0, 1, 1},
  {&__pyx_n_s_get_default_parser, __pyx_k_get_default_parser, sizeof(__pyx_k_get_default_parser), 0, 0, 1, 1},
  {&__pyx_n_s_getargspec, __pyx_k_getargspec, sizeof(__pyx_k_getargspec), 0, 0, 1, 1},
  {&__pyx_n_s_getattribute, __pyx_k_getattribute, sizeof(__pyx_k_getattribute), 0, 0, 1, 1},
  {&__pyx_n_s_getchildren, __pyx_k_getchildren, sizeof(__pyx_k_getchildren), 0, 0, 1, 1},
  {&__pyx_n_s_getdefaultencoding, __pyx_k_getdefaultencoding, sizeof(__pyx_k_getdefaultencoding), 0, 0, 1, 1},
  {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
  {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
  {&__pyx_n_s_getiterator, __pyx_k_getiterator, sizeof(__pyx_k_getiterator), 0, 0, 1, 1},
  {&__pyx_n_s_getnext, __pyx_k_getnext, sizeof(__pyx_k_getnext), 0, 0, 1, 1},
  {&__pyx_n_s_getparent, __pyx_k_getparent, sizeof(__pyx_k_getparent), 0, 0, 1, 1},
  {&__pyx_n_s_getroot, __pyx_k_getroot, sizeof(__pyx_k_getroot), 0, 0, 1, 1},
  {&__pyx_n_s_geturl, __pyx_k_geturl, sizeof(__pyx_k_geturl), 0, 0, 1, 1},
  {&__pyx_n_s_getvalue, __pyx_k_getvalue, sizeof(__pyx_k_getvalue), 0, 0, 1, 1},
  {&__pyx_n_u_getvalue, __pyx_k_getvalue, sizeof(__pyx_k_getvalue), 0, 1, 0, 1},
  {&__pyx_kp_s_got_invalid_input_value_of_type, __pyx_k_got_invalid_input_value_of_type, sizeof(__pyx_k_got_invalid_input_value_of_type), 0, 0, 1, 0},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_s_groups, __pyx_k_groups, sizeof(__pyx_k_groups), 0, 0, 1, 1},
  {&__pyx_n_s_gzip, __pyx_k_gzip, sizeof(__pyx_k_gzip), 0, 0, 1, 1},
  {&__pyx_n_s_has_raised, __pyx_k_has_raised, sizeof(__pyx_k_has_raised), 0, 0, 1, 1},
  {&__pyx_kp_s_home_stefan_source_Python_lxml, __pyx_k_home_stefan_source_Python_lxml, sizeof(__pyx_k_home_stefan_source_Python_lxml), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_10, __pyx_k_home_stefan_source_Python_lxml_10, sizeof(__pyx_k_home_stefan_source_Python_lxml_10), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_11, __pyx_k_home_stefan_source_Python_lxml_11, sizeof(__pyx_k_home_stefan_source_Python_lxml_11), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_2, __pyx_k_home_stefan_source_Python_lxml_2, sizeof(__pyx_k_home_stefan_source_Python_lxml_2), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_3, __pyx_k_home_stefan_source_Python_lxml_3, sizeof(__pyx_k_home_stefan_source_Python_lxml_3), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_4, __pyx_k_home_stefan_source_Python_lxml_4, sizeof(__pyx_k_home_stefan_source_Python_lxml_4), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_5, __pyx_k_home_stefan_source_Python_lxml_5, sizeof(__pyx_k_home_stefan_source_Python_lxml_5), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_6, __pyx_k_home_stefan_source_Python_lxml_6, sizeof(__pyx_k_home_stefan_source_Python_lxml_6), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_7, __pyx_k_home_stefan_source_Python_lxml_7, sizeof(__pyx_k_home_stefan_source_Python_lxml_7), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_8, __pyx_k_home_stefan_source_Python_lxml_8, sizeof(__pyx_k_home_stefan_source_Python_lxml_8), 0, 0, 1, 0},
  {&__pyx_kp_s_home_stefan_source_Python_lxml_9, __pyx_k_home_stefan_source_Python_lxml_9, sizeof(__pyx_k_home_stefan_source_Python_lxml_9), 0, 0, 1, 0},
  {&__pyx_n_u_href, __pyx_k_href, sizeof(__pyx_k_href), 0, 1, 0, 1},
  {&__pyx_kp_u_href_s, __pyx_k_href_s, sizeof(__pyx_k_href_s), 0, 1, 0, 0},
  {&__pyx_n_b_html, __pyx_k_html, sizeof(__pyx_k_html), 0, 0, 0, 1},
  {&__pyx_n_s_html, __pyx_k_html, sizeof(__pyx_k_html), 0, 0, 1, 1},
  {&__pyx_kp_b_http_codespeak_net_lxml_objectif, __pyx_k_http_codespeak_net_lxml_objectif, sizeof(__pyx_k_http_codespeak_net_lxml_objectif), 0, 0, 0, 0},
  {&__pyx_kp_b_http_exslt_org_regular_expressio, __pyx_k_http_exslt_org_regular_expressio, sizeof(__pyx_k_http_exslt_org_regular_expressio), 0, 0, 0, 0},
  {&__pyx_kp_b_http_purl_org_dc_elements_1_1, __pyx_k_http_purl_org_dc_elements_1_1, sizeof(__pyx_k_http_purl_org_dc_elements_1_1), 0, 0, 0, 0},
  {&__pyx_kp_b_http_schemas_xmlsoap_org_wsdl, __pyx_k_http_schemas_xmlsoap_org_wsdl, sizeof(__pyx_k_http_schemas_xmlsoap_org_wsdl), 0, 0, 0, 0},
  {&__pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s, __pyx_k_http_www_w3_org_1999_02_22_rdf_s, sizeof(__pyx_k_http_www_w3_org_1999_02_22_rdf_s), 0, 0, 0, 0},
  {&__pyx_kp_b_http_www_w3_org_1999_XSL_Transfo, __pyx_k_http_www_w3_org_1999_XSL_Transfo, sizeof(__pyx_k_http_www_w3_org_1999_XSL_Transfo), 0, 0, 0, 0},
  {&__pyx_kp_u_http_www_w3_org_1999_XSL_Transfo, __pyx_k_http_www_w3_org_1999_XSL_Transfo, sizeof(__pyx_k_http_www_w3_org_1999_XSL_Transfo), 0, 1, 0, 0},
  {&__pyx_kp_b_http_www_w3_org_1999_xhtml, __pyx_k_http_www_w3_org_1999_xhtml, sizeof(__pyx_k_http_www_w3_org_1999_xhtml), 0, 0, 0, 0},
  {&__pyx_kp_b_http_www_w3_org_2001_XMLSchema, __pyx_k_http_www_w3_org_2001_XMLSchema, sizeof(__pyx_k_http_www_w3_org_2001_XMLSchema), 0, 0, 0, 0},
  {&__pyx_kp_u_http_www_w3_org_2001_XMLSchema, __pyx_k_http_www_w3_org_2001_XMLSchema, sizeof(__pyx_k_http_www_w3_org_2001_XMLSchema), 0, 1, 0, 0},
  {&__pyx_kp_b_http_www_w3_org_2001_XMLSchema_i, __pyx_k_http_www_w3_org_2001_XMLSchema_i, sizeof(__pyx_k_http_www_w3_org_2001_XMLSchema_i), 0, 0, 0, 0},
  {&__pyx_kp_b_http_www_w3_org_XML_1998_namespa, __pyx_k_http_www_w3_org_XML_1998_namespa, sizeof(__pyx_k_http_www_w3_org_XML_1998_namespa), 0, 0, 0, 0},
  {&__pyx_n_s_huge_tree, __pyx_k_huge_tree, sizeof(__pyx_k_huge_tree), 0, 0, 1, 1},
  {&__pyx_n_u_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 1, 0, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_u_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 1, 0, 1},
  {&__pyx_n_s_idref, __pyx_k_idref, sizeof(__pyx_k_idref), 0, 0, 1, 1},
  {&__pyx_n_s_idrefs, __pyx_k_idrefs, sizeof(__pyx_k_idrefs), 0, 0, 1, 1},
  {&__pyx_n_s_implied, __pyx_k_implied, sizeof(__pyx_k_implied), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_inclusive, __pyx_k_inclusive, sizeof(__pyx_k_inclusive), 0, 0, 1, 1},
  {&__pyx_n_s_inclusive_ns_prefixes, __pyx_k_inclusive_ns_prefixes, sizeof(__pyx_k_inclusive_ns_prefixes), 0, 0, 1, 1},
  {&__pyx_kp_s_inconsistent_exit_action_in_cont, __pyx_k_inconsistent_exit_action_in_cont, sizeof(__pyx_k_inconsistent_exit_action_in_cont), 0, 0, 1, 0},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_kp_u_index_out_of_range_d, __pyx_k_index_out_of_range_d, sizeof(__pyx_k_index_out_of_range_d), 0, 1, 0, 0},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init_2, __pyx_k_init_2, sizeof(__pyx_k_init_2), 0, 0, 1, 1},
  {&__pyx_n_s_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 1, 1},
  {&__pyx_n_s_input_node, __pyx_k_input_node, sizeof(__pyx_k_input_node), 0, 0, 1, 1},
  {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
  {&__pyx_kp_u_internal_error_tail, __pyx_k_internal_error_tail, sizeof(__pyx_k_internal_error_tail), 0, 1, 0, 0},
  {&__pyx_kp_u_internal_error_text, __pyx_k_internal_error_text, sizeof(__pyx_k_internal_error_text), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_DTD_proxy_at_s, __pyx_k_invalid_DTD_proxy_at_s, sizeof(__pyx_k_invalid_DTD_proxy_at_s), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_Document_proxy_at_s, __pyx_k_invalid_Document_proxy_at_s, sizeof(__pyx_k_invalid_Document_proxy_at_s), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_Element_proxy_at_s, __pyx_k_invalid_Element_proxy_at_s, sizeof(__pyx_k_invalid_Element_proxy_at_s), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_argument_type_s, __pyx_k_invalid_argument_type_s, sizeof(__pyx_k_invalid_argument_type_s), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_element, __pyx_k_invalid_element, sizeof(__pyx_k_invalid_element), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_event_name_s, __pyx_k_invalid_event_name_s, sizeof(__pyx_k_invalid_event_name_s), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_node_type_d_expected_d, __pyx_k_invalid_node_type_d_expected_d, sizeof(__pyx_k_invalid_node_type_d_expected_d), 0, 1, 0, 0},
  {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
  {&__pyx_n_s_is_attribute, __pyx_k_is_attribute, sizeof(__pyx_k_is_attribute), 0, 0, 1, 1},
  {&__pyx_n_s_is_standalone, __pyx_k_is_standalone, sizeof(__pyx_k_is_standalone), 0, 0, 1, 1},
  {&__pyx_n_s_is_tail, __pyx_k_is_tail, sizeof(__pyx_k_is_tail), 0, 0, 1, 1},
  {&__pyx_n_s_is_text, __pyx_k_is_text, sizeof(__pyx_k_is_text), 0, 0, 1, 1},
  {&__pyx_n_s_iselement, __pyx_k_iselement, sizeof(__pyx_k_iselement), 0, 0, 1, 1},
  {&__pyx_n_s_islice, __pyx_k_islice, sizeof(__pyx_k_islice), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_u_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 1, 0, 1},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_iter_2, __pyx_k_iter_2, sizeof(__pyx_k_iter_2), 0, 0, 1, 1},
  {&__pyx_n_s_iterattributes, __pyx_k_iterattributes, sizeof(__pyx_k_iterattributes), 0, 0, 1, 1},
  {&__pyx_n_s_iterelements, __pyx_k_iterelements, sizeof(__pyx_k_iterelements), 0, 0, 1, 1},
  {&__pyx_n_s_iterentities, __pyx_k_iterentities, sizeof(__pyx_k_iterentities), 0, 0, 1, 1},
  {&__pyx_n_s_iterfind, __pyx_k_iterfind, sizeof(__pyx_k_iterfind), 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_iterparse, __pyx_k_iterparse, sizeof(__pyx_k_iterparse), 0, 0, 1, 1},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_s_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_iterwalk, __pyx_k_iterwalk, sizeof(__pyx_k_iterwalk), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_kp_u_key_not_found, __pyx_k_key_not_found, sizeof(__pyx_k_key_not_found), 0, 1, 0, 0},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_last_error, __pyx_k_last_error, sizeof(__pyx_k_last_error), 0, 0, 1, 1},
  {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1},
  {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
  {&__pyx_n_s_level_name, __pyx_k_level_name, sizeof(__pyx_k_level_name), 0, 0, 1, 1},
  {&__pyx_kp_u_libxml2_d_d_d, __pyx_k_libxml2_d_d_d, sizeof(__pyx_k_libxml2_d_d_d), 0, 1, 0, 0},
  {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
  {&__pyx_kp_u_line_d_s, __pyx_k_line_d_s, sizeof(__pyx_k_line_d_s), 0, 1, 0, 0},
  {&__pyx_kp_u_list_index_out_of_range, __pyx_k_list_index_out_of_range, sizeof(__pyx_k_list_index_out_of_range), 0, 1, 0, 0},
  {&__pyx_kp_u_list_index_x_x_not_in_list, __pyx_k_list_index_x_x_not_in_list, sizeof(__pyx_k_list_index_x_x_not_in_list), 0, 1, 0, 0},
  {&__pyx_kp_u_list_index_x_x_not_in_slice, __pyx_k_list_index_x_x_not_in_slice, sizeof(__pyx_k_list_index_x_x_not_in_slice), 0, 1, 0, 0},
  {&__pyx_n_s_load_dtd, __pyx_k_load_dtd, sizeof(__pyx_k_load_dtd), 0, 0, 1, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_s_log_entry, __pyx_k_log_entry, sizeof(__pyx_k_log_entry), 0, 0, 1, 1},
  {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  {&__pyx_n_s_logger_name, __pyx_k_logger_name, sizeof(__pyx_k_logger_name), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_lookup, __pyx_k_lookup, sizeof(__pyx_k_lookup), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
  {&__pyx_n_s_lxml_etree, __pyx_k_lxml_etree, sizeof(__pyx_k_lxml_etree), 0, 0, 1, 1},
  {&__pyx_kp_u_lxml_etree_was_compiled_without, __pyx_k_lxml_etree_was_compiled_without, sizeof(__pyx_k_lxml_etree_was_compiled_without), 0, 1, 0, 0},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 0, 0, 1, 1},
  {&__pyx_kp_u_malformed_PI_attributes, __pyx_k_malformed_PI_attributes, sizeof(__pyx_k_malformed_PI_attributes), 0, 1, 0, 0},
  {&__pyx_n_b_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 0, 1},
  {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
  {&__pyx_n_u_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 1, 0, 1},
  {&__pyx_n_s_matcher, __pyx_k_matcher, sizeof(__pyx_k_matcher), 0, 0, 1, 1},
  {&__pyx_n_u_matches, __pyx_k_matches, sizeof(__pyx_k_matches), 0, 1, 0, 1},
  {&__pyx_n_s_max_depth, __pyx_k_max_depth, sizeof(__pyx_k_max_depth), 0, 0, 1, 1},
  {&__pyx_n_s_max_len, __pyx_k_max_len, sizeof(__pyx_k_max_len), 0, 0, 1, 1},
  {&__pyx_n_s_memory_debugger, __pyx_k_memory_debugger, sizeof(__pyx_k_memory_debugger), 0, 0, 1, 1},
  {&__pyx_kp_b_memorydump, __pyx_k_memorydump, sizeof(__pyx_k_memorydump), 0, 0, 0, 0},
  {&__pyx_kp_b_memorylist, __pyx_k_memorylist, sizeof(__pyx_k_memorylist), 0, 0, 0, 0},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
  {&__pyx_kp_u_missing_end_tags, __pyx_k_missing_end_tags, sizeof(__pyx_k_missing_end_tags), 0, 1, 0, 0},
  {&__pyx_kp_u_missing_toplevel_element, __pyx_k_missing_toplevel_element, sizeof(__pyx_k_missing_toplevel_element), 0, 1, 0, 0},
  {&__pyx_n_s_mixed, __pyx_k_mixed, sizeof(__pyx_k_mixed), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_module_2, __pyx_k_module_2, sizeof(__pyx_k_module_2), 0, 0, 1, 1},
  {&__pyx_n_s_mult, __pyx_k_mult, sizeof(__pyx_k_mult), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_name_utf, __pyx_k_name_utf, sizeof(__pyx_k_name_utf), 0, 0, 1, 1},
  {&__pyx_n_s_names, __pyx_k_names, sizeof(__pyx_k_names), 0, 0, 1, 1},
  {&__pyx_n_s_namespace, __pyx_k_namespace, sizeof(__pyx_k_namespace), 0, 0, 1, 1},
  {&__pyx_n_s_namespaces, __pyx_k_namespaces, sizeof(__pyx_k_namespaces), 0, 0, 1, 1},
  {&__pyx_n_s_new_element, __pyx_k_new_element, sizeof(__pyx_k_new_element), 0, 0, 1, 1},
  {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
  {&__pyx_n_s_nmtoken, __pyx_k_nmtoken, sizeof(__pyx_k_nmtoken), 0, 0, 1, 1},
  {&__pyx_n_s_nmtokens, __pyx_k_nmtokens, sizeof(__pyx_k_nmtokens), 0, 0, 1, 1},
  {&__pyx_kp_s_no_content_written, __pyx_k_no_content_written, sizeof(__pyx_k_no_content_written), 0, 0, 1, 0},
  {&__pyx_kp_u_no_context_node, __pyx_k_no_context_node, sizeof(__pyx_k_no_context_node), 0, 1, 0, 0},
  {&__pyx_kp_u_no_element_found, __pyx_k_no_element_found, sizeof(__pyx_k_no_element_found), 0, 1, 0, 0},
  {&__pyx_n_s_no_network, __pyx_k_no_network, sizeof(__pyx_k_no_network), 0, 0, 1, 1},
  {&__pyx_n_s_node, __pyx_k_node, sizeof(__pyx_k_node), 0, 0, 1, 1},
  {&__pyx_n_s_none, __pyx_k_none, sizeof(__pyx_k_none), 0, 0, 1, 1},
  {&__pyx_kp_s_not_in_an_element, __pyx_k_not_in_an_element, sizeof(__pyx_k_not_in_an_element), 0, 0, 1, 0},
  {&__pyx_n_s_notation, __pyx_k_notation, sizeof(__pyx_k_notation), 0, 0, 1, 1},
  {&__pyx_n_s_ns, __pyx_k_ns, sizeof(__pyx_k_ns), 0, 0, 1, 1},
  {&__pyx_n_s_ns_clean, __pyx_k_ns_clean, sizeof(__pyx_k_ns_clean), 0, 0, 1, 1},
  {&__pyx_kp_s_ns_d, __pyx_k_ns_d, sizeof(__pyx_k_ns_d), 0, 0, 1, 0},
  {&__pyx_kp_b_ns_d_2, __pyx_k_ns_d_2, sizeof(__pyx_k_ns_d_2), 0, 0, 0, 0},
  {&__pyx_n_s_ns_tags, __pyx_k_ns_tags, sizeof(__pyx_k_ns_tags), 0, 0, 1, 1},
  {&__pyx_n_s_ns_uri, __pyx_k_ns_uri, sizeof(__pyx_k_ns_uri), 0, 0, 1, 1},
  {&__pyx_n_s_ns_utf, __pyx_k_ns_utf, sizeof(__pyx_k_ns_utf), 0, 0, 1, 1},
  {&__pyx_n_s_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_occur, __pyx_k_occur, sizeof(__pyx_k_occur), 0, 0, 1, 1},
  {&__pyx_n_s_old_element, __pyx_k_old_element, sizeof(__pyx_k_old_element), 0, 0, 1, 1},
  {&__pyx_n_s_once, __pyx_k_once, sizeof(__pyx_k_once), 0, 0, 1, 1},
  {&__pyx_kp_u_only_setting_the_href_attribute, __pyx_k_only_setting_the_href_attribute, sizeof(__pyx_k_only_setting_the_href_attribute), 0, 1, 0, 0},
  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
  {&__pyx_n_s_opt, __pyx_k_opt, sizeof(__pyx_k_opt), 0, 0, 1, 1},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_s_or, __pyx_k_or, sizeof(__pyx_k_or), 0, 0, 1, 1},
  {&__pyx_n_s_os_path, __pyx_k_os_path, sizeof(__pyx_k_os_path), 0, 0, 1, 1},
  {&__pyx_n_s_outfile, __pyx_k_outfile, sizeof(__pyx_k_outfile), 0, 0, 1, 1},
  {&__pyx_n_s_output_file, __pyx_k_output_file, sizeof(__pyx_k_output_file), 0, 0, 1, 1},
  {&__pyx_n_s_output_parent, __pyx_k_output_parent, sizeof(__pyx_k_output_parent), 0, 0, 1, 1},
  {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
  {&__pyx_n_s_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 0, 0, 1, 1},
  {&__pyx_n_s_parse_options, __pyx_k_parse_options, sizeof(__pyx_k_parse_options), 0, 0, 1, 1},
  {&__pyx_n_s_parseid, __pyx_k_parseid, sizeof(__pyx_k_parseid), 0, 0, 1, 1},
  {&__pyx_n_s_parser, __pyx_k_parser, sizeof(__pyx_k_parser), 0, 0, 1, 1},
  {&__pyx_kp_u_parser_locking_failed, __pyx_k_parser_locking_failed, sizeof(__pyx_k_parser_locking_failed), 0, 1, 0, 0},
  {&__pyx_kp_s_passing_a_single_string_into_fro, __pyx_k_passing_a_single_string_into_fro, sizeof(__pyx_k_passing_a_single_string_into_fro), 0, 0, 1, 0},
  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_path_2, __pyx_k_path_2, sizeof(__pyx_k_path_2), 0, 0, 1, 1},
  {&__pyx_n_s_pcdata, __pyx_k_pcdata, sizeof(__pyx_k_pcdata), 0, 0, 1, 1},
  {&__pyx_kp_s_pending_open_tags_on_close, __pyx_k_pending_open_tags_on_close, sizeof(__pyx_k_pending_open_tags_on_close), 0, 0, 1, 0},
  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
  {&__pyx_n_s_plus, __pyx_k_plus, sizeof(__pyx_k_plus), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_kp_u_pop_expected_at_most_2_arguments, __pyx_k_pop_expected_at_most_2_arguments, sizeof(__pyx_k_pop_expected_at_most_2_arguments), 0, 1, 0, 0},
  {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
  {&__pyx_n_s_preceding, __pyx_k_preceding, sizeof(__pyx_k_preceding), 0, 0, 1, 1},
  {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_prefix_utf, __pyx_k_prefix_utf, sizeof(__pyx_k_prefix_utf), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_pretty_print, __pyx_k_pretty_print, sizeof(__pyx_k_pretty_print), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_profile_run, __pyx_k_profile_run, sizeof(__pyx_k_profile_run), 0, 0, 1, 1},
  {&__pyx_n_s_public_id, __pyx_k_public_id, sizeof(__pyx_k_public_id), 0, 0, 1, 1},
  {&__pyx_n_b_py, __pyx_k_py, sizeof(__pyx_k_py), 0, 0, 0, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 0, 1, 1},
  {&__pyx_n_b_rdf, __pyx_k_rdf, sizeof(__pyx_k_rdf), 0, 0, 0, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
  {&__pyx_n_u_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 1, 0, 1},
  {&__pyx_n_s_read_events, __pyx_k_read_events, sizeof(__pyx_k_read_events), 0, 0, 1, 1},
  {&__pyx_n_s_read_file, __pyx_k_read_file, sizeof(__pyx_k_read_file), 0, 0, 1, 1},
  {&__pyx_n_u_read_file, __pyx_k_read_file, sizeof(__pyx_k_read_file), 0, 1, 0, 1},
  {&__pyx_n_s_read_network, __pyx_k_read_network, sizeof(__pyx_k_read_network), 0, 0, 1, 1},
  {&__pyx_n_u_read_network, __pyx_k_read_network, sizeof(__pyx_k_read_network), 0, 1, 0, 1},
  {&__pyx_kp_s_reading_file_objects_must_return, __pyx_k_reading_file_objects_must_return, sizeof(__pyx_k_reading_file_objects_must_return), 0, 0, 1, 0},
  {&__pyx_kp_u_reading_from_file_like_objects_m, __pyx_k_reading_from_file_like_objects_m, sizeof(__pyx_k_reading_from_file_like_objects_m), 0, 1, 0, 0},
  {&__pyx_n_s_receive, __pyx_k_receive, sizeof(__pyx_k_receive), 0, 0, 1, 1},
  {&__pyx_n_s_recover, __pyx_k_recover, sizeof(__pyx_k_recover), 0, 0, 1, 1},
  {&__pyx_kp_u_reference_to_non_existing_embedd, __pyx_k_reference_to_non_existing_embedd, sizeof(__pyx_k_reference_to_non_existing_embedd), 0, 1, 0, 0},
  {&__pyx_n_s_regexp, __pyx_k_regexp, sizeof(__pyx_k_regexp), 0, 0, 1, 1},
  {&__pyx_n_s_register_namespace, __pyx_k_register_namespace, sizeof(__pyx_k_register_namespace), 0, 0, 1, 1},
  {&__pyx_n_s_registry, __pyx_k_registry, sizeof(__pyx_k_registry), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_remove_blank_text, __pyx_k_remove_blank_text, sizeof(__pyx_k_remove_blank_text), 0, 0, 1, 1},
  {&__pyx_n_s_remove_comments, __pyx_k_remove_comments, sizeof(__pyx_k_remove_comments), 0, 0, 1, 1},
  {&__pyx_n_s_remove_pis, __pyx_k_remove_pis, sizeof(__pyx_k_remove_pis), 0, 0, 1, 1},
  {&__pyx_n_b_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 0, 1},
  {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_replacement, __pyx_k_replacement, sizeof(__pyx_k_replacement), 0, 0, 1, 1},
  {&__pyx_n_s_required, __pyx_k_required, sizeof(__pyx_k_required), 0, 0, 1, 1},
  {&__pyx_n_s_resolve, __pyx_k_resolve, sizeof(__pyx_k_resolve), 0, 0, 1, 1},
  {&__pyx_n_s_resolve_entities, __pyx_k_resolve_entities, sizeof(__pyx_k_resolve_entities), 0, 0, 1, 1},
  {&__pyx_n_s_resolvers, __pyx_k_resolvers, sizeof(__pyx_k_resolvers), 0, 0, 1, 1},
  {&__pyx_kp_u_restructuredtext_en, __pyx_k_restructuredtext_en, sizeof(__pyx_k_restructuredtext_en), 0, 1, 0, 0},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_result_container, __pyx_k_result_container, sizeof(__pyx_k_result_container), 0, 0, 1, 1},
  {&__pyx_kp_s_result_of_class_lookup_must_be_s, __pyx_k_result_of_class_lookup_must_be_s, sizeof(__pyx_k_result_of_class_lookup_must_be_s), 0, 0, 1, 0},
  {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
  {&__pyx_n_s_rexp, __pyx_k_rexp, sizeof(__pyx_k_rexp), 0, 0, 1, 1},
  {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
  {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
  {&__pyx_kp_u_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 1, 0, 0},
  {&__pyx_kp_u_s_3, __pyx_k_s_3, sizeof(__pyx_k_s_3), 0, 1, 0, 0},
  {&__pyx_n_s_s_4, __pyx_k_s_4, sizeof(__pyx_k_s_4), 0, 0, 1, 1},
  {&__pyx_kp_u_s_a_zA_Z0_9__s_s_0_9, __pyx_k_s_a_zA_Z0_9__s_s_0_9, sizeof(__pyx_k_s_a_zA_Z0_9__s_s_0_9), 0, 1, 0, 0},
  {&__pyx_kp_u_s_d_d_s_s_s_s, __pyx_k_s_d_d_s_s_s_s, sizeof(__pyx_k_s_d_d_s_s_s_s), 0, 1, 0, 0},
  {&__pyx_kp_u_s_href_s_s, __pyx_k_s_href_s_s, sizeof(__pyx_k_s_href_s_s), 0, 1, 0, 0},
  {&__pyx_kp_u_s_line_d, __pyx_k_s_line_d, sizeof(__pyx_k_s_line_d), 0, 1, 0, 0},
  {&__pyx_kp_u_s_line_d_column_d, __pyx_k_s_line_d_column_d, sizeof(__pyx_k_s_line_d_column_d), 0, 1, 0, 0},
  {&__pyx_kp_u_s_r, __pyx_k_s_r, sizeof(__pyx_k_s_r), 0, 1, 0, 0},
  {&__pyx_kp_u_s_s_2, __pyx_k_s_s_2, sizeof(__pyx_k_s_s_2), 0, 1, 0, 0},
  {&__pyx_kp_u_s_s_3, __pyx_k_s_s_3, sizeof(__pyx_k_s_s_3), 0, 1, 0, 0},
  {&__pyx_kp_u_s_s_4, __pyx_k_s_s_4, sizeof(__pyx_k_s_s_4), 0, 1, 0, 0},
  {&__pyx_kp_s_s_s_object_name_r_at_0x_x, __pyx_k_s_s_object_name_r_at_0x_x, sizeof(__pyx_k_s_s_object_name_r_at_0x_x), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_object_name_r_elemname_r_pr, __pyx_k_s_s_object_name_r_elemname_r_pr, sizeof(__pyx_k_s_s_object_name_r_elemname_r_pr), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_object_name_r_prefix_r_type, __pyx_k_s_s_object_name_r_prefix_r_type, sizeof(__pyx_k_s_s_object_name_r_prefix_r_type), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_object_name_r_type_r_occur, __pyx_k_s_s_object_name_r_type_r_occur, sizeof(__pyx_k_s_s_object_name_r_type_r_occur), 0, 0, 1, 0},
  {&__pyx_kp_u_s_w_s_s, __pyx_k_s_w_s_s, sizeof(__pyx_k_s_w_s_s), 0, 1, 0, 0},
  {&__pyx_n_s_schema, __pyx_k_schema, sizeof(__pyx_k_schema), 0, 0, 1, 1},
  {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_self_node, __pyx_k_self_node, sizeof(__pyx_k_self_node), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_seq, __pyx_k_seq, sizeof(__pyx_k_seq), 0, 0, 1, 1},
  {&__pyx_n_s_set_default_parser, __pyx_k_set_default_parser, sizeof(__pyx_k_set_default_parser), 0, 0, 1, 1},
  {&__pyx_n_s_set_element_class_lookup, __pyx_k_set_element_class_lookup, sizeof(__pyx_k_set_element_class_lookup), 0, 0, 1, 1},
  {&__pyx_n_s_set_global_max_depth, __pyx_k_set_global_max_depth, sizeof(__pyx_k_set_global_max_depth), 0, 0, 1, 1},
  {&__pyx_n_s_setitem, __pyx_k_setitem, sizeof(__pyx_k_setitem), 0, 0, 1, 1},
  {&__pyx_kp_u_setting_default_namespace_is_not, __pyx_k_setting_default_namespace_is_not, sizeof(__pyx_k_setting_default_namespace_is_not), 0, 1, 0, 0},
  {&__pyx_n_s_smart_strings, __pyx_k_smart_strings, sizeof(__pyx_k_smart_strings), 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_standalone, __pyx_k_standalone, sizeof(__pyx_k_standalone), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_u_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 1, 0, 1},
  {&__pyx_kp_s_start_ns, __pyx_k_start_ns, sizeof(__pyx_k_start_ns), 0, 0, 1, 0},
  {&__pyx_kp_u_start_ns, __pyx_k_start_ns, sizeof(__pyx_k_start_ns), 0, 1, 0, 0},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_store_exception, __pyx_k_store_exception, sizeof(__pyx_k_store_exception), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_kp_u_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 1, 0, 0},
  {&__pyx_n_s_string_2, __pyx_k_string_2, sizeof(__pyx_k_string_2), 0, 0, 1, 1},
  {&__pyx_kp_u_string___STRING__XSLT___d_xslt, __pyx_k_string___STRING__XSLT___d_xslt, sizeof(__pyx_k_string___STRING__XSLT___d_xslt), 0, 1, 0, 0},
  {&__pyx_kp_u_string_id, __pyx_k_string_id, sizeof(__pyx_k_string_id), 0, 1, 0, 0},
  {&__pyx_n_s_strings, __pyx_k_strings, sizeof(__pyx_k_strings), 0, 0, 1, 1},
  {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
  {&__pyx_n_s_strip_attributes, __pyx_k_strip_attributes, sizeof(__pyx_k_strip_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_strip_cdata, __pyx_k_strip_cdata, sizeof(__pyx_k_strip_cdata), 0, 0, 1, 1},
  {&__pyx_n_s_strip_comments, __pyx_k_strip_comments, sizeof(__pyx_k_strip_comments), 0, 0, 1, 1},
  {&__pyx_n_s_strip_elements, __pyx_k_strip_elements, sizeof(__pyx_k_strip_elements), 0, 0, 1, 1},
  {&__pyx_n_s_strip_entities, __pyx_k_strip_entities, sizeof(__pyx_k_strip_entities), 0, 0, 1, 1},
  {&__pyx_n_s_strip_pis, __pyx_k_strip_pis, sizeof(__pyx_k_strip_pis), 0, 0, 1, 1},
  {&__pyx_n_s_strip_tags, __pyx_k_strip_tags, sizeof(__pyx_k_strip_tags), 0, 0, 1, 1},
  {&__pyx_n_s_strparam, __pyx_k_strparam, sizeof(__pyx_k_strparam), 0, 0, 1, 1},
  {&__pyx_n_s_strval, __pyx_k_strval, sizeof(__pyx_k_strval), 0, 0, 1, 1},
  {&__pyx_n_s_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_system_url, __pyx_k_system_url, sizeof(__pyx_k_system_url), 0, 0, 1, 1},
  {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
  {&__pyx_n_s_tag_2, __pyx_k_tag_2, sizeof(__pyx_k_tag_2), 0, 0, 1, 1},
  {&__pyx_n_s_tag_names, __pyx_k_tag_names, sizeof(__pyx_k_tag_names), 0, 0, 1, 1},
  {&__pyx_n_s_tags, __pyx_k_tags, sizeof(__pyx_k_tags), 0, 0, 1, 1},
  {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
  {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
  {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
  {&__pyx_n_u_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 1, 0, 1},
  {&__pyx_n_b_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 0, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1},
  {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
  {&__pyx_n_s_text_or_uri_or_element, __pyx_k_text_or_uri_or_element, sizeof(__pyx_k_text_or_uri_or_element), 0, 0, 1, 1},
  {&__pyx_kp_s_text_root, __pyx_k_text_root, sizeof(__pyx_k_text_root), 0, 0, 1, 0},
  {&__pyx_kp_u_this_element_does_not_have_child, __pyx_k_this_element_does_not_have_child, sizeof(__pyx_k_this_element_does_not_have_child), 0, 1, 0, 0},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
  {&__pyx_n_s_tostringlist, __pyx_k_tostringlist, sizeof(__pyx_k_tostringlist), 0, 0, 1, 1},
  {&__pyx_n_s_tounicode, __pyx_k_tounicode, sizeof(__pyx_k_tounicode), 0, 0, 1, 1},
  {&__pyx_n_s_tree, __pyx_k_tree, sizeof(__pyx_k_tree), 0, 0, 1, 1},
  {&__pyx_n_s_tree_or_element, __pyx_k_tree_or_element, sizeof(__pyx_k_tree_or_element), 0, 0, 1, 1},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_n_s_type_name, __pyx_k_type_name, sizeof(__pyx_k_type_name), 0, 0, 1, 1},
  {&__pyx_kp_u_undecodable_error_message, __pyx_k_undecodable_error_message, sizeof(__pyx_k_undecodable_error_message), 0, 1, 0, 0},
  {&__pyx_n_s_undefined, __pyx_k_undefined, sizeof(__pyx_k_undefined), 0, 0, 1, 1},
  {&__pyx_n_s_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 0, 1, 1},
  {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1},
  {&__pyx_n_s_unicode_2, __pyx_k_unicode_2, sizeof(__pyx_k_unicode_2), 0, 0, 1, 1},
  {&__pyx_n_u_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 1, 0, 1},
  {&__pyx_kp_u_unknown_encoding_s, __pyx_k_unknown_encoding_s, sizeof(__pyx_k_unknown_encoding_s), 0, 1, 0, 0},
  {&__pyx_kp_u_unknown_error, __pyx_k_unknown_error, sizeof(__pyx_k_unknown_error), 0, 1, 0, 0},
  {&__pyx_kp_u_unknown_error_d, __pyx_k_unknown_error_d, sizeof(__pyx_k_unknown_error_d), 0, 1, 0, 0},
  {&__pyx_kp_u_unknown_output_method_r, __pyx_k_unknown_output_method_r, sizeof(__pyx_k_unknown_output_method_r), 0, 1, 0, 0},
  {&__pyx_kp_u_unsupported_XSLT_result_type_d, __pyx_k_unsupported_XSLT_result_type_d, sizeof(__pyx_k_unsupported_XSLT_result_type_d), 0, 1, 0, 0},
  {&__pyx_kp_u_unsupported_element_type_for_top, __pyx_k_unsupported_element_type_for_top, sizeof(__pyx_k_unsupported_element_type_for_top), 0, 1, 0, 0},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
  {&__pyx_n_s_uri_utf, __pyx_k_uri_utf, sizeof(__pyx_k_uri_utf), 0, 0, 1, 1},
  {&__pyx_n_s_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 0, 1, 1},
  {&__pyx_n_s_use_global_python_log, __pyx_k_use_global_python_log, sizeof(__pyx_k_use_global_python_log), 0, 0, 1, 1},
  {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
  {&__pyx_n_u_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 1, 0, 1},
  {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_validate, __pyx_k_validate, sizeof(__pyx_k_validate), 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_variables, __pyx_k_variables, sizeof(__pyx_k_variables), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_version_2, __pyx_k_version_2, sizeof(__pyx_k_version_2), 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_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 0, 1, 1},
  {&__pyx_n_s_with_comments, __pyx_k_with_comments, sizeof(__pyx_k_with_comments), 0, 0, 1, 1},
  {&__pyx_n_s_with_tail, __pyx_k_with_tail, sizeof(__pyx_k_with_tail), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_write_declaration, __pyx_k_write_declaration, sizeof(__pyx_k_write_declaration), 0, 0, 1, 1},
  {&__pyx_n_s_write_file, __pyx_k_write_file, sizeof(__pyx_k_write_file), 0, 0, 1, 1},
  {&__pyx_n_u_write_file, __pyx_k_write_file, sizeof(__pyx_k_write_file), 0, 1, 0, 1},
  {&__pyx_n_s_write_network, __pyx_k_write_network, sizeof(__pyx_k_write_network), 0, 0, 1, 1},
  {&__pyx_n_u_write_network, __pyx_k_write_network, sizeof(__pyx_k_write_network), 0, 1, 0, 1},
  {&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 0, 1, 1},
  {&__pyx_n_b_wsdl, __pyx_k_wsdl, sizeof(__pyx_k_wsdl), 0, 0, 0, 1},
  {&__pyx_n_b_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 0, 0, 0, 1},
  {&__pyx_n_s_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 0, 0, 1, 1},
  {&__pyx_n_u_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 0, 1, 0, 1},
  {&__pyx_n_s_xml_declaration, __pyx_k_xml_declaration, sizeof(__pyx_k_xml_declaration), 0, 0, 1, 1},
  {&__pyx_kp_u_xml_s_encoding_s_s_s, __pyx_k_xml_s_encoding_s_s_s, sizeof(__pyx_k_xml_s_encoding_s_s_s), 0, 1, 0, 0},
  {&__pyx_n_b_xmlns, __pyx_k_xmlns, sizeof(__pyx_k_xmlns), 0, 0, 0, 1},
  {&__pyx_n_s_xpath_name, __pyx_k_xpath_name, sizeof(__pyx_k_xpath_name), 0, 0, 1, 1},
  {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  {&__pyx_n_b_xs, __pyx_k_xs, sizeof(__pyx_k_xs), 0, 0, 0, 1},
  {&__pyx_n_u_xs, __pyx_k_xs, sizeof(__pyx_k_xs), 0, 1, 0, 1},
  {&__pyx_n_b_xsi, __pyx_k_xsi, sizeof(__pyx_k_xsi), 0, 0, 0, 1},
  {&__pyx_n_b_xsl, __pyx_k_xsl, sizeof(__pyx_k_xsl), 0, 0, 0, 1},
  {&__pyx_n_u_xsl, __pyx_k_xsl, sizeof(__pyx_k_xsl), 0, 1, 0, 1},
  {&__pyx_kp_u_xsl_stylesheet_xml_id_id, __pyx_k_xsl_stylesheet_xml_id_id, sizeof(__pyx_k_xsl_stylesheet_xml_id_id), 0, 1, 0, 0},
  {&__pyx_n_s_xslt_2, __pyx_k_xslt_2, sizeof(__pyx_k_xslt_2), 0, 0, 1, 1},
  {&__pyx_n_s_xslt_input, __pyx_k_xslt_input, sizeof(__pyx_k_xslt_input), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_SyntaxError = __Pyx_GetBuiltinName(__pyx_n_s_SyntaxError); if (!__pyx_builtin_SyntaxError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  __pyx_builtin_UnicodeEncodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeEncodeError); if (!__pyx_builtin_UnicodeEncodeError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_FutureWarning = __Pyx_GetBuiltinName(__pyx_n_s_FutureWarning); if (!__pyx_builtin_FutureWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ReferenceError = __Pyx_GetBuiltinName(__pyx_n_s_ReferenceError); if (!__pyx_builtin_ReferenceError) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_LookupError = __Pyx_GetBuiltinName(__pyx_n_s_LookupError); if (!__pyx_builtin_LookupError) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_VERSION_HEX < 0x02050000
  __pyx_builtin_BaseException = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_BaseException) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_builtin_BaseException = __Pyx_GetBuiltinName(__pyx_n_s_BaseException); if (!__pyx_builtin_BaseException) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":196
 *     prefix_utf, uri_utf = _utf8(prefix), _utf8(uri)
 *     if _check_internal_prefix(prefix_utf):
 *         raise ValueError("Prefix format reserved for internal use")             # <<<<<<<<<<<<<<
 *     _tagValidOrRaise(prefix_utf)
 *     _uriValidOrRaise(uri_utf)
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Prefix_format_reserved_for_inter); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":243
 * cdef __unpackDottedVersion(version):
 *     version_list = []
 *     l = (version.decode("ascii").replace(u'-', u'.').split(u'.') + [0]*4)[:4]             # <<<<<<<<<<<<<<
 *     for item in l:
 *         try:
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_u__3, __pyx_kp_u__4); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u__4); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_slice__7 = PySlice_New(Py_None, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__7);
  __Pyx_GIVEREF(__pyx_slice__7);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":248
 *             item = int(item)
 *         except ValueError:
 *             if item.startswith(u'dev'):             # <<<<<<<<<<<<<<
 *                 count = item[3:]
 *                 item = -300
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_u_dev); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":249
 *         except ValueError:
 *             if item.startswith(u'dev'):
 *                 count = item[3:]             # <<<<<<<<<<<<<<
 *                 item = -300
 *             elif item.startswith(u'alpha'):
 */
  __pyx_slice__9 = PySlice_New(__pyx_int_3, Py_None, Py_None); if (unlikely(!__pyx_slice__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__9);
  __Pyx_GIVEREF(__pyx_slice__9);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":251
 *                 count = item[3:]
 *                 item = -300
 *             elif item.startswith(u'alpha'):             # <<<<<<<<<<<<<<
 *                 count = item[5:]
 *                 item = -200
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_u_alpha); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":252
 *                 item = -300
 *             elif item.startswith(u'alpha'):
 *                 count = item[5:]             # <<<<<<<<<<<<<<
 *                 item = -200
 *             elif item.startswith(u'beta'):
 */
  __pyx_slice__11 = PySlice_New(__pyx_int_5, Py_None, Py_None); if (unlikely(!__pyx_slice__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__11);
  __Pyx_GIVEREF(__pyx_slice__11);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":254
 *                 count = item[5:]
 *                 item = -200
 *             elif item.startswith(u'beta'):             # <<<<<<<<<<<<<<
 *                 count = item[4:]
 *                 item = -100
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_u_beta); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":255
 *                 item = -200
 *             elif item.startswith(u'beta'):
 *                 count = item[4:]             # <<<<<<<<<<<<<<
 *                 item = -100
 *             else:
 */
  __pyx_slice__13 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__13);
  __Pyx_GIVEREF(__pyx_slice__13);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1249
 *     while c_parent:
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 *     # store possible text node
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_cannot_append_parent_to_itself); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1271
 *     while c_parent:
 *         if c_parent is c_node:
 *             raise ValueError("cannot append parent to itself")             # <<<<<<<<<<<<<<
 *         c_parent = c_parent.parent
 *     # store possible text node
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_cannot_append_parent_to_itself); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1395
 *         raise TypeError("Argument must be bytes or unicode, got '%.200s'" % type(s).__name__)
 *     if invalid:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             "All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters")
 *     return utf8_string
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_All_strings_must_be_XML_compatib); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1443
 *         return filename8
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef object _decodeFilename(const_xmlChar* c_path):
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Argument_must_be_string_or_unico); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":1492
 *         return (<unicode>filename).encode('utf8')
 *     else:
 *         raise TypeError("Argument must be string or unicode.")             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _getNsTag(tag):
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Argument_must_be_string_or_unico); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":557
 *     except KeyError:
 *         log = (<object>thread_dict)[u"_GlobalErrorLog"] = \
 *               _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 *         return log
 * 
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_int_100); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":697
 *     u"Called at setup time to parse the constants and build the classes below."
 *     global __ERROR_LEVELS, __ERROR_DOMAINS, __PARSER_ERROR_TYPES, __RELAXNG_ERROR_TYPES
 *     find_constants = re.compile(ur"\s*([a-zA-Z0-9_]+)\s*=\s*([0-9]+)").findall             # <<<<<<<<<<<<<<
 *     const_defs = ((ErrorLevels,          __ERROR_LEVELS),
 *                   (ErrorDomains,         __ERROR_DOMAINS),
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_s_a_zA_Z0_9__s_s_0_9); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1918
 *         if method == 'c14n':
 *             if encoding is not None:
 *                 raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Cannot_specify_encoding_with_C14); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1920
 *                 raise ValueError("Cannot specify encoding with C14N")
 *             if xml_declaration:
 *                 raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 * 
 *             _tofilelikeC14N(file, self._context_node, exclusive, with_comments,
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Cannot_enable_XML_declaration_in); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1926
 *             return
 *         if not with_comments:
 *             raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *         # suppress decl. in default case (purely for ElementTree compatibility)
 *         if xml_declaration is not None:
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Can_only_discard_comments_in_C14); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2037
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.find(path, namespaces)
 */
  __pyx_slice__29 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__29);
  __Pyx_GIVEREF(__pyx_slice__29);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2054
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.findtext(path, default, namespaces)
 */
  __pyx_slice__31 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__31);
  __Pyx_GIVEREF(__pyx_slice__31);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2071
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.findall(path, namespaces)
 */
  __pyx_slice__32 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__32);
  __Pyx_GIVEREF(__pyx_slice__32);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2088
 *         root = self.getroot()
 *         if _isString(path):
 *             if path[:1] == "/":             # <<<<<<<<<<<<<<
 *                 path = "." + path
 *         return root.iterfind(path, namespaces)
 */
  __pyx_slice__33 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__33);
  __Pyx_GIVEREF(__pyx_slice__33);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2789
 *         _assertValidNode(element)
 *         if with_tail:
 *             events = (u"start", u"end")             # <<<<<<<<<<<<<<
 *         else:
 *             events = (u"start",)
 */
  __pyx_tuple__36 = PyTuple_Pack(2, __pyx_n_u_start, __pyx_n_u_end); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2791
 *             events = (u"start", u"end")
 *         else:
 *             events = (u"start",)             # <<<<<<<<<<<<<<
 *         self._start_element = element
 *         self._nextEvent = iterwalk(element, events=events, tag=tag).__next__
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_u_start); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3048
 *     cdef _Document doc
 *     if isinstance(strings, (bytes, unicode)):
 *         raise ValueError("passing a single string into fromstringlist() is not"             # <<<<<<<<<<<<<<
 *                          " efficient, use fromstring() instead")
 *     if parser is None:
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_passing_a_single_string_into_fro); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3127
 *     if method == 'c14n':
 *         if encoding is not None:
 *             raise ValueError("Cannot specify encoding with C14N")             # <<<<<<<<<<<<<<
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_Cannot_specify_encoding_with_C14); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3129
 *             raise ValueError("Cannot specify encoding with C14N")
 *         if xml_declaration:
 *             raise ValueError("Cannot enable XML declaration in C14N")             # <<<<<<<<<<<<<<
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *     if not with_comments:
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_Cannot_enable_XML_declaration_in); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3132
 *         return _tostringC14N(element_or_tree, exclusive, with_comments, inclusive_ns_prefixes)
 *     if not with_comments:
 *         raise ValueError("Can only discard comments in C14N serialisation")             # <<<<<<<<<<<<<<
 *     if encoding is _unicode or (encoding is not None and encoding.upper() == 'UNICODE'):
 *         if xml_declaration:
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_Can_only_discard_comments_in_C14); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":18
 *         """
 *         if not self._c_node:
 *             raise ReferenceError("Proxy invalidated!")             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_Proxy_invalidated); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/readonlytree.pxi":196
 *             children = [ el for el in children if el.tag == tag ]
 *         if reversed:
 *             children = children[::-1]             # <<<<<<<<<<<<<<
 *         return iter(children)
 * 
 */
  __pyx_slice__43 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__43)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__43);
  __Pyx_GIVEREF(__pyx_slice__43);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":61
 *             tag = _utf8(_getattr(_getattr(self, '__class__'), '__name__'))
 *             if b'.' in tag:
 *                 tag = tag.split(b'.')[-1]             # <<<<<<<<<<<<<<
 *         try:
 *             parser = _getattr(self, 'PARSER')
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_b__4); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":46
 *             class_dict_iterable = class_dict_iterable.items()
 *         for name, item in class_dict_iterable:
 *             if (name is None or name[:1] != '_') and callable(item):             # <<<<<<<<<<<<<<
 *                 self[name] = item
 * 
 */
  __pyx_slice__45 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__45)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__45);
  __Pyx_GIVEREF(__pyx_slice__45);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1463
 *         XMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_end); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1627
 *         HTMLParser.__init__(self, **kwargs)
 *         if events is None:
 *             events = ('end',)             # <<<<<<<<<<<<<<
 *         self._setBaseURL(base_url)
 *         self._collectEvents(events, tag)
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_end); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1780
 *     if isinstance(text, unicode):
 *         if _hasEncodingDeclaration(text):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 u"Unicode strings with encoding declaration are not supported. "
 *                 u"Please use bytes input or XML fragments without declaration.")
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_u_Unicode_strings_with_encoding_de); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":115
 *     if enchandler is NULL and c_enc is not NULL:
 *         if encoding is not None:
 *             encoding = encoding.decode('UTF-8')             # <<<<<<<<<<<<<<
 *         raise LookupError, u"unknown encoding: '%s'" % encoding
 *     c_buffer = tree.xmlAllocOutputBuffer(enchandler)
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_UTF_8); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":574
 *             writer   = _FilelikeWriter(f, compression=compression)
 *             c_buffer = writer._createOutputBuffer(NULL)
 *             with writer.error_log:             # <<<<<<<<<<<<<<
 *                 bytes_count = c14n.xmlC14NDocSaveTo(
 *                     c_doc, NULL, exclusive, c_inclusive_ns_prefixes,
 */
  __pyx_tuple__57 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":686
 *         cdef int c_standalone
 *         if self._status >= WRITER_DECL_WRITTEN:
 *             raise LxmlSyntaxError("XML declaration already written")             # <<<<<<<<<<<<<<
 *         version = _utf8orNone(version)
 *         c_version = _xcstr(version) if version is not None else NULL
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_XML_declaration_already_written); if (unlikely(!__pyx_tuple__58)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":711
 *             return
 *         if self._status >= WRITER_DTD_WRITTEN:
 *             raise LxmlSyntaxError("DOCTYPE already written or cannot write it here")             # <<<<<<<<<<<<<<
 *         doctype = _utf8(doctype)
 *         _writeDoctype(self._c_out, _xcstr(doctype))
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_DOCTYPE_already_written_or_canno); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":753
 *     cdef _write_start_element(self, element_config):
 *         if self._status > WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("cannot append trailing element to complete XML document")             # <<<<<<<<<<<<<<
 *         ns, name, attributes, nsmap = element_config
 *         flat_namespace_map, new_namespaces = self._collect_namespaces(nsmap)
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_cannot_append_trailing_element_t); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":791
 *     cdef _write_end_element(self, element_config):
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_not_in_an_element); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":792
 *         if self._status != WRITER_IN_ELEMENT:
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:             # <<<<<<<<<<<<<<
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
 */
  __pyx_slice__66 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__66)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__66);
  __Pyx_GIVEREF(__pyx_slice__66);
  __pyx_slice__67 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__67)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__67);
  __Pyx_GIVEREF(__pyx_slice__67);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":793
 *             raise LxmlSyntaxError("not in an element")
 *         if not self._element_stack or self._element_stack[-1][:2] != element_config[:2]:
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")             # <<<<<<<<<<<<<<
 * 
 *         name, prefix = self._element_stack.pop()[1:3]
 */
  __pyx_tuple__68 = PyTuple_Pack(1, __pyx_kp_s_inconsistent_exit_action_in_cont); if (unlikely(!__pyx_tuple__68)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":795
 *             raise LxmlSyntaxError("inconsistent exit action in context manager")
 * 
 *         name, prefix = self._element_stack.pop()[1:3]             # <<<<<<<<<<<<<<
 *         tree.xmlOutputBufferWrite(self._c_out, 2, '</')
 *         self._write_qname(name, prefix)
 */
  __pyx_slice__69 = PySlice_New(__pyx_int_1, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__69)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__69);
  __Pyx_GIVEREF(__pyx_slice__69);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":847
 *                 if self._status != WRITER_IN_ELEMENT:
 *                     if self._status > WRITER_IN_ELEMENT or content.strip():
 *                         raise LxmlSyntaxError("not in an element")             # <<<<<<<<<<<<<<
 *                 content = _utf8(content)
 *                 tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_not_in_an_element); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":852
 *             elif iselement(content):
 *                 if self._status > WRITER_IN_ELEMENT:
 *                     raise LxmlSyntaxError("cannot append trailing element to complete XML document")             # <<<<<<<<<<<<<<
 *                 _writeNodeToBuffer(self._c_out, (<_Element>content)._c_node,
 *                                    self._c_encoding, NULL, OUTPUT_METHOD_XML,
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_kp_s_cannot_append_trailing_element_t); if (unlikely(!__pyx_tuple__72)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":866
 *         if raise_on_error:
 *             if self._status < WRITER_IN_ELEMENT:
 *                 raise LxmlSyntaxError("no content written")             # <<<<<<<<<<<<<<
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")
 */
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_kp_s_no_content_written); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":868
 *                 raise LxmlSyntaxError("no content written")
 *             if self._element_stack:
 *                 raise LxmlSyntaxError("pending open tags on close")             # <<<<<<<<<<<<<<
 *         error_result = self._c_out.error
 *         if error_result == xmlerror.XML_ERR_OK:
 */
  __pyx_tuple__74 = PyTuple_Pack(1, __pyx_kp_s_pending_open_tags_on_close); if (unlikely(!__pyx_tuple__74)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":66
 *     cdef bint _close_source_after_read
 * 
 *     def __init__(self, source, events=(u"end",), *, tag=None,             # <<<<<<<<<<<<<<
 *                  attribute_defaults=False, dtd_validation=False,
 *                  load_dtd=False, no_network=True, remove_blank_text=False,
 */
  __pyx_tuple__75 = PyTuple_Pack(1, __pyx_n_u_end); if (unlikely(!__pyx_tuple__75)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":217
 *     @cython.final
 *     cdef bint _read_more_events(self, _SaxParserContext context) except -123:
 *         data = self._source.read(__ITERPARSE_CHUNK_SIZE)             # <<<<<<<<<<<<<<
 *         if not isinstance(data, bytes):
 *             self._close_source()
 */
  __pyx_tuple__76 = PyTuple_Pack(1, __pyx_int_32768); if (unlikely(!__pyx_tuple__76)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":220
 *         if not isinstance(data, bytes):
 *             self._close_source()
 *             raise TypeError("reading file objects must return bytes objects")             # <<<<<<<<<<<<<<
 *         if not data:
 *             try:
 */
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_s_reading_file_objects_must_return); if (unlikely(!__pyx_tuple__77)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":244
 *     cdef int    _event_filter
 * 
 *     def __init__(self, element_or_tree, events=(u"end",), tag=None):             # <<<<<<<<<<<<<<
 *         cdef _Element root
 *         cdef int ns_count
 */
  __pyx_tuple__78 = PyTuple_Pack(1, __pyx_n_u_end); if (unlikely(!__pyx_tuple__78)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":273
 *         cdef int ns_count = 0
 *         if self._events:
 *             return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         if self._matcher is not None and self._index >= 0:
 *             node = self._node_stack[self._index][0]
 */
  __pyx_tuple__79 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__79)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":305
 *                 self._index += 1
 *             if self._events:
 *                 return self._pop_event(0)             # <<<<<<<<<<<<<<
 *         raise StopIteration
 * 
 */
  __pyx_tuple__80 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__80)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/iterparse.pxi":329
 *                 self._events.append( (u"end", node) )
 *         if self._event_filter & PARSE_EVENT_FILTER_END_NS:
 *             event = (u"end-ns", None)             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < ns_count:
 *                 self._events.append(event)
 */
  __pyx_tuple__81 = PyTuple_Pack(2, __pyx_kp_u_end_ns, Py_None); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":15
 *     global _find_id_attributes
 *     if _find_id_attributes is None:
 *         _find_id_attributes = XPath(u'//[inserted by cython to avoid comment start]*[string(@id)]')             # <<<<<<<<<<<<<<
 * 
 *     # ElementTree compatible implementation: parse and look for 'id' attributes
 */
  __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_u_string_id); if (unlikely(!__pyx_tuple__82)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":21
 *     dic = {}
 *     for elem in _find_id_attributes(root):
 *         dic[elem.get(u'id')] = elem             # <<<<<<<<<<<<<<
 *     return (root, dic)
 * 
 */
  __pyx_tuple__83 = PyTuple_Pack(1, __pyx_n_u_id); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":114
 *         if self._keys is None:
 *             self._keys = self._build_keys()
 *         return self._keys[:]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_slice__84 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__84)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__84);
  __Pyx_GIVEREF(__pyx_slice__84);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":132
 *         if self._items is None:
 *             self._items = self._build_items()
 *         return self._items[:]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
  __pyx_slice__85 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__85)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__85);
  __Pyx_GIVEREF(__pyx_slice__85);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":446
 *         if function_mapping is None:
 *             function_mapping = [ name for name in dir(module)
 *                                  if not name.startswith(u'_') ]             # <<<<<<<<<<<<<<
 *         for function_name in function_mapping:
 *             functions[(ns, function_name)] = getattr(module, function_name)
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_n_u__46); if (unlikely(!__pyx_tuple__86)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":521
 *                 return ()
 *             results = [ result.group() ]
 *             results.extend( result.groups(u'') )             # <<<<<<<<<<<<<<
 *         result_list = []
 *         root = Element(u'matches')
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_u__15); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":523
 *             results.extend( result.groups(u'') )
 *         result_list = []
 *         root = Element(u'matches')             # <<<<<<<<<<<<<<
 *         join_groups = u''.join
 *         for s_match in results:
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_n_u_matches); if (unlikely(!__pyx_tuple__88)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":142
 *             _XPATH_VERSION_WARNING_REQUIRED = 0
 *             import warnings
 *             warnings.warn(u"This version of libxml2 has a known XPath bug. "             # <<<<<<<<<<<<<<
 *                           u"Use it at your own risk.")
 *         self._context = _XPathContext(namespaces, extensions, self._error_log,
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_u_This_version_of_libxml2_has_a_kn); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":510
 *                 i += 1
 *                 namespace_defs.append(namespace_def)
 *                 namespace = namespace_def[1:-1] # remove '{}'             # <<<<<<<<<<<<<<
 *                 namespace = (<bytes>namespace).decode('utf8')
 *                 namespaces[prefix.decode('utf8')] = namespace
 */
  __pyx_slice__90 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__90)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__90);
  __Pyx_GIVEREF(__pyx_slice__90);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":516
 *                 # FIXME: this also replaces {namespaces} within strings!
 *                 path_utf = path_utf.replace(namespace_def, prefix_str)
 *         path = path_utf.decode('utf8')             # <<<<<<<<<<<<<<
 *         return path, namespaces
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":398
 *         c_doc._private = <python.PyObject*>self._xslt_resolver_context
 * 
 *         with self._error_log:             # <<<<<<<<<<<<<<
 *             c_style = xslt.xsltParseStylesheetDoc(c_doc)
 * 
 */
  __pyx_tuple__93 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":465
 *         """
 *         if max_depth < 0:
 *             raise ValueError("cannot set a maximum stylesheet traversal depth < 0")             # <<<<<<<<<<<<<<
 *         xslt.xsltMaxDepth = max_depth
 * 
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_s_cannot_set_a_maximum_stylesheet); if (unlikely(!__pyx_tuple__94)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":844
 *     global __findStylesheetByID
 *     if __findStylesheetByID is None:
 *         __findStylesheetByID = XPath(             # <<<<<<<<<<<<<<
 *             u"//xsl:stylesheet[@xml:id = $id]",
 *             namespaces={u"xsl" : u"http://www.w3.org/1999/XSL/Transform"})
 */
  __pyx_tuple__95 = PyTuple_Pack(1, __pyx_kp_u_xsl_stylesheet_xml_id_id); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xsltext.pxi":225
 *                 e = unicode(e).encode(u"UTF-8")
 *             except:
 *                 e = repr(e).encode(u"UTF-8")             # <<<<<<<<<<<<<<
 *             message = python.PyBytes_FromFormat(
 *                 "Error executing extension element '%s': %s",
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_kp_u_UTF_8); if (unlikely(!__pyx_tuple__96)) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":281
 *             if _isString(file):
 *                 file = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     self._c_dtd = xmlparser.xmlParseDTD(NULL, _xcstr(file))
 *             elif hasattr(file, 'read'):
 */
  __pyx_tuple__97 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__97)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":288
 *                 raise DTDParseError, u"file must be a filename or file-like object"
 *         elif external_id is not None:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 self._c_dtd = xmlparser.xmlParseDTD(<const_xmlChar*>external_id, NULL)
 *         else:
 */
  __pyx_tuple__98 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__98)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":364
 *         valid_ctxt = dtdvalid.xmlNewValidCtxt()
 *         if valid_ctxt is NULL:
 *             raise DTDError(u"Failed to create validation context")             # <<<<<<<<<<<<<<
 * 
 *         # work around error reporting bug in libxml2 <= 2.9.1 (and later?)
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_create_validation_cont); if (unlikely(!__pyx_tuple__99)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":372
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                 ret = dtdvalid.xmlValidateDtd(valid_ctxt, c_doc, self._c_dtd)
 */
  __pyx_tuple__100 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__100)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":394
 *     error_log = _ErrorLog()
 * 
 *     with error_log:             # <<<<<<<<<<<<<<
 *         c_dtd = dtd_parser._readDtd()
 * 
 */
  __pyx_tuple__101 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__101)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":58
 *                 doc = None
 *                 filename = _encodeFilename(file)
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     parser_ctxt = relaxng.xmlRelaxNGNewParserCtxt(_cstr(filename))
 *             else:
 */
  __pyx_tuple__102 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__102)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":98
 *                 filename = file
 *             filename = _encodeFilename(filename)
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 parser_ctxt = schematron.xmlSchematronNewParserCtxt(_cstr(filename))
 *         else:
 */
  __pyx_tuple__103 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__103)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":110
 * 
 *         try:
 *             with self._error_log:             # <<<<<<<<<<<<<<
 *                 self._c_schema = schematron.xmlSchematronParse(parser_ctxt)
 *         finally:
 */
  __pyx_tuple__104 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__104)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":169
 *             else:
 *                 ret = -1
 *                 with self._error_log:             # <<<<<<<<<<<<<<
 *                     c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
 *                     with nogil:
 */
  __pyx_tuple__105 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__105)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":105
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):
 *             def keys(self):             # <<<<<<<<<<<<<<
 *                 return []
 * 
 */
  __pyx_tuple__106 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_keys, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":109
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_tuple__108 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_key); if (unlikely(!__pyx_tuple__108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_getitem, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":112
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_tuple__110 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_value); if (unlikely(!__pyx_tuple__110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_setitem, 112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":115
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_key); if (unlikely(!__pyx_tuple__112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_delitem, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":118
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__114 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_key); if (unlikely(!__pyx_tuple__114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_contains, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":121
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_tuple__116 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_len, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":124
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
 */
  __pyx_tuple__118 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_iter_2, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":167
 * 
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode(u"UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 * 
 */
  __pyx_tuple__120 = PyTuple_Pack(1, __pyx_kp_u_UTF_8); if (unlikely(!__pyx_tuple__120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":186
 * }
 * 
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
 */
  __pyx_tuple__121 = PyTuple_Pack(1, __pyx_kp_b_ns_d_2); if (unlikely(!__pyx_tuple__121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     u"""Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */
  __pyx_tuple__122 = PyTuple_Pack(6, __pyx_n_s_prefix, __pyx_n_s_uri, __pyx_n_s_prefix_utf, __pyx_n_s_uri_utf, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_register_namespace, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":214
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */
  __pyx_tuple__124 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_error_log); if (unlikely(!__pyx_tuple__124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_init, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__126 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":274
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (<unsigned char*>tree.xmlParserVersion).decode("ascii")
 */
  __pyx_tuple__127 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":8
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     u"""clear_error_log()
 * 
 */
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_2, __pyx_n_s_clear_error_log_2, 8, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":545
 * 
 * cdef _BaseErrorLog __GLOBAL_ERROR_LOG
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():
 */
  __pyx_tuple__129 = PyTuple_Pack(1, __pyx_int_100); if (unlikely(!__pyx_tuple__129)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":574
 *     return _getGlobalErrorLog().copy()
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     u"""use_global_python_log(log)
 * 
 */
  __pyx_tuple__130 = PyTuple_Pack(1, __pyx_n_s_log); if (unlikely(!__pyx_tuple__130)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_2, __pyx_n_s_use_global_python_log, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":739
 * # cannot handle strings that are a few thousand bytes in length.
 * 
 * cdef object __ERROR_LEVELS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * WARNING=1
 */
  __pyx_tuple__132 = PyTuple_Pack(1, __pyx_kp_u_NONE_0_WARNING_1_ERROR_2_FATAL_3); if (unlikely(!__pyx_tuple__132)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":746
 * """,)
 * 
 * cdef object __ERROR_DOMAINS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * PARSER=1
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_kp_u_NONE_0_PARSER_1_TREE_2_NAMESPACE); if (unlikely(!__pyx_tuple__133)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":780
 * """,)
 * 
 * cdef object __PARSER_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * ERR_OK=0
 * ERR_INTERNAL_ERROR=1
 */
  __pyx_tuple__134 = PyTuple_Pack(11, __pyx_kp_u_ERR_OK_0_ERR_INTERNAL_ERROR_1_ER, __pyx_kp_u_ERR_ENCODING_NAME_79_ERR_HYPHEN, __pyx_kp_u_RNGP_ATTRIBUTE_CONTENT_1003_RNGP, __pyx_kp_u_RNGP_PAT_DATA_EXCEPT_ONEMORE_107, __pyx_kp_u_TREE_NOT_UTF8_1303_SAVE_NOT_UTF8, __pyx_kp_u_SCHEMAP_EXTENSION_NO_BASE_1707_S, __pyx_kp_u_SCHEMAP_DEF_AND_PREFIX_1768_SCHE, __pyx_kp_u_SCHEMAV_CVC_MINLENGTH_VALID_1831, __pyx_kp_u_SCHEMAP_SRC_RESOLVE_3004_SCHEMAP, __pyx_kp_u_SCHEMAP_CVC_SIMPLE_TYPE_3062_SCH, __pyx_kp_u_I18N_NO_OUTPUT_6004_BUF_OVERFLOW); if (unlikely(!__pyx_tuple__134)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":1537
 * """,)
 * 
 * cdef object __RELAXNG_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * RELAXNG_OK=0
 * RELAXNG_ERR_MEMORY=1
 */
  __pyx_tuple__135 = PyTuple_Pack(1, __pyx_kp_u_RELAXNG_OK_0_RELAXNG_ERR_MEMORY); if (unlikely(!__pyx_tuple__135)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2831
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_tuple__136 = PyTuple_Pack(4, __pyx_n_s_tag_2, __pyx_n_s_attrib, __pyx_n_s_nsmap, __pyx_n_s_extra); if (unlikely(!__pyx_tuple__136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);
  __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_Element, 2831, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2844
 *                         attrib, nsmap, _extra)
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     u"""Comment(text=None)
 * 
 */
  __pyx_tuple__138 = PyTuple_Pack(4, __pyx_n_s_text, __pyx_n_s_doc_2, __pyx_n_s_c_node, __pyx_n_s_c_doc); if (unlikely(!__pyx_tuple__138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_Comment, 2844, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2863
 *     return _elementFactory(doc, c_node)
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     u"""ProcessingInstruction(target, text=None)
 * 
 */
  __pyx_tuple__140 = PyTuple_Pack(5, __pyx_n_s_target, __pyx_n_s_text, __pyx_n_s_doc_2, __pyx_n_s_c_node, __pyx_n_s_c_doc); if (unlikely(!__pyx_tuple__140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_ProcessingInstruction, 2863, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2903
 *         self._utf8_data = _utf8(data)
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     u"""Entity(name)
 * 
 */
  __pyx_tuple__142 = PyTuple_Pack(6, __pyx_n_s_name_2, __pyx_n_s_doc_2, __pyx_n_s_c_node, __pyx_n_s_c_doc, __pyx_n_s_name_utf, __pyx_n_s_c_name); if (unlikely(!__pyx_tuple__142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_Entity, 2903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2928
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */
  __pyx_tuple__144 = PyTuple_Pack(5, __pyx_n_s_parent, __pyx_n_s_tag_2, __pyx_n_s_attrib, __pyx_n_s_nsmap, __pyx_n_s_extra); if (unlikely(!__pyx_tuple__144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);
  __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_SubElement, 2928, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2937
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""ElementTree(element=None, file=None, parser=None)
 * 
 */
  __pyx_tuple__146 = PyTuple_Pack(10, __pyx_n_s_element, __pyx_n_s_file, __pyx_n_s_parser, __pyx_n_s_c_next, __pyx_n_s_c_node, __pyx_n_s_c_node_copy, __pyx_n_s_c_doc, __pyx_n_s_etree, __pyx_n_s_doc_2, __pyx_n_s_result_container); if (unlikely(!__pyx_tuple__146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__146);
  __Pyx_GIVEREF(__pyx_tuple__146);
  __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(1, 2, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_ElementTree, 2937, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2962
 *     return _elementTreeFactory(doc, element)
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""HTML(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__148 = PyTuple_Pack(5, __pyx_n_s_text, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_doc_2, __pyx_n_s_result_container); if (unlikely(!__pyx_tuple__148)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__148);
  __Pyx_GIVEREF(__pyx_tuple__148);
  __pyx_codeobj__149 = (PyObject*)__Pyx_PyCode_New(2, 1, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__148, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_HTML, 2962, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2987
 *         return result_container.result
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XML(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__150 = PyTuple_Pack(5, __pyx_n_s_text, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_doc_2, __pyx_n_s_result_container); if (unlikely(!__pyx_tuple__150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__150);
  __Pyx_GIVEREF(__pyx_tuple__150);
  __pyx_codeobj__151 = (PyObject*)__Pyx_PyCode_New(2, 1, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__150, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_XML, 2987, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__151)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3017
 *         return result_container.result
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""fromstring(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__152 = PyTuple_Pack(5, __pyx_n_s_text, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_doc_2, __pyx_n_s_result_container); if (unlikely(!__pyx_tuple__152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__152);
  __Pyx_GIVEREF(__pyx_tuple__152);
  __pyx_codeobj__153 = (PyObject*)__Pyx_PyCode_New(2, 1, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__152, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_fromstring, 3017, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__153)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3037
 *         return result_container.result
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""fromstringlist(strings, parser=None)
 * 
 */
  __pyx_tuple__154 = PyTuple_Pack(5, __pyx_n_s_strings, __pyx_n_s_parser, __pyx_n_s_doc_2, __pyx_n_s_feed, __pyx_n_s_data); if (unlikely(!__pyx_tuple__154)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__154);
  __Pyx_GIVEREF(__pyx_tuple__154);
  __pyx_codeobj__155 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__154, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_fromstringlist, 3037, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__155)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3057
 *     return parser.close()
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     u"""iselement(element)
 * 
 */
  __pyx_tuple__156 = PyTuple_Pack(1, __pyx_n_s_element); if (unlikely(!__pyx_tuple__156)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__156);
  __Pyx_GIVEREF(__pyx_tuple__156);
  __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_iselement, 3057, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3064
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""dump(elem, pretty_print=True, with_tail=True)
 * 
 */
  __pyx_tuple__158 = PyTuple_Pack(4, __pyx_n_s_elem, __pyx_n_s_pretty_print, __pyx_n_s_with_tail, __pyx_n_s_xml); if (unlikely(!__pyx_tuple__158)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__158);
  __Pyx_GIVEREF(__pyx_tuple__158);
  __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(1, 2, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__158, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_dump, 3064, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3076
 *     sys.stdout.write(xml)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */
  __pyx_tuple__160 = PyTuple_Pack(13, __pyx_n_s_element_or_tree, __pyx_n_s_encoding, __pyx_n_s_method, __pyx_n_s_xml_declaration, __pyx_n_s_pretty_print, __pyx_n_s_with_tail, __pyx_n_s_standalone, __pyx_n_s_doctype, __pyx_n_s_exclusive, __pyx_n_s_with_comments, __pyx_n_s_inclusive_ns_prefixes, __pyx_n_s_write_declaration, __pyx_n_s_is_standalone); if (unlikely(!__pyx_tuple__160)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__160);
  __Pyx_GIVEREF(__pyx_tuple__160);
  __pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(1, 10, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_tostring, 3076, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3168
 *             python._fqtypename(element_or_tree).decode('utf8')
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     u"""tostringlist(element_or_tree, *args, **kwargs)
 * 
 */
  __pyx_tuple__162 = PyTuple_Pack(3, __pyx_n_s_element_or_tree, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__162)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__162);
  __Pyx_GIVEREF(__pyx_tuple__162);
  __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_tostringlist, 3168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3179
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_tuple__164 = PyTuple_Pack(5, __pyx_n_s_element_or_tree, __pyx_n_s_method, __pyx_n_s_pretty_print, __pyx_n_s_with_tail, __pyx_n_s_doctype); if (unlikely(!__pyx_tuple__164)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__164);
  __Pyx_GIVEREF(__pyx_tuple__164);
  __pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(1, 4, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_tounicode, 3179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3213
 *             type(element_or_tree)
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parse(source, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__166 = PyTuple_Pack(5, __pyx_n_s_source, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_doc_2, __pyx_n_s_result_container); if (unlikely(!__pyx_tuple__166)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__166);
  __Pyx_GIVEREF(__pyx_tuple__166);
  __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(2, 1, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml, __pyx_n_s_parse, 3213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":551
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     u"""set_element_class_lookup(lookup = None)
 * 
 */
  __pyx_tuple__168 = PyTuple_Pack(1, __pyx_n_s_lookup); if (unlikely(!__pyx_tuple__168)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);
  __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_3, __pyx_n_s_set_element_class_lookup, 551, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":175
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     u"""FunctionNamespace(ns_uri)
 * 
 */
  __pyx_tuple__170 = PyTuple_Pack(3, __pyx_n_s_ns_uri, __pyx_n_s_ns_utf, __pyx_n_s_registry); if (unlikely(!__pyx_tuple__170)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__170);
  __Pyx_GIVEREF(__pyx_tuple__170);
  __pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_4, __pyx_n_s_FunctionNamespace, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":18
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */
  __pyx_tuple__172 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_code, __pyx_n_s_line, __pyx_n_s_column); if (unlikely(!__pyx_tuple__172)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);
  __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_5, __pyx_n_s_init, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1519
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""set_default_parser(parser=None)
 * 
 */
  __pyx_tuple__174 = PyTuple_Pack(1, __pyx_n_s_parser); if (unlikely(!__pyx_tuple__174)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);
  __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_5, __pyx_n_s_set_default_parser, 1519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1535
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __pyx_codeobj__176 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_5, __pyx_n_s_get_default_parser, 1535, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__176)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":468
 * 
 * 
 * cdef tuple NS_END_EVENT = ('end-ns', None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__177 = PyTuple_Pack(2, __pyx_kp_s_end_ns, Py_None); if (unlikely(!__pyx_tuple__177)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__177);
  __Pyx_GIVEREF(__pyx_tuple__177);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":10
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
 */
  __pyx_tuple__178 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__178)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_6, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLID(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__180 = PyTuple_Pack(6, __pyx_n_s_text, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_dic, __pyx_n_s_root, __pyx_n_s_elem); if (unlikely(!__pyx_tuple__180)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(2, 1, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_7, __pyx_n_s_XMLID, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":24
 *     return (root, dic)
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLDTDID(text, parser=None, base_url=None)
 * 
 */
  __pyx_tuple__182 = PyTuple_Pack(4, __pyx_n_s_text, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_root); if (unlikely(!__pyx_tuple__182)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(2, 1, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_7, __pyx_n_s_XMLDTDID, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":44
 *         return (root, _IDDict(root))
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parseid(source, parser=None)
 * 
 */
  __pyx_tuple__184 = PyTuple_Pack(4, __pyx_n_s_source, __pyx_n_s_parser, __pyx_n_s_base_url, __pyx_n_s_doc_2); if (unlikely(!__pyx_tuple__184)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(2, 1, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_7, __pyx_n_s_parseid, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element):             # <<<<<<<<<<<<<<
 *     u"""cleanup_namespaces(tree_or_element)
 * 
 */
  __pyx_tuple__186 = PyTuple_Pack(2, __pyx_n_s_tree_or_element, __pyx_n_s_element); if (unlikely(!__pyx_tuple__186)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_8, __pyx_n_s_cleanup_namespaces, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":13
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     u"""strip_attributes(tree_or_element, *attribute_names)
 * 
 */
  __pyx_tuple__188 = PyTuple_Pack(4, __pyx_n_s_tree_or_element, __pyx_n_s_attribute_names, __pyx_n_s_matcher, __pyx_n_s_element); if (unlikely(!__pyx_tuple__188)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_8, __pyx_n_s_strip_attributes, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":54
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */
  __pyx_tuple__190 = PyTuple_Pack(12, __pyx_n_s_tree_or_element, __pyx_n_s_with_tail, __pyx_n_s_tag_names, __pyx_n_s_matcher, __pyx_n_s_element, __pyx_n_s_doc_2, __pyx_n_s_ns_tags, __pyx_n_s_c_ns_tags, __pyx_n_s_c_tag_count, __pyx_n_s_strip_comments, __pyx_n_s_strip_pis, __pyx_n_s_strip_entities); if (unlikely(!__pyx_tuple__190)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(1, 1, 12, 0, CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_8, __pyx_n_s_strip_elements, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":132
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     u"""strip_tags(tree_or_element, *tag_names)
 * 
 */
  __pyx_tuple__192 = PyTuple_Pack(11, __pyx_n_s_tree_or_element, __pyx_n_s_tag_names, __pyx_n_s_matcher, __pyx_n_s_element, __pyx_n_s_doc_2, __pyx_n_s_ns_tags, __pyx_n_s_strip_comments, __pyx_n_s_strip_pis, __pyx_n_s_strip_entities, __pyx_n_s_c_ns_tags, __pyx_n_s_c_tag_count); if (unlikely(!__pyx_tuple__192)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__192);
  __Pyx_GIVEREF(__pyx_tuple__192);
  __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 0, CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_8, __pyx_n_s_strip_tags, 132, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":371
 * 
 * cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
 *     b"Ok",             # <<<<<<<<<<<<<<
 *     b"Number encoding",
 *     b"Unfinished literal",
 */
  __pyx_tuple__194 = PyTuple_Pack(24, __pyx_n_b_Ok, __pyx_kp_b_Number_encoding, __pyx_kp_b_Unfinished_literal, __pyx_kp_b_Start_of_literal, __pyx_kp_b_Expected_for_variable_reference, __pyx_kp_b_Undefined_variable, __pyx_kp_b_Invalid_predicate, __pyx_kp_b_Invalid_expression, __pyx_kp_b_Missing_closing_curly_brace, __pyx_kp_b_Unregistered_function, __pyx_kp_b_Invalid_operand, __pyx_kp_b_Invalid_type, __pyx_kp_b_Invalid_number_of_arguments, __pyx_kp_b_Invalid_context_size, __pyx_kp_b_Invalid_context_position, __pyx_kp_b_Memory_allocation_error, __pyx_kp_b_Syntax_error, __pyx_kp_b_Resource_error, __pyx_kp_b_Sub_resource_error, __pyx_kp_b_Undefined_namespace_prefix, __pyx_kp_b_Encoding_error, __pyx_kp_b_Char_out_of_XML_range, __pyx_kp_b_Invalid_or_incomplete_context, __pyx_kp_b_Stack_usage_error); if (unlikely(!__pyx_tuple__194)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":426
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     u"""Extension(module, function_mapping=None, ns=None)
 * 
 */
  __pyx_tuple__195 = PyTuple_Pack(7, __pyx_n_s_module, __pyx_n_s_function_mapping, __pyx_n_s_ns, __pyx_n_s_functions, __pyx_n_s_function_name, __pyx_n_s_xpath_name, __pyx_n_s_name_2); if (unlikely(!__pyx_tuple__195)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__195);
  __Pyx_GIVEREF(__pyx_tuple__195);
  __pyx_codeobj__196 = (PyObject*)__Pyx_PyCode_New(2, 1, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__195, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_9, __pyx_n_s_Extension, 426, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__196)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":735
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */
  __pyx_tuple__197 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__197)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__197);
  __Pyx_GIVEREF(__pyx_tuple__197);
  __pyx_codeobj__198 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__197, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_9, __pyx_n_s_getparent, 735, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__198)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":380
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */
  __pyx_tuple__199 = PyTuple_Pack(5, __pyx_n_s_etree_or_element, __pyx_n_s_namespaces, __pyx_n_s_extensions, __pyx_n_s_regexp, __pyx_n_s_smart_strings); if (unlikely(!__pyx_tuple__199)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__199);
  __Pyx_GIVEREF(__pyx_tuple__199);
  __pyx_codeobj__200 = (PyObject*)__Pyx_PyCode_New(1, 4, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__199, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_10, __pyx_n_s_XPathEvaluator, 380, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__200)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":478
 * cdef object _replace_strings
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 */
  __pyx_tuple__202 = PyTuple_Pack(1, __pyx_kp_b__201); if (unlikely(!__pyx_tuple__202)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__202);
  __Pyx_GIVEREF(__pyx_tuple__202);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":479
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * _find_namespaces = re.compile(b'({[^}]+})').findall             # <<<<<<<<<<<<<<
 * 
 * cdef class ETXPath(XPath):
 */
  __pyx_tuple__204 = PyTuple_Pack(1, __pyx_kp_b__203); if (unlikely(!__pyx_tuple__204)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__204);
  __Pyx_GIVEREF(__pyx_tuple__204);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":435
 * 
 *     @staticmethod
 *     def strparam(strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */
  __pyx_tuple__205 = PyTuple_Pack(1, __pyx_n_s_strval); if (unlikely(!__pyx_tuple__205)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__205);
  __Pyx_GIVEREF(__pyx_tuple__205);
  __pyx_codeobj__206 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__205, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_11, __pyx_n_s_strparam, 435, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__206)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":449
 * 
 *     @staticmethod
 *     def set_global_max_depth(int max_depth):             # <<<<<<<<<<<<<<
 *         u"""set_global_max_depth(max_depth)
 * 
 */
  __pyx_tuple__207 = PyTuple_Pack(1, __pyx_n_s_max_depth); if (unlikely(!__pyx_tuple__207)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__207);
  __Pyx_GIVEREF(__pyx_tuple__207);
  __pyx_codeobj__208 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__207, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_stefan_source_Python_lxml_11, __pyx_n_s_set_global_max_depth, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__208)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":836
 * # XSLT PI support
 * 
 * cdef object _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')             # <<<<<<<<<<<<<<
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 */
  __pyx_tuple__209 = PyTuple_Pack(1, __pyx_kp_u_s_href_s_s); if (unlikely(!__pyx_tuple__209)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__209);
  __Pyx_GIVEREF(__pyx_tuple__209);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":22
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_tuple__210 = PyTuple_Pack(1, __pyx_kp_u_boolean_xs_attribute_default_or); if (unlikely(!__pyx_tuple__210)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_32768 = PyInt_FromLong(32768L); if (unlikely(!__pyx_int_32768)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_100 = PyInt_FromLong(-100); if (unlikely(!__pyx_int_neg_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_200 = PyInt_FromLong(-200); if (unlikely(!__pyx_int_neg_200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_300 = PyInt_FromLong(-300); if (unlikely(!__pyx_int_neg_300)) {__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 initetree(void); /*proto*/
PyMODINIT_FUNC initetree(void)
#else
PyMODINIT_FUNC PyInit_etree(void); /*proto*/
PyMODINIT_FUNC PyInit_etree(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  unsigned char *__pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_etree(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("etree"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_The_lxml_etree_module_implements), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__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 PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_lxml__etree) {
    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;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "lxml.etree")) {
      if (unlikely(PyDict_SetItemString(modules, "lxml.etree", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_4lxml_5etree__unicode = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_os_path_abspath = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_BytesIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_StringIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__elementpath = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_sys = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_re = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_islice = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_ITER_EMPTY = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__check_internal_prefix = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__Error = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_error_super_init = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_OrderedDict = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___RE_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___REPLACE_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___HAS_XML_ENCODING = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG = ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___ERROR_LEVELS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___ERROR_DOMAINS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___PARSER_ERROR_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__PREFIX_CACHE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP = ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__LxmlSyntaxError = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__ParseError = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT = ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___DEFAULT_XML_PARSER = ((struct __pyx_obj_4lxml_5etree_XMLParser *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER = ((struct __pyx_obj_4lxml_5etree_HTMLParser *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_NS_END_EVENT = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_inspect_getargspec = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_GzipFile = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_id_attributes = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__replace_strings = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__find_namespaces = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree_EMPTY_DICT = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__RE_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__FIND_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__REPLACE_PI_HREF = Py_None; Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree___findStylesheetByID = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None); Py_INCREF(Py_None);
  __pyx_v_4lxml_5etree__check_for_default_attributes = ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("deepcopyNodeToDocument", (void (*)(void))deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("elementTreeFactory", (void (*)(void))elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("newElementTree", (void (*)(void))newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("elementFactory", (void (*)(void))elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("makeElement", (void (*)(void))makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("makeSubElement", (void (*)(void))makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setElementClassLookupFunction", (void (*)(void))setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("lookupDefaultElementClass", (void (*)(void))lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("lookupNamespaceElementClass", (void (*)(void))lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("callLookupFallback", (void (*)(void))callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("tagMatches", (void (*)(void))tagMatches, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("documentOrRaise", (void (*)(void))documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("rootNodeOrRaise", (void (*)(void))rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("hasText", (void (*)(void))hasText, "int (xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("hasTail", (void (*)(void))hasTail, "int (xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("textOf", (void (*)(void))textOf, "PyObject *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("tailOf", (void (*)(void))tailOf, "PyObject *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setNodeText", (void (*)(void))setNodeText, "int (xmlNode *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setTailText", (void (*)(void))setTailText, "int (xmlNode *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("attributeValue", (void (*)(void))attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("attributeValueFromNsName", (void (*)(void))attributeValueFromNsName, "PyObject *(xmlNode *, const xmlChar *, const xmlChar *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("getAttributeValue", (void (*)(void))getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("iterattributes", (void (*)(void))iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("collectAttributes", (void (*)(void))collectAttributes, "PyObject *(xmlNode *, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("setAttributeValue", (void (*)(void))setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("delAttribute", (void (*)(void))delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("delAttributeFromNsName", (void (*)(void))delAttributeFromNsName, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("hasChild", (void (*)(void))hasChild, "int (xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findChild", (void (*)(void))findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findChildForwards", (void (*)(void))findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findChildBackwards", (void (*)(void))findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("nextElement", (void (*)(void))nextElement, "xmlNode *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("previousElement", (void (*)(void))previousElement, "xmlNode *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("appendChild", (void (*)(void))appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("appendChildToElement", (void (*)(void))appendChildToElement, "int (struct LxmlElement *, struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("pyunicode", (void (*)(void))pyunicode, "PyObject *(const xmlChar *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("utf8", (void (*)(void))utf8, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("getNsTag", (void (*)(void))getNsTag, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("getNsTagWithEmptyNs", (void (*)(void))getNsTagWithEmptyNs, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("namespacedName", (void (*)(void))namespacedName, "PyObject *(xmlNode *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("namespacedNameFromNsName", (void (*)(void))namespacedNameFromNsName, "PyObject *(const xmlChar *, const xmlChar *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("iteratorStoreNext", (void (*)(void))iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("initTagMatch", (void (*)(void))initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("findOrBuildNodeNsPrefix", (void (*)(void))findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Type init code ---*/
  __pyx_vtabptr_4lxml_5etree__TempStore = &__pyx_vtable_4lxml_5etree__TempStore;
  __pyx_vtable_4lxml_5etree__TempStore.add = (int (*)(struct __pyx_obj_4lxml_5etree__TempStore *, PyObject *))__pyx_f_4lxml_5etree_10_TempStore_add;
  __pyx_vtable_4lxml_5etree__TempStore.clear = (int (*)(struct __pyx_obj_4lxml_5etree__TempStore *))__pyx_f_4lxml_5etree_10_TempStore_clear;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__TempStore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__TempStore.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__TempStore.tp_dict, __pyx_vtabptr_4lxml_5etree__TempStore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__TempStore = &__pyx_type_4lxml_5etree__TempStore;
  __pyx_vtabptr_4lxml_5etree__ExceptionContext = &__pyx_vtable_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ExceptionContext.clear = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext_clear;
  __pyx_vtable_4lxml_5etree__ExceptionContext._store_raised = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__store_raised;
  __pyx_vtable_4lxml_5etree__ExceptionContext._store_exception = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *, PyObject *))__pyx_f_4lxml_5etree_17_ExceptionContext__store_exception;
  __pyx_vtable_4lxml_5etree__ExceptionContext._has_raised = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__has_raised;
  __pyx_vtable_4lxml_5etree__ExceptionContext._raise_if_stored = (int (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_17_ExceptionContext__raise_if_stored;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ExceptionContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ExceptionContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ExceptionContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ExceptionContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ExceptionContext = &__pyx_type_4lxml_5etree__ExceptionContext;
  __pyx_vtabptr_4lxml_5etree__Document = &__pyx_vtable_4lxml_5etree__Document;
  __pyx_vtable_4lxml_5etree__Document.getroot = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getroot;
  __pyx_vtable_4lxml_5etree__Document.hasdoctype = (int (*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_hasdoctype;
  __pyx_vtable_4lxml_5etree__Document.getdoctype = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getdoctype;
  __pyx_vtable_4lxml_5etree__Document.getxmlinfo = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_getxmlinfo;
  __pyx_vtable_4lxml_5etree__Document.isstandalone = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_isstandalone;
  __pyx_vtable_4lxml_5etree__Document.buildNewPrefix = (PyObject *(*)(struct LxmlDocument *))__pyx_f_4lxml_5etree_9_Document_buildNewPrefix;
  __pyx_vtable_4lxml_5etree__Document._findOrBuildNodeNs = (xmlNs *(*)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *, int))__pyx_f_4lxml_5etree_9_Document__findOrBuildNodeNs;
  __pyx_vtable_4lxml_5etree__Document._setNodeNs = (int (*)(struct LxmlDocument *, xmlNode *, const xmlChar *))__pyx_f_4lxml_5etree_9_Document__setNodeNs;
  if (PyType_Ready(&LxmlDocumentType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlDocumentType.tp_print = 0;
  if (__Pyx_SetVtable(LxmlDocumentType.tp_dict, __pyx_vtabptr_4lxml_5etree__Document) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Document", (PyObject *)&LxmlDocumentType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Document = &LxmlDocumentType;
  if (PyType_Ready(&LxmlElementType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlElementType.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__.doc = __pyx_doc_4lxml_5etree_8_Element_4__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_4__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__delitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__.doc = __pyx_doc_4lxml_5etree_8_Element_6__delitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_6__delitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__repr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__.doc = __pyx_doc_4lxml_5etree_8_Element_30__repr__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_30__repr__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__.doc = __pyx_doc_4lxml_5etree_8_Element_32__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_32__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_34__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_34__len__.doc = __pyx_doc_4lxml_5etree_8_Element_34__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_34__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__.doc = __pyx_doc_4lxml_5etree_8_Element_38__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_38__contains__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementType, "__iter__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__.doc = __pyx_doc_4lxml_5etree_8_Element_40__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8_Element_40__iter__;
    }
  }
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "_Element", (PyObject *)&LxmlElementType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Element = &LxmlElementType;
  __pyx_vtabptr_4lxml_5etree__BaseParser = &__pyx_vtable_4lxml_5etree__BaseParser;
  __pyx_vtable_4lxml_5etree__BaseParser._setBaseURL = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__setBaseURL;
  __pyx_vtable_4lxml_5etree__BaseParser._collectEvents = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__collectEvents;
  __pyx_vtable_4lxml_5etree__BaseParser._getParserContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__getParserContext;
  __pyx_vtable_4lxml_5etree__BaseParser._getPushParserContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__getPushParserContext;
  __pyx_vtable_4lxml_5etree__BaseParser._createContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__createContext;
  __pyx_vtable_4lxml_5etree__BaseParser._registerHtmlErrorHandler = (int (*)(struct __pyx_obj_4lxml_5etree__BaseParser *, xmlParserCtxt *))__pyx_f_4lxml_5etree_11_BaseParser__registerHtmlErrorHandler;
  __pyx_vtable_4lxml_5etree__BaseParser._newParserCtxt = (xmlParserCtxt *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__newParserCtxt;
  __pyx_vtable_4lxml_5etree__BaseParser._newPushParserCtxt = (xmlParserCtxt *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__newPushParserCtxt;
  __pyx_vtable_4lxml_5etree__BaseParser._copy = (struct __pyx_obj_4lxml_5etree__BaseParser *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_11_BaseParser__copy;
  __pyx_vtable_4lxml_5etree__BaseParser._parseUnicodeDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseUnicodeDoc;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *, int, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseDoc;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFile = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, char *))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile;
  __pyx_vtable_4lxml_5etree__BaseParser._parseDocFromFilelike = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__BaseParser *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFilelike;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__BaseParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__BaseParser.tp_dict, __pyx_vtabptr_4lxml_5etree__BaseParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__BaseParser = &__pyx_type_4lxml_5etree__BaseParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_QName) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_QName.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "QName", (PyObject *)&__pyx_type_4lxml_5etree_QName) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_QName = &__pyx_type_4lxml_5etree_QName;
  __pyx_vtabptr_4lxml_5etree__LogEntry = &__pyx_vtable_4lxml_5etree__LogEntry;
  __pyx_vtable_4lxml_5etree__LogEntry._setError = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__LogEntry *, xmlError *))__pyx_f_4lxml_5etree_9_LogEntry__setError;
  __pyx_vtable_4lxml_5etree__LogEntry._setGeneric = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__LogEntry *, int, int, int, int, PyObject *, PyObject *))__pyx_f_4lxml_5etree_9_LogEntry__setGeneric;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__LogEntry.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__LogEntry.tp_dict, __pyx_vtabptr_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_LogEntry", (PyObject *)&__pyx_type_4lxml_5etree__LogEntry) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__LogEntry = &__pyx_type_4lxml_5etree__LogEntry;
  __pyx_vtabptr_4lxml_5etree__BaseErrorLog = &__pyx_vtable_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree__BaseErrorLog.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_13_BaseErrorLog_copy;
  __pyx_vtable_4lxml_5etree__BaseErrorLog.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_13_BaseErrorLog_receive;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receive = (void (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, xmlError *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receive;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._receiveGeneric = (void (*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int, int, int, int, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__receiveGeneric;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._buildParseException = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildParseException;
  __pyx_vtable_4lxml_5etree__BaseErrorLog._buildExceptionMessage = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, PyObject *))__pyx_f_4lxml_5etree_13_BaseErrorLog__buildExceptionMessage;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__BaseErrorLog.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__BaseErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_BaseErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__BaseErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__BaseErrorLog = &__pyx_type_4lxml_5etree__BaseErrorLog;
  __pyx_vtabptr_4lxml_5etree__ListErrorLog = &__pyx_vtable_4lxml_5etree__ListErrorLog;
  __pyx_vtable_4lxml_5etree__ListErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree__ListErrorLog.__pyx_base.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_13_ListErrorLog_copy;
  __pyx_type_4lxml_5etree__ListErrorLog.tp_base = __pyx_ptype_4lxml_5etree__BaseErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ListErrorLog.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ListErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ListErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__ListErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ListErrorLog = &__pyx_type_4lxml_5etree__ListErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ErrorLogContext) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ErrorLogContext.tp_print = 0;
  __pyx_ptype_4lxml_5etree__ErrorLogContext = &__pyx_type_4lxml_5etree__ErrorLogContext;
  __pyx_vtabptr_4lxml_5etree__ErrorLog = &__pyx_vtable_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ListErrorLog;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base.__pyx_base.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_9_ErrorLog_copy;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx_base.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_9_ErrorLog_receive;
  __pyx_vtable_4lxml_5etree__ErrorLog.__pyx___enter__ = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog___enter__;
  __pyx_vtable_4lxml_5etree__ErrorLog.connect = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog_connect;
  __pyx_vtable_4lxml_5etree__ErrorLog.disconnect = (int (*)(struct __pyx_obj_4lxml_5etree__ErrorLog *))__pyx_f_4lxml_5etree_9_ErrorLog_disconnect;
  __pyx_vtable_4lxml_5etree__ErrorLog.clear = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_9_ErrorLog_clear;
  __pyx_type_4lxml_5etree__ErrorLog.tp_base = __pyx_ptype_4lxml_5etree__ListErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ErrorLog.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__ErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ErrorLog = &__pyx_type_4lxml_5etree__ErrorLog;
  __pyx_vtabptr_4lxml_5etree__DomainErrorLog = &__pyx_vtable_4lxml_5etree__DomainErrorLog;
  __pyx_vtable_4lxml_5etree__DomainErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__DomainErrorLog.__pyx_base.__pyx_base.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_15_DomainErrorLog_receive;
  __pyx_type_4lxml_5etree__DomainErrorLog.tp_base = __pyx_ptype_4lxml_5etree__ErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__DomainErrorLog.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__DomainErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_DomainErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__DomainErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__DomainErrorLog = &__pyx_type_4lxml_5etree__DomainErrorLog;
  __pyx_vtabptr_4lxml_5etree__RotatingErrorLog = &__pyx_vtable_4lxml_5etree__RotatingErrorLog;
  __pyx_vtable_4lxml_5etree__RotatingErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ErrorLog;
  __pyx_vtable_4lxml_5etree__RotatingErrorLog.__pyx_base.__pyx_base.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_17_RotatingErrorLog_receive;
  __pyx_type_4lxml_5etree__RotatingErrorLog.tp_base = __pyx_ptype_4lxml_5etree__ErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__RotatingErrorLog.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__RotatingErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_RotatingErrorLog", (PyObject *)&__pyx_type_4lxml_5etree__RotatingErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__RotatingErrorLog = &__pyx_type_4lxml_5etree__RotatingErrorLog;
  __pyx_vtabptr_4lxml_5etree_PyErrorLog = &__pyx_vtable_4lxml_5etree_PyErrorLog;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseErrorLog;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base.copy = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10PyErrorLog_copy;
  __pyx_vtable_4lxml_5etree_PyErrorLog.__pyx_base.receive = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseErrorLog *, struct __pyx_obj_4lxml_5etree__LogEntry *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10PyErrorLog_receive;
  __pyx_type_4lxml_5etree_PyErrorLog.tp_base = __pyx_ptype_4lxml_5etree__BaseErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_PyErrorLog.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_PyErrorLog.tp_dict, __pyx_vtabptr_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PyErrorLog", (PyObject *)&__pyx_type_4lxml_5etree_PyErrorLog) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_PyErrorLog = &__pyx_type_4lxml_5etree_PyErrorLog;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_DocInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_DocInfo.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "DocInfo", (PyObject *)&__pyx_type_4lxml_5etree_DocInfo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_DocInfo = &__pyx_type_4lxml_5etree_DocInfo;
  __pyx_vtabptr_4lxml_5etree___ContentOnlyElement = &__pyx_vtable_4lxml_5etree___ContentOnlyElement;
  __pyx_vtable_4lxml_5etree___ContentOnlyElement._raiseImmutable = (int (*)(struct __pyx_obj_4lxml_5etree___ContentOnlyElement *))__pyx_f_4lxml_5etree_20__ContentOnlyElement__raiseImmutable;
  __pyx_type_4lxml_5etree___ContentOnlyElement.tp_base = __pyx_ptype_4lxml_5etree__Element;
  if (PyType_Ready(&__pyx_type_4lxml_5etree___ContentOnlyElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree___ContentOnlyElement.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_6__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_8__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_8__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree___ContentOnlyElement, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__.doc = __pyx_doc_4lxml_5etree_20__ContentOnlyElement_10__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_20__ContentOnlyElement_10__len__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree___ContentOnlyElement.tp_dict, __pyx_vtabptr_4lxml_5etree___ContentOnlyElement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree___ContentOnlyElement = &__pyx_type_4lxml_5etree___ContentOnlyElement;
  __pyx_vtabptr_4lxml_5etree__Comment = &__pyx_vtable_4lxml_5etree__Comment;
  __pyx_vtable_4lxml_5etree__Comment.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  __pyx_type_4lxml_5etree__Comment.tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Comment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__Comment.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__Comment.tp_dict, __pyx_vtabptr_4lxml_5etree__Comment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Comment", (PyObject *)&__pyx_type_4lxml_5etree__Comment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Comment = &__pyx_type_4lxml_5etree__Comment;
  __pyx_vtabptr_4lxml_5etree__ProcessingInstruction = &__pyx_vtable_4lxml_5etree__ProcessingInstruction;
  __pyx_vtable_4lxml_5etree__ProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  __pyx_type_4lxml_5etree__ProcessingInstruction.tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ProcessingInstruction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ProcessingInstruction.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ProcessingInstruction.tp_dict, __pyx_vtabptr_4lxml_5etree__ProcessingInstruction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ProcessingInstruction", (PyObject *)&__pyx_type_4lxml_5etree__ProcessingInstruction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ProcessingInstruction = &__pyx_type_4lxml_5etree__ProcessingInstruction;
  __pyx_vtabptr_4lxml_5etree__Entity = &__pyx_vtable_4lxml_5etree__Entity;
  __pyx_vtable_4lxml_5etree__Entity.__pyx_base = *__pyx_vtabptr_4lxml_5etree___ContentOnlyElement;
  __pyx_type_4lxml_5etree__Entity.tp_base = __pyx_ptype_4lxml_5etree___ContentOnlyElement;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Entity) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__Entity.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__Entity.tp_dict, __pyx_vtabptr_4lxml_5etree__Entity) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Entity", (PyObject *)&__pyx_type_4lxml_5etree__Entity) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Entity = &__pyx_type_4lxml_5etree__Entity;
  __pyx_vtabptr_4lxml_5etree__ElementTree = &__pyx_vtable_4lxml_5etree__ElementTree;
  __pyx_vtable_4lxml_5etree__ElementTree._assertHasRoot = (int (*)(struct LxmlElementTree *))__pyx_f_4lxml_5etree_12_ElementTree__assertHasRoot;
  if (PyType_Ready(&LxmlElementTreeType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlElementTreeType.tp_print = 0;
  if (__Pyx_SetVtable(LxmlElementTreeType.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementTree", (PyObject *)&LxmlElementTreeType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementTree = &LxmlElementTreeType;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Attrib) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__Attrib.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "_Attrib", (PyObject *)&__pyx_type_4lxml_5etree__Attrib) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Attrib = &__pyx_type_4lxml_5etree__Attrib;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__AttribIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__AttribIterator.tp_print = 0;
  __pyx_ptype_4lxml_5etree__AttribIterator = &__pyx_type_4lxml_5etree__AttribIterator;
  __pyx_vtabptr_4lxml_5etree__ElementTagMatcher = &__pyx_vtable_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementTagMatcher._initTagMatch = (PyObject *(*)(struct LxmlElementTagMatcher *, PyObject *))__pyx_f_4lxml_5etree_18_ElementTagMatcher__initTagMatch;
  if (PyType_Ready(&LxmlElementTagMatcherType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlElementTagMatcherType.tp_print = 0;
  if (__Pyx_SetVtable(LxmlElementTagMatcherType.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementTagMatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementTagMatcher", (PyObject *)&LxmlElementTagMatcherType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementTagMatcher = &LxmlElementTagMatcherType;
  __pyx_vtabptr_4lxml_5etree__ElementIterator = &__pyx_vtable_4lxml_5etree__ElementIterator;
  __pyx_vtable_4lxml_5etree__ElementIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementIterator._storeNext = (void (*)(struct LxmlElementIterator *, struct LxmlElement *))__pyx_f_4lxml_5etree_16_ElementIterator__storeNext;
  LxmlElementIteratorType.tp_base = __pyx_ptype_4lxml_5etree__ElementTagMatcher;
  if (PyType_Ready(&LxmlElementIteratorType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlElementIteratorType.tp_print = 0;
  if (__Pyx_SetVtable(LxmlElementIteratorType.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementIterator", (PyObject *)&LxmlElementIteratorType) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementIterator = &LxmlElementIteratorType;
  __pyx_vtabptr_4lxml_5etree__MultiTagMatcher = &__pyx_vtable_4lxml_5etree__MultiTagMatcher;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.rejectsAll = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAll;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.rejectsAllAttributes = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_rejectsAllAttributes;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matchesType = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, int))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesType;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher._clear = (void (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *))__pyx_f_4lxml_5etree_16_MultiTagMatcher__clear;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.initTagMatch = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_initTagMatch;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher._storeTags = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_MultiTagMatcher__storeTags;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.cacheTags = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, struct LxmlDocument *, struct __pyx_opt_args_4lxml_5etree_16_MultiTagMatcher_cacheTags *__pyx_optional_args))__pyx_f_4lxml_5etree_16_MultiTagMatcher_cacheTags;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matches = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlNode *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matches;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matchesNsTag = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, const xmlChar *, const xmlChar *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesNsTag;
  __pyx_vtable_4lxml_5etree__MultiTagMatcher.matchesAttribute = (int (*)(struct __pyx_obj_4lxml_5etree__MultiTagMatcher *, xmlAttr *))__pyx_f_4lxml_5etree_16_MultiTagMatcher_matchesAttribute;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__MultiTagMatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__MultiTagMatcher.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__MultiTagMatcher.tp_dict, __pyx_vtabptr_4lxml_5etree__MultiTagMatcher) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__MultiTagMatcher = &__pyx_type_4lxml_5etree__MultiTagMatcher;
  __pyx_vtabptr_4lxml_5etree__ElementMatchIterator = &__pyx_vtable_4lxml_5etree__ElementMatchIterator;
  __pyx_vtable_4lxml_5etree__ElementMatchIterator._initTagMatcher = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, PyObject *))__pyx_f_4lxml_5etree_21_ElementMatchIterator__initTagMatcher;
  __pyx_vtable_4lxml_5etree__ElementMatchIterator._storeNext = (int (*)(struct __pyx_obj_4lxml_5etree__ElementMatchIterator *, struct LxmlElement *))__pyx_f_4lxml_5etree_21_ElementMatchIterator__storeNext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ElementMatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ElementMatchIterator.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ElementMatchIterator.tp_dict, __pyx_vtabptr_4lxml_5etree__ElementMatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_ElementMatchIterator", (PyObject *)&__pyx_type_4lxml_5etree__ElementMatchIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementMatchIterator = &__pyx_type_4lxml_5etree__ElementMatchIterator;
  __pyx_vtabptr_4lxml_5etree_ElementChildIterator = &__pyx_vtable_4lxml_5etree_ElementChildIterator;
  __pyx_vtable_4lxml_5etree_ElementChildIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  __pyx_type_4lxml_5etree_ElementChildIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementMatchIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementChildIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ElementChildIterator.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ElementChildIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_ElementChildIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementChildIterator", (PyObject *)&__pyx_type_4lxml_5etree_ElementChildIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementChildIterator = &__pyx_type_4lxml_5etree_ElementChildIterator;
  __pyx_vtabptr_4lxml_5etree_SiblingsIterator = &__pyx_vtable_4lxml_5etree_SiblingsIterator;
  __pyx_vtable_4lxml_5etree_SiblingsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  __pyx_type_4lxml_5etree_SiblingsIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementMatchIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_SiblingsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_SiblingsIterator.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_SiblingsIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_SiblingsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SiblingsIterator", (PyObject *)&__pyx_type_4lxml_5etree_SiblingsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_SiblingsIterator = &__pyx_type_4lxml_5etree_SiblingsIterator;
  __pyx_vtabptr_4lxml_5etree_AncestorsIterator = &__pyx_vtable_4lxml_5etree_AncestorsIterator;
  __pyx_vtable_4lxml_5etree_AncestorsIterator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementMatchIterator;
  __pyx_type_4lxml_5etree_AncestorsIterator.tp_base = __pyx_ptype_4lxml_5etree__ElementMatchIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_AncestorsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_AncestorsIterator.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_AncestorsIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_AncestorsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "AncestorsIterator", (PyObject *)&__pyx_type_4lxml_5etree_AncestorsIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_AncestorsIterator = &__pyx_type_4lxml_5etree_AncestorsIterator;
  __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator = &__pyx_vtable_4lxml_5etree_ElementDepthFirstIterator;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeAnyTag = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeAnyTag;
  __pyx_vtable_4lxml_5etree_ElementDepthFirstIterator._nextNodeMatchTag = (xmlNode *(*)(struct __pyx_obj_4lxml_5etree_ElementDepthFirstIterator *, xmlNode *))__pyx_f_4lxml_5etree_25ElementDepthFirstIterator__nextNodeMatchTag;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementDepthFirstIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ElementDepthFirstIterator.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ElementDepthFirstIterator.tp_dict, __pyx_vtabptr_4lxml_5etree_ElementDepthFirstIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementDepthFirstIterator", (PyObject *)&__pyx_type_4lxml_5etree_ElementDepthFirstIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementDepthFirstIterator = &__pyx_type_4lxml_5etree_ElementDepthFirstIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementTextIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ElementTextIterator.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "ElementTextIterator", (PyObject *)&__pyx_type_4lxml_5etree_ElementTextIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementTextIterator = &__pyx_type_4lxml_5etree_ElementTextIterator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_CDATA) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_CDATA.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "CDATA", (PyObject *)&__pyx_type_4lxml_5etree_CDATA) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_CDATA = &__pyx_type_4lxml_5etree_CDATA;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy__assertNode;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy._raise_unsupported_type = (int (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy__raise_unsupported_type;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.free_after_use = (void (*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *))__pyx_f_4lxml_5etree_14_ReadOnlyProxy_free_after_use;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.__pyx___copy__ = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_14_ReadOnlyProxy___copy__;
  __pyx_vtable_4lxml_5etree__ReadOnlyProxy.getchildren = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ReadOnlyProxy *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_14_ReadOnlyProxy_getchildren;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ReadOnlyProxy.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyProxy, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__.doc = __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_4__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree__ReadOnlyProxy, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__.doc = __pyx_doc_4lxml_5etree_14_ReadOnlyProxy_6__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_14_ReadOnlyProxy_6__len__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyProxy = &__pyx_type_4lxml_5etree__ReadOnlyProxy;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ReadOnlyPIProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ReadOnlyPIProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyPIProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyPIProxy = &__pyx_type_4lxml_5etree__ReadOnlyPIProxy;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ReadOnlyEntityProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ReadOnlyEntityProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyEntityProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyEntityProxy = &__pyx_type_4lxml_5etree__ReadOnlyEntityProxy;
  __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy = &__pyx_vtable_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__ReadOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ReadOnlyElementProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ReadOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ReadOnlyElementProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ReadOnlyElementProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy = &__pyx_type_4lxml_5etree__ReadOnlyElementProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__OpaqueNodeWrapper) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__OpaqueNodeWrapper.tp_print = 0;
  __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper = &__pyx_type_4lxml_5etree__OpaqueNodeWrapper;
  __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper;
  __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper._assertNode = (int (*)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *))__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper__assertNode;
  __pyx_vtable_4lxml_5etree__OpaqueDocumentWrapper.append = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__OpaqueDocumentWrapper *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_22_OpaqueDocumentWrapper_append;
  __pyx_type_4lxml_5etree__OpaqueDocumentWrapper.tp_base = __pyx_ptype_4lxml_5etree__OpaqueNodeWrapper;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__OpaqueDocumentWrapper) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__OpaqueDocumentWrapper.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__OpaqueDocumentWrapper.tp_dict, __pyx_vtabptr_4lxml_5etree__OpaqueDocumentWrapper) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__OpaqueDocumentWrapper = &__pyx_type_4lxml_5etree__OpaqueDocumentWrapper;
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyProxy;
  __pyx_type_4lxml_5etree__ModifyContentOnlyProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ModifyContentOnlyProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ModifyContentOnlyProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ModifyContentOnlyProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyPIProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy.tp_base = __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyPIProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyPIProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyPIProxy;
  __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy;
  __pyx_vtable_4lxml_5etree__ModifyContentOnlyEntityProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ModifyContentOnlyProxy;
  __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy.tp_base = __pyx_ptype_4lxml_5etree__ModifyContentOnlyProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__ModifyContentOnlyEntityProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ModifyContentOnlyEntityProxy = &__pyx_type_4lxml_5etree__ModifyContentOnlyEntityProxy;
  __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy = &__pyx_vtable_4lxml_5etree__AppendOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ReadOnlyElementProxy;
  __pyx_vtable_4lxml_5etree__AppendOnlyElementProxy.append = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__AppendOnlyElementProxy *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_23_AppendOnlyElementProxy_append;
  __pyx_type_4lxml_5etree__AppendOnlyElementProxy.tp_base = __pyx_ptype_4lxml_5etree__ReadOnlyElementProxy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__AppendOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__AppendOnlyElementProxy.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__AppendOnlyElementProxy.tp_dict, __pyx_vtabptr_4lxml_5etree__AppendOnlyElementProxy) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__AppendOnlyElementProxy = &__pyx_type_4lxml_5etree__AppendOnlyElementProxy;
  LxmlElementBaseType.tp_base = __pyx_ptype_4lxml_5etree__Element;
  if (PyType_Ready(&LxmlElementBaseType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlElementBaseType.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&LxmlElementBaseType, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_11ElementBase___init__.doc = __pyx_doc_4lxml_5etree_11ElementBase___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_11ElementBase___init__;
    }
  }
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "ElementBase", (PyObject *)&LxmlElementBaseType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementBase = &LxmlElementBaseType;
  __pyx_vtabptr_4lxml_5etree_CommentBase = &__pyx_vtable_4lxml_5etree_CommentBase;
  __pyx_vtable_4lxml_5etree_CommentBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Comment;
  __pyx_type_4lxml_5etree_CommentBase.tp_base = __pyx_ptype_4lxml_5etree__Comment;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_CommentBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_CommentBase.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_CommentBase.tp_dict, __pyx_vtabptr_4lxml_5etree_CommentBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CommentBase", (PyObject *)&__pyx_type_4lxml_5etree_CommentBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_CommentBase = &__pyx_type_4lxml_5etree_CommentBase;
  __pyx_vtabptr_4lxml_5etree_PIBase = &__pyx_vtable_4lxml_5etree_PIBase;
  __pyx_vtable_4lxml_5etree_PIBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ProcessingInstruction;
  __pyx_type_4lxml_5etree_PIBase.tp_base = __pyx_ptype_4lxml_5etree__ProcessingInstruction;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_PIBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_PIBase.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_PIBase.tp_dict, __pyx_vtabptr_4lxml_5etree_PIBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PIBase", (PyObject *)&__pyx_type_4lxml_5etree_PIBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_PIBase = &__pyx_type_4lxml_5etree_PIBase;
  __pyx_vtabptr_4lxml_5etree_EntityBase = &__pyx_vtable_4lxml_5etree_EntityBase;
  __pyx_vtable_4lxml_5etree_EntityBase.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Entity;
  __pyx_type_4lxml_5etree_EntityBase.tp_base = __pyx_ptype_4lxml_5etree__Entity;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_EntityBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_EntityBase.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_EntityBase.tp_dict, __pyx_vtabptr_4lxml_5etree_EntityBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "EntityBase", (PyObject *)&__pyx_type_4lxml_5etree_EntityBase) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_EntityBase = &__pyx_type_4lxml_5etree_EntityBase;
  if (PyType_Ready(&LxmlElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlElementClassLookupType.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "ElementClassLookup", (PyObject *)&LxmlElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementClassLookup = &LxmlElementClassLookupType;
  __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup = &__pyx_vtable_4lxml_5etree_FallbackElementClassLookup;
  __pyx_vtable_4lxml_5etree_FallbackElementClassLookup._setFallback = (void (*)(struct LxmlFallbackElementClassLookup *, struct LxmlElementClassLookup *))__pyx_f_4lxml_5etree_26FallbackElementClassLookup__setFallback;
  LxmlFallbackElementClassLookupType.tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup;
  if (PyType_Ready(&LxmlFallbackElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  LxmlFallbackElementClassLookupType.tp_print = 0;
  if (__Pyx_SetVtable(LxmlFallbackElementClassLookupType.tp_dict, __pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "FallbackElementClassLookup", (PyObject *)&LxmlFallbackElementClassLookupType) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_FallbackElementClassLookup = &LxmlFallbackElementClassLookupType;
  __pyx_type_4lxml_5etree_ElementDefaultClassLookup.tp_base = __pyx_ptype_4lxml_5etree_ElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementDefaultClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ElementDefaultClassLookup.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "ElementDefaultClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_ElementDefaultClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementDefaultClassLookup = &__pyx_type_4lxml_5etree_ElementDefaultClassLookup;
  __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_AttributeBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_AttributeBasedElementClassLookup.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_AttributeBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "AttributeBasedElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_AttributeBasedElementClassLookup = &__pyx_type_4lxml_5etree_AttributeBasedElementClassLookup;
  __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup;
  __pyx_vtable_4lxml_5etree_ParserBasedElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_ParserBasedElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ParserBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ParserBasedElementClassLookup.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ParserBasedElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_ParserBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ParserBasedElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_ParserBasedElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup = &__pyx_type_4lxml_5etree_ParserBasedElementClassLookup;
  __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup = &__pyx_vtable_4lxml_5etree_CustomElementClassLookup;
  __pyx_vtable_4lxml_5etree_CustomElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_CustomElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_CustomElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_CustomElementClassLookup.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_CustomElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_CustomElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CustomElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_CustomElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_CustomElementClassLookup = &__pyx_type_4lxml_5etree_CustomElementClassLookup;
  __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup = &__pyx_vtable_4lxml_5etree_PythonElementClassLookup;
  __pyx_vtable_4lxml_5etree_PythonElementClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_PythonElementClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_PythonElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_PythonElementClassLookup.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_PythonElementClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_PythonElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "PythonElementClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_PythonElementClassLookup) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_PythonElementClassLookup = &__pyx_type_4lxml_5etree_PythonElementClassLookup;
  __pyx_vtabptr_4lxml_5etree__NamespaceRegistry = &__pyx_vtable_4lxml_5etree__NamespaceRegistry;
  __pyx_vtable_4lxml_5etree__NamespaceRegistry._get = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, PyObject *))__pyx_f_4lxml_5etree_18_NamespaceRegistry__get;
  __pyx_vtable_4lxml_5etree__NamespaceRegistry._getForString = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__NamespaceRegistry *, char *))__pyx_f_4lxml_5etree_18_NamespaceRegistry__getForString;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__NamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__NamespaceRegistry.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__NamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__NamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__NamespaceRegistry = &__pyx_type_4lxml_5etree__NamespaceRegistry;
  __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry = &__pyx_vtable_4lxml_5etree__ClassNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__ClassNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  __pyx_type_4lxml_5etree__ClassNamespaceRegistry.tp_base = __pyx_ptype_4lxml_5etree__NamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ClassNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ClassNamespaceRegistry.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ClassNamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__ClassNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ClassNamespaceRegistry = &__pyx_type_4lxml_5etree__ClassNamespaceRegistry;
  __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup;
  __pyx_vtable_4lxml_5etree_ElementNamespaceClassLookup.__pyx_base = *__pyx_vtabptr_4lxml_5etree_FallbackElementClassLookup;
  __pyx_type_4lxml_5etree_ElementNamespaceClassLookup.tp_base = __pyx_ptype_4lxml_5etree_FallbackElementClassLookup;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ElementNamespaceClassLookup) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ElementNamespaceClassLookup.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ElementNamespaceClassLookup.tp_dict, __pyx_vtabptr_4lxml_5etree_ElementNamespaceClassLookup) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ElementNamespaceClassLookup", (PyObject *)&__pyx_type_4lxml_5etree_ElementNamespaceClassLookup) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ElementNamespaceClassLookup = &__pyx_type_4lxml_5etree_ElementNamespaceClassLookup;
  __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__FunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__NamespaceRegistry;
  __pyx_type_4lxml_5etree__FunctionNamespaceRegistry.tp_base = __pyx_ptype_4lxml_5etree__NamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__FunctionNamespaceRegistry.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FunctionNamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry;
  __pyx_vtable_4lxml_5etree__XPathFunctionNamespaceRegistry.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FunctionNamespaceRegistry;
  __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry.tp_base = __pyx_ptype_4lxml_5etree__FunctionNamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__XPathFunctionNamespaceRegistry) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XPathFunctionNamespaceRegistry = &__pyx_type_4lxml_5etree__XPathFunctionNamespaceRegistry;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__InputDocument) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__InputDocument.tp_print = 0;
  __pyx_ptype_4lxml_5etree__InputDocument = &__pyx_type_4lxml_5etree__InputDocument;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_Resolver) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_Resolver.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "Resolver", (PyObject *)&__pyx_type_4lxml_5etree_Resolver) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_Resolver = &__pyx_type_4lxml_5etree_Resolver;
  __pyx_vtabptr_4lxml_5etree__ResolverRegistry = &__pyx_vtable_4lxml_5etree__ResolverRegistry;
  __pyx_vtable_4lxml_5etree__ResolverRegistry._copy = (struct __pyx_obj_4lxml_5etree__ResolverRegistry *(*)(struct __pyx_obj_4lxml_5etree__ResolverRegistry *))__pyx_f_4lxml_5etree_17_ResolverRegistry__copy;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ResolverRegistry) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ResolverRegistry.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ResolverRegistry.tp_dict, __pyx_vtabptr_4lxml_5etree__ResolverRegistry) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ResolverRegistry = &__pyx_type_4lxml_5etree__ResolverRegistry;
  __pyx_vtabptr_4lxml_5etree__ResolverContext = &__pyx_vtable_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ExceptionContext;
  __pyx_vtable_4lxml_5etree__ResolverContext.__pyx_base.clear = (void (*)(struct __pyx_obj_4lxml_5etree__ExceptionContext *))__pyx_f_4lxml_5etree_16_ResolverContext_clear;
  __pyx_type_4lxml_5etree__ResolverContext.tp_base = __pyx_ptype_4lxml_5etree__ExceptionContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ResolverContext) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ResolverContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ResolverContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ResolverContext) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ResolverContext = &__pyx_type_4lxml_5etree__ResolverContext;
  __pyx_vtabptr_4lxml_5etree__ParserContext = &__pyx_vtable_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__ParserContext._copy = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext__copy;
  __pyx_vtable_4lxml_5etree__ParserContext._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_14_ParserContext__initParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext._resetParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext__resetParserContext;
  __pyx_vtable_4lxml_5etree__ParserContext.prepare = (int (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext_prepare;
  __pyx_vtable_4lxml_5etree__ParserContext.cleanup = (int (*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_14_ParserContext_cleanup;
  __pyx_vtable_4lxml_5etree__ParserContext._handleParseResult = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResult;
  __pyx_vtable_4lxml_5etree__ParserContext._handleParseResultDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_14_ParserContext__handleParseResultDoc;
  __pyx_type_4lxml_5etree__ParserContext.tp_base = __pyx_ptype_4lxml_5etree__ResolverContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ParserContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ParserContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ParserContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ParserContext = &__pyx_type_4lxml_5etree__ParserContext;
  __pyx_vtabptr_4lxml_5etree__SaxParserContext = &__pyx_vtable_4lxml_5etree__SaxParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext.__pyx_base._initParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__initParserContext;
  __pyx_vtable_4lxml_5etree__SaxParserContext._setSaxParserTarget = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, struct __pyx_obj_4lxml_5etree__SaxParserTarget *))__pyx_f_4lxml_5etree_17_SaxParserContext__setSaxParserTarget;
  __pyx_vtable_4lxml_5etree__SaxParserContext._connectTarget = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__connectTarget;
  __pyx_vtable_4lxml_5etree__SaxParserContext._connectEvents = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__connectEvents;
  __pyx_vtable_4lxml_5etree__SaxParserContext._setEventFilter = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_17_SaxParserContext__setEventFilter;
  __pyx_vtable_4lxml_5etree__SaxParserContext.startDocument = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlDoc *))__pyx_f_4lxml_5etree_17_SaxParserContext_startDocument;
  __pyx_vtable_4lxml_5etree__SaxParserContext.pushEvent = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, PyObject *, xmlNode *))__pyx_f_4lxml_5etree_17_SaxParserContext_pushEvent;
  __pyx_vtable_4lxml_5etree__SaxParserContext.flushEvents = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *))__pyx_f_4lxml_5etree_17_SaxParserContext_flushEvents;
  __pyx_vtable_4lxml_5etree__SaxParserContext._handleSaxException = (void (*)(struct __pyx_obj_4lxml_5etree__SaxParserContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_17_SaxParserContext__handleSaxException;
  __pyx_type_4lxml_5etree__SaxParserContext.tp_base = __pyx_ptype_4lxml_5etree__ParserContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__SaxParserContext) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__SaxParserContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__SaxParserContext.tp_dict, __pyx_vtabptr_4lxml_5etree__SaxParserContext) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__SaxParserContext = &__pyx_type_4lxml_5etree__SaxParserContext;
  __pyx_vtabptr_4lxml_5etree__TargetParserContext = &__pyx_vtable_4lxml_5etree__TargetParserContext;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserContext;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._copy = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_20_TargetParserContext__copy;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResult = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResult;
  __pyx_vtable_4lxml_5etree__TargetParserContext.__pyx_base.__pyx_base._handleParseResultDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__ParserContext *, struct __pyx_obj_4lxml_5etree__BaseParser *, xmlDoc *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__handleParseResultDoc;
  __pyx_vtable_4lxml_5etree__TargetParserContext._setTarget = (int (*)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, PyObject *))__pyx_f_4lxml_5etree_20_TargetParserContext__setTarget;
  __pyx_vtable_4lxml_5etree__TargetParserContext._cleanupTargetParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__TargetParserContext *, xmlDoc *))__pyx_f_4lxml_5etree_20_TargetParserContext__cleanupTargetParserContext;
  __pyx_type_4lxml_5etree__TargetParserContext.tp_base = __pyx_ptype_4lxml_5etree__SaxParserContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__TargetParserContext) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__TargetParserContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__TargetParserContext.tp_dict, __pyx_vtabptr_4lxml_5etree__TargetParserContext) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__TargetParserContext = &__pyx_type_4lxml_5etree__TargetParserContext;
  __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext = &__pyx_vtable_4lxml_5etree__ParserSchemaValidationContext;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.copy = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_copy;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.inject_default_attributes = (void (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlDoc *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_inject_default_attributes;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.connect = (int (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *, xmlParserCtxt *, struct __pyx_obj_4lxml_5etree__BaseErrorLog *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_connect;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.disconnect = (void (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_disconnect;
  __pyx_vtable_4lxml_5etree__ParserSchemaValidationContext.isvalid = (int (*)(struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *))__pyx_f_4lxml_5etree_30_ParserSchemaValidationContext_isvalid;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserSchemaValidationContext) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ParserSchemaValidationContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ParserSchemaValidationContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ParserSchemaValidationContext) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ParserSchemaValidationContext = &__pyx_type_4lxml_5etree__ParserSchemaValidationContext;
  __pyx_vtabptr_4lxml_5etree__Validator = &__pyx_vtable_4lxml_5etree__Validator;
  __pyx_vtable_4lxml_5etree__Validator._append_log_message = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__Validator *, int, int, int, int, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10_Validator__append_log_message;
  __pyx_vtable_4lxml_5etree__Validator._clear_error_log = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__Validator *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_10_Validator__clear_error_log;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__Validator.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__Validator.tp_dict, __pyx_vtabptr_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_Validator", (PyObject *)&__pyx_type_4lxml_5etree__Validator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__Validator = &__pyx_type_4lxml_5etree__Validator;
  __pyx_vtabptr_4lxml_5etree_XMLSchema = &__pyx_vtable_4lxml_5etree_XMLSchema;
  __pyx_vtable_4lxml_5etree_XMLSchema.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_vtable_4lxml_5etree_XMLSchema._newSaxValidator = (struct __pyx_obj_4lxml_5etree__ParserSchemaValidationContext *(*)(struct __pyx_obj_4lxml_5etree_XMLSchema *, int))__pyx_f_4lxml_5etree_9XMLSchema__newSaxValidator;
  __pyx_type_4lxml_5etree_XMLSchema.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XMLSchema.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XMLSchema, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__.doc = __pyx_doc_4lxml_5etree_9XMLSchema_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_9XMLSchema_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XMLSchema.tp_dict, __pyx_vtabptr_4lxml_5etree_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XMLSchema", (PyObject *)&__pyx_type_4lxml_5etree_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XMLSchema = &__pyx_type_4lxml_5etree_XMLSchema;
  __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext = &__pyx_vtable_4lxml_5etree__ParserDictionaryContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initMainParserContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext._findThreadParserContext = (struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.setDefaultParser = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.getDefaultParser = (struct __pyx_obj_4lxml_5etree__BaseParser *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_getDefaultParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext._getThreadDict = (xmlDict *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initThreadDictRef = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDict **))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initParserDict = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initXPathParserDict = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initXPathParserDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.initDocDict = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, xmlDoc *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_initDocDict;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.findImpliedContext = (struct __pyx_obj_4lxml_5etree__ParserContext *(*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_findImpliedContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContextFromParser = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__BaseParser *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContextFromParser;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.pushImpliedContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *, struct __pyx_obj_4lxml_5etree__ParserContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_pushImpliedContext;
  __pyx_vtable_4lxml_5etree__ParserDictionaryContext.popImpliedContext = (void (*)(struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *))__pyx_f_4lxml_5etree_24_ParserDictionaryContext_popImpliedContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParserDictionaryContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ParserDictionaryContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ParserDictionaryContext.tp_dict, __pyx_vtabptr_4lxml_5etree__ParserDictionaryContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ParserDictionaryContext = &__pyx_type_4lxml_5etree__ParserDictionaryContext;
  __pyx_vtabptr_4lxml_5etree__FileReaderContext = &__pyx_vtable_4lxml_5etree__FileReaderContext;
  __pyx_vtable_4lxml_5etree__FileReaderContext._close_file = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__close_file;
  __pyx_vtable_4lxml_5etree__FileReaderContext._createParserInputBuffer = (xmlParserInputBuffer *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInputBuffer;
  __pyx_vtable_4lxml_5etree__FileReaderContext._createParserInput = (xmlParserInput *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *))__pyx_f_4lxml_5etree_18_FileReaderContext__createParserInput;
  __pyx_vtable_4lxml_5etree__FileReaderContext._readDtd = (xmlDtd *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *))__pyx_f_4lxml_5etree_18_FileReaderContext__readDtd;
  __pyx_vtable_4lxml_5etree__FileReaderContext._readDoc = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, xmlParserCtxt *, int))__pyx_f_4lxml_5etree_18_FileReaderContext__readDoc;
  __pyx_vtable_4lxml_5etree__FileReaderContext.copyToBuffer = (int (*)(struct __pyx_obj_4lxml_5etree__FileReaderContext *, char *, int))__pyx_f_4lxml_5etree_18_FileReaderContext_copyToBuffer;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__FileReaderContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FileReaderContext.tp_dict, __pyx_vtabptr_4lxml_5etree__FileReaderContext) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FileReaderContext = &__pyx_type_4lxml_5etree__FileReaderContext;
  __pyx_vtabptr_4lxml_5etree__FeedParser = &__pyx_vtable_4lxml_5etree__FeedParser;
  __pyx_vtable_4lxml_5etree__FeedParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseParser;
  __pyx_vtable_4lxml_5etree__FeedParser.feed = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FeedParser *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_11_FeedParser_feed;
  __pyx_vtable_4lxml_5etree__FeedParser.close = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__FeedParser *, int __pyx_skip_dispatch))__pyx_f_4lxml_5etree_11_FeedParser_close;
  __pyx_type_4lxml_5etree__FeedParser.tp_base = __pyx_ptype_4lxml_5etree__BaseParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__FeedParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FeedParser.tp_dict, __pyx_vtabptr_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_FeedParser", (PyObject *)&__pyx_type_4lxml_5etree__FeedParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FeedParser = &__pyx_type_4lxml_5etree__FeedParser;
  __pyx_vtabptr_4lxml_5etree_XMLParser = &__pyx_vtable_4lxml_5etree_XMLParser;
  __pyx_vtable_4lxml_5etree_XMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  __pyx_type_4lxml_5etree_XMLParser.tp_base = __pyx_ptype_4lxml_5etree__FeedParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XMLParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XMLParser.tp_dict, __pyx_vtabptr_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XMLParser", (PyObject *)&__pyx_type_4lxml_5etree_XMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XMLParser = &__pyx_type_4lxml_5etree_XMLParser;
  __pyx_vtabptr_4lxml_5etree_XMLPullParser = &__pyx_vtable_4lxml_5etree_XMLPullParser;
  __pyx_vtable_4lxml_5etree_XMLPullParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  __pyx_type_4lxml_5etree_XMLPullParser.tp_base = __pyx_ptype_4lxml_5etree_XMLParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XMLPullParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XMLPullParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XMLPullParser.tp_dict, __pyx_vtabptr_4lxml_5etree_XMLPullParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XMLPullParser", (PyObject *)&__pyx_type_4lxml_5etree_XMLPullParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XMLPullParser = &__pyx_type_4lxml_5etree_XMLPullParser;
  __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser = &__pyx_vtable_4lxml_5etree_ETCompatXMLParser;
  __pyx_vtable_4lxml_5etree_ETCompatXMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XMLParser;
  __pyx_type_4lxml_5etree_ETCompatXMLParser.tp_base = __pyx_ptype_4lxml_5etree_XMLParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ETCompatXMLParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ETCompatXMLParser.tp_dict, __pyx_vtabptr_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ETCompatXMLParser", (PyObject *)&__pyx_type_4lxml_5etree_ETCompatXMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ETCompatXMLParser = &__pyx_type_4lxml_5etree_ETCompatXMLParser;
  __pyx_vtabptr_4lxml_5etree_HTMLParser = &__pyx_vtable_4lxml_5etree_HTMLParser;
  __pyx_vtable_4lxml_5etree_HTMLParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree__FeedParser;
  __pyx_type_4lxml_5etree_HTMLParser.tp_base = __pyx_ptype_4lxml_5etree__FeedParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_HTMLParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_HTMLParser.tp_dict, __pyx_vtabptr_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HTMLParser", (PyObject *)&__pyx_type_4lxml_5etree_HTMLParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_HTMLParser = &__pyx_type_4lxml_5etree_HTMLParser;
  __pyx_vtabptr_4lxml_5etree_HTMLPullParser = &__pyx_vtable_4lxml_5etree_HTMLPullParser;
  __pyx_vtable_4lxml_5etree_HTMLPullParser.__pyx_base = *__pyx_vtabptr_4lxml_5etree_HTMLParser;
  __pyx_type_4lxml_5etree_HTMLPullParser.tp_base = __pyx_ptype_4lxml_5etree_HTMLParser;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_HTMLPullParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_HTMLPullParser.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_HTMLPullParser.tp_dict, __pyx_vtabptr_4lxml_5etree_HTMLPullParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "HTMLPullParser", (PyObject *)&__pyx_type_4lxml_5etree_HTMLPullParser) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_HTMLPullParser = &__pyx_type_4lxml_5etree_HTMLPullParser;
  __pyx_vtabptr_4lxml_5etree__SaxParserTarget = &__pyx_vtable_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxStart;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxEnd;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxData;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxDoctype = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxDoctype;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxPi;
  __pyx_vtable_4lxml_5etree__SaxParserTarget._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_16_SaxParserTarget__handleSaxComment;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__SaxParserTarget) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__SaxParserTarget.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__SaxParserTarget.tp_dict, __pyx_vtabptr_4lxml_5etree__SaxParserTarget) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_SaxParserTarget", (PyObject *)&__pyx_type_4lxml_5etree__SaxParserTarget) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__SaxParserTarget = &__pyx_type_4lxml_5etree__SaxParserTarget;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ParseEventsIterator) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ParseEventsIterator.tp_print = 0;
  __pyx_ptype_4lxml_5etree__ParseEventsIterator = &__pyx_type_4lxml_5etree__ParseEventsIterator;
  __pyx_vtabptr_4lxml_5etree_TreeBuilder = &__pyx_vtable_4lxml_5etree_TreeBuilder;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxStart;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxEnd;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxData;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxPi;
  __pyx_vtable_4lxml_5etree_TreeBuilder.__pyx_base._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_11TreeBuilder__handleSaxComment;
  __pyx_vtable_4lxml_5etree_TreeBuilder._flush = (int (*)(struct __pyx_obj_4lxml_5etree_TreeBuilder *))__pyx_f_4lxml_5etree_11TreeBuilder__flush;
  __pyx_type_4lxml_5etree_TreeBuilder.tp_base = __pyx_ptype_4lxml_5etree__SaxParserTarget;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_TreeBuilder.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_TreeBuilder.tp_dict, __pyx_vtabptr_4lxml_5etree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "TreeBuilder", (PyObject *)&__pyx_type_4lxml_5etree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_TreeBuilder = &__pyx_type_4lxml_5etree_TreeBuilder;
  __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget = &__pyx_vtable_4lxml_5etree__PythonSaxParserTarget;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base = *__pyx_vtabptr_4lxml_5etree__SaxParserTarget;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxStart = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxStart;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxEnd = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxEnd;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxData = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxData;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxDoctype = (int (*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxDoctype;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxPi = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxPi;
  __pyx_vtable_4lxml_5etree__PythonSaxParserTarget.__pyx_base._handleSaxComment = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__SaxParserTarget *, PyObject *))__pyx_f_4lxml_5etree_22_PythonSaxParserTarget__handleSaxComment;
  __pyx_type_4lxml_5etree__PythonSaxParserTarget.tp_base = __pyx_ptype_4lxml_5etree__SaxParserTarget;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__PythonSaxParserTarget) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__PythonSaxParserTarget.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__PythonSaxParserTarget.tp_dict, __pyx_vtabptr_4lxml_5etree__PythonSaxParserTarget) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__PythonSaxParserTarget = &__pyx_type_4lxml_5etree__PythonSaxParserTarget;
  __pyx_vtabptr_4lxml_5etree__FilelikeWriter = &__pyx_vtable_4lxml_5etree__FilelikeWriter;
  __pyx_vtable_4lxml_5etree__FilelikeWriter._createOutputBuffer = (xmlOutputBuffer *(*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, xmlCharEncodingHandler *))__pyx_f_4lxml_5etree_15_FilelikeWriter__createOutputBuffer;
  __pyx_vtable_4lxml_5etree__FilelikeWriter.write = (int (*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *, char *, int))__pyx_f_4lxml_5etree_15_FilelikeWriter_write;
  __pyx_vtable_4lxml_5etree__FilelikeWriter.close = (int (*)(struct __pyx_obj_4lxml_5etree__FilelikeWriter *))__pyx_f_4lxml_5etree_15_FilelikeWriter_close;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__FilelikeWriter.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__FilelikeWriter.tp_dict, __pyx_vtabptr_4lxml_5etree__FilelikeWriter) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__FilelikeWriter = &__pyx_type_4lxml_5etree__FilelikeWriter;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_xmlfile) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_xmlfile.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "xmlfile", (PyObject *)&__pyx_type_4lxml_5etree_xmlfile) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_xmlfile = &__pyx_type_4lxml_5etree_xmlfile;
  __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter = &__pyx_vtable_4lxml_5etree__IncrementalFileWriter;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_qname = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_qname;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_start_element = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_start_element;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_attributes_and_namespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_and_namespaces;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_attributes_list = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_attributes_list;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._write_end_element = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._find_prefix = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__find_prefix;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._collect_namespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, PyObject *))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__collect_namespaces;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._close = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__close;
  __pyx_vtable_4lxml_5etree__IncrementalFileWriter._handle_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IncrementalFileWriter *, int))__pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__IncrementalFileWriter) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__IncrementalFileWriter.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__IncrementalFileWriter.tp_dict, __pyx_vtabptr_4lxml_5etree__IncrementalFileWriter) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__IncrementalFileWriter = &__pyx_type_4lxml_5etree__IncrementalFileWriter;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__FileWriterElement) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__FileWriterElement.tp_print = 0;
  __pyx_ptype_4lxml_5etree__FileWriterElement = &__pyx_type_4lxml_5etree__FileWriterElement;
  __pyx_vtabptr_4lxml_5etree_iterparse = &__pyx_vtable_4lxml_5etree_iterparse;
  __pyx_vtable_4lxml_5etree_iterparse._close_source = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_iterparse *))__pyx_f_4lxml_5etree_9iterparse__close_source;
  __pyx_vtable_4lxml_5etree_iterparse._read_more_events = (int (*)(struct __pyx_obj_4lxml_5etree_iterparse *, struct __pyx_obj_4lxml_5etree__SaxParserContext *))__pyx_f_4lxml_5etree_9iterparse__read_more_events;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_iterparse) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_iterparse.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_iterparse.tp_dict, __pyx_vtabptr_4lxml_5etree_iterparse) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "iterparse", (PyObject *)&__pyx_type_4lxml_5etree_iterparse) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_iterparse = &__pyx_type_4lxml_5etree_iterparse;
  __pyx_vtabptr_4lxml_5etree_iterwalk = &__pyx_vtable_4lxml_5etree_iterwalk;
  __pyx_vtable_4lxml_5etree_iterwalk._start_node = (int (*)(struct __pyx_obj_4lxml_5etree_iterwalk *, struct LxmlElement *))__pyx_f_4lxml_5etree_8iterwalk__start_node;
  __pyx_vtable_4lxml_5etree_iterwalk._end_node = (struct LxmlElement *(*)(struct __pyx_obj_4lxml_5etree_iterwalk *))__pyx_f_4lxml_5etree_8iterwalk__end_node;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_iterwalk.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_iterwalk.tp_dict, __pyx_vtabptr_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "iterwalk", (PyObject *)&__pyx_type_4lxml_5etree_iterwalk) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_iterwalk = &__pyx_type_4lxml_5etree_iterwalk;
  __pyx_vtabptr_4lxml_5etree__IDDict = &__pyx_vtable_4lxml_5etree__IDDict;
  __pyx_vtable_4lxml_5etree__IDDict._build_keys = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IDDict *))__pyx_f_4lxml_5etree_7_IDDict__build_keys;
  __pyx_vtable_4lxml_5etree__IDDict._build_items = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__IDDict *))__pyx_f_4lxml_5etree_7_IDDict__build_items;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__IDDict) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__IDDict.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__IDDict.tp_dict, __pyx_vtabptr_4lxml_5etree__IDDict) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_IDDict", (PyObject *)&__pyx_type_4lxml_5etree__IDDict) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__IDDict = &__pyx_type_4lxml_5etree__IDDict;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XInclude) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XInclude.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XInclude, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__.doc = __pyx_doc_4lxml_5etree_8XInclude_2__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_8XInclude_2__call__;
    }
  }
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "XInclude", (PyObject *)&__pyx_type_4lxml_5etree_XInclude) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XInclude = &__pyx_type_4lxml_5etree_XInclude;
  __pyx_vtabptr_4lxml_5etree__ExsltRegExp = &__pyx_vtable_4lxml_5etree__ExsltRegExp;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._make_string = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *))__pyx_f_4lxml_5etree_12_ExsltRegExp__make_string;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._compile = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_ExsltRegExp__compile;
  __pyx_vtable_4lxml_5etree__ExsltRegExp._register_in_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__ExsltRegExp *, struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_ExsltRegExp__register_in_context;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ExsltRegExp.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__ExsltRegExp.tp_dict, __pyx_vtabptr_4lxml_5etree__ExsltRegExp) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ExsltRegExp = &__pyx_type_4lxml_5etree__ExsltRegExp;
  __pyx_vtabptr_4lxml_5etree__BaseContext = &__pyx_vtable_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__BaseContext._copy = (struct __pyx_obj_4lxml_5etree__BaseContext *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__copy;
  __pyx_vtable_4lxml_5etree__BaseContext._to_utf = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__to_utf;
  __pyx_vtable_4lxml_5etree__BaseContext._set_xpath_context = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_12_BaseContext__set_xpath_context;
  __pyx_vtable_4lxml_5etree__BaseContext._register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_12_BaseContext__register_context;
  __pyx_vtable_4lxml_5etree__BaseContext._cleanup_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__cleanup_context;
  __pyx_vtable_4lxml_5etree__BaseContext._release_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__release_context;
  __pyx_vtable_4lxml_5etree__BaseContext.addNamespace = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext_addNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext.registerNamespace = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext_registerNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext.registerLocalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext.registerGlobalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalNamespaces = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalNamespaces;
  __pyx_vtable_4lxml_5etree__BaseContext._unregisterNamespace = (void (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__unregisterNamespace;
  __pyx_vtable_4lxml_5etree__BaseContext._addLocalExtensionFunction = (int (*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__addLocalExtensionFunction;
  __pyx_vtable_4lxml_5etree__BaseContext.registerGlobalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_registerGlobalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.registerLocalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_registerLocalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterAllFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_unregisterAllFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext.unregisterGlobalFunctions = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, void *, __pyx_t_4lxml_5etree__register_function))__pyx_f_4lxml_5etree_12_BaseContext_unregisterGlobalFunctions;
  __pyx_vtable_4lxml_5etree__BaseContext._find_cached_function = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, const xmlChar *, const xmlChar *))__pyx_f_4lxml_5etree_12_BaseContext__find_cached_function;
  __pyx_vtable_4lxml_5etree__BaseContext._release_temp_refs = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_BaseContext__release_temp_refs;
  __pyx_vtable_4lxml_5etree__BaseContext._hold = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, PyObject *))__pyx_f_4lxml_5etree_12_BaseContext__hold;
  __pyx_vtable_4lxml_5etree__BaseContext._findDocumentForNode = (struct LxmlDocument *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *, xmlNode *))__pyx_f_4lxml_5etree_12_BaseContext__findDocumentForNode;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__BaseContext) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__BaseContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__BaseContext.tp_dict, __pyx_vtabptr_4lxml_5etree__BaseContext) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__BaseContext = &__pyx_type_4lxml_5etree__BaseContext;
  __pyx_type_4lxml_5etree__ElementUnicodeResult.tp_base = (&PyUnicode_Type);
  if (PyType_Ready(&__pyx_type_4lxml_5etree__ElementUnicodeResult) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__ElementUnicodeResult.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "_ElementUnicodeResult", (PyObject *)&__pyx_type_4lxml_5etree__ElementUnicodeResult) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__ElementUnicodeResult = &__pyx_type_4lxml_5etree__ElementUnicodeResult;
  __pyx_vtabptr_4lxml_5etree__XPathContext = &__pyx_vtable_4lxml_5etree__XPathContext;
  __pyx_vtable_4lxml_5etree__XPathContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__XPathContext.set_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, xmlXPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_set_context;
  __pyx_vtable_4lxml_5etree__XPathContext.register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_13_XPathContext_register_context;
  __pyx_vtable_4lxml_5etree__XPathContext.unregister_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_unregister_context;
  __pyx_vtable_4lxml_5etree__XPathContext.registerExsltFunctions = (void (*)(struct __pyx_obj_4lxml_5etree__XPathContext *))__pyx_f_4lxml_5etree_13_XPathContext_registerExsltFunctions;
  __pyx_vtable_4lxml_5etree__XPathContext.registerVariables = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext_registerVariables;
  __pyx_vtable_4lxml_5etree__XPathContext.registerVariable = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathContext *, PyObject *, PyObject *))__pyx_f_4lxml_5etree_13_XPathContext_registerVariable;
  __pyx_type_4lxml_5etree__XPathContext.tp_base = __pyx_ptype_4lxml_5etree__BaseContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XPathContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XPathContext.tp_dict, __pyx_vtabptr_4lxml_5etree__XPathContext) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XPathContext = &__pyx_type_4lxml_5etree__XPathContext;
  __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase = &__pyx_vtable_4lxml_5etree__XPathEvaluatorBase;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase.set_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathContext *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase_set_context;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._checkAbsolutePath = (int (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, char *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__checkAbsolutePath;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._lock = (int (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__lock;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._unlock = (void (*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__unlock;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._raise_parse_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_parse_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._raise_eval_error = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__raise_eval_error;
  __pyx_vtable_4lxml_5etree__XPathEvaluatorBase._handle_result = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XPathEvaluatorBase *, xmlXPathObject *, struct LxmlDocument *))__pyx_f_4lxml_5etree_19_XPathEvaluatorBase__handle_result;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XPathEvaluatorBase.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XPathEvaluatorBase.tp_dict, __pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XPathEvaluatorBase", (PyObject *)&__pyx_type_4lxml_5etree__XPathEvaluatorBase) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XPathEvaluatorBase = &__pyx_type_4lxml_5etree__XPathEvaluatorBase;
  __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator = &__pyx_vtable_4lxml_5etree_XPathElementEvaluator;
  __pyx_vtable_4lxml_5etree_XPathElementEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  __pyx_type_4lxml_5etree_XPathElementEvaluator.tp_base = __pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XPathElementEvaluator.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XPathElementEvaluator, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__.doc = __pyx_doc_4lxml_5etree_21XPathElementEvaluator_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_21XPathElementEvaluator_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPathElementEvaluator.tp_dict, __pyx_vtabptr_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XPathElementEvaluator", (PyObject *)&__pyx_type_4lxml_5etree_XPathElementEvaluator) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XPathElementEvaluator = &__pyx_type_4lxml_5etree_XPathElementEvaluator;
  __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator = &__pyx_vtable_4lxml_5etree_XPathDocumentEvaluator;
  __pyx_vtable_4lxml_5etree_XPathDocumentEvaluator.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPathElementEvaluator;
  __pyx_type_4lxml_5etree_XPathDocumentEvaluator.tp_base = __pyx_ptype_4lxml_5etree_XPathElementEvaluator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XPathDocumentEvaluator.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XPathDocumentEvaluator, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__.doc = __pyx_doc_4lxml_5etree_22XPathDocumentEvaluator_2__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_22XPathDocumentEvaluator_2__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPathDocumentEvaluator.tp_dict, __pyx_vtabptr_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XPathDocumentEvaluator", (PyObject *)&__pyx_type_4lxml_5etree_XPathDocumentEvaluator) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XPathDocumentEvaluator = &__pyx_type_4lxml_5etree_XPathDocumentEvaluator;
  __pyx_vtabptr_4lxml_5etree_XPath = &__pyx_vtable_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_XPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree__XPathEvaluatorBase;
  __pyx_type_4lxml_5etree_XPath.tp_base = __pyx_ptype_4lxml_5etree__XPathEvaluatorBase;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XPath.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XPath, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_5XPath_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_5XPath_4__call__.doc = __pyx_doc_4lxml_5etree_5XPath_4__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_5XPath_4__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XPath.tp_dict, __pyx_vtabptr_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XPath", (PyObject *)&__pyx_type_4lxml_5etree_XPath) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XPath = &__pyx_type_4lxml_5etree_XPath;
  __pyx_vtabptr_4lxml_5etree_ETXPath = &__pyx_vtable_4lxml_5etree_ETXPath;
  __pyx_vtable_4lxml_5etree_ETXPath.__pyx_base = *__pyx_vtabptr_4lxml_5etree_XPath;
  __pyx_vtable_4lxml_5etree_ETXPath._nsextract_path = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_ETXPath *, PyObject *))__pyx_f_4lxml_5etree_7ETXPath__nsextract_path;
  __pyx_type_4lxml_5etree_ETXPath.tp_base = __pyx_ptype_4lxml_5etree_XPath;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_ETXPath) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_ETXPath.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_ETXPath.tp_dict, __pyx_vtabptr_4lxml_5etree_ETXPath) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ETXPath", (PyObject *)&__pyx_type_4lxml_5etree_ETXPath) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_ETXPath = &__pyx_type_4lxml_5etree_ETXPath;
  __pyx_vtabptr_4lxml_5etree__XSLTResolverContext = &__pyx_vtable_4lxml_5etree__XSLTResolverContext;
  __pyx_vtable_4lxml_5etree__XSLTResolverContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ResolverContext;
  __pyx_vtable_4lxml_5etree__XSLTResolverContext._copy = (struct __pyx_obj_4lxml_5etree__XSLTResolverContext *(*)(struct __pyx_obj_4lxml_5etree__XSLTResolverContext *))__pyx_f_4lxml_5etree_20_XSLTResolverContext__copy;
  __pyx_type_4lxml_5etree__XSLTResolverContext.tp_base = __pyx_ptype_4lxml_5etree__ResolverContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTResolverContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XSLTResolverContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTResolverContext.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTResolverContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTResolverContext = &__pyx_type_4lxml_5etree__XSLTResolverContext;
  __pyx_vtabptr_4lxml_5etree_XSLTAccessControl = &__pyx_vtable_4lxml_5etree_XSLTAccessControl;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._setAccess = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption, int))__pyx_f_4lxml_5etree_17XSLTAccessControl__setAccess;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._register_in_context = (void (*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltTransformContext *))__pyx_f_4lxml_5etree_17XSLTAccessControl__register_in_context;
  __pyx_vtable_4lxml_5etree_XSLTAccessControl._optval = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTAccessControl *, xsltSecurityOption))__pyx_f_4lxml_5etree_17XSLTAccessControl__optval;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XSLTAccessControl.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLTAccessControl.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XSLTAccessControl", (PyObject *)&__pyx_type_4lxml_5etree_XSLTAccessControl) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XSLTAccessControl = &__pyx_type_4lxml_5etree_XSLTAccessControl;
  __pyx_vtabptr_4lxml_5etree__XSLTContext = &__pyx_vtable_4lxml_5etree__XSLTContext;
  __pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext;
  __pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base._copy = (struct __pyx_obj_4lxml_5etree__BaseContext *(*)(struct __pyx_obj_4lxml_5etree__BaseContext *))__pyx_f_4lxml_5etree_12_XSLTContext__copy;
  __pyx_vtable_4lxml_5etree__XSLTContext.register_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *, struct LxmlDocument *))__pyx_f_4lxml_5etree_12_XSLTContext_register_context;
  __pyx_vtable_4lxml_5etree__XSLTContext.free_context = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTContext *))__pyx_f_4lxml_5etree_12_XSLTContext_free_context;
  __pyx_type_4lxml_5etree__XSLTContext.tp_base = __pyx_ptype_4lxml_5etree__BaseContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XSLTContext.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTContext.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTContext) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTContext = &__pyx_type_4lxml_5etree__XSLTContext;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTQuotedStringParam) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XSLTQuotedStringParam.tp_print = 0;
  __pyx_ptype_4lxml_5etree__XSLTQuotedStringParam = &__pyx_type_4lxml_5etree__XSLTQuotedStringParam;
  __pyx_vtabptr_4lxml_5etree_XSLT = &__pyx_vtable_4lxml_5etree_XSLT;
  __pyx_vtable_4lxml_5etree_XSLT._run_transform = (xmlDoc *(*)(struct __pyx_obj_4lxml_5etree_XSLT *, xmlDoc *, const char **, struct __pyx_obj_4lxml_5etree__XSLTContext *, xsltTransformContext *))__pyx_f_4lxml_5etree_4XSLT__run_transform;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XSLT.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_XSLT, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_4XSLT_18__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_4XSLT_18__call__.doc = __pyx_doc_4lxml_5etree_4XSLT_18__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_4XSLT_18__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLT.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XSLT", (PyObject *)&__pyx_type_4lxml_5etree_XSLT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XSLT = &__pyx_type_4lxml_5etree_XSLT;
  __pyx_vtabptr_4lxml_5etree__XSLTResultTree = &__pyx_vtable_4lxml_5etree__XSLTResultTree;
  __pyx_vtable_4lxml_5etree__XSLTResultTree.__pyx_base = *__pyx_vtabptr_4lxml_5etree__ElementTree;
  __pyx_vtable_4lxml_5etree__XSLTResultTree._saveToStringAndSize = (PyObject *(*)(struct __pyx_obj_4lxml_5etree__XSLTResultTree *, xmlChar **, int *))__pyx_f_4lxml_5etree_15_XSLTResultTree__saveToStringAndSize;
  __pyx_type_4lxml_5etree__XSLTResultTree.tp_base = __pyx_ptype_4lxml_5etree__ElementTree;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTResultTree) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XSLTResultTree.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTResultTree.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTResultTree) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTResultTree", (PyObject *)&__pyx_type_4lxml_5etree__XSLTResultTree) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTResultTree = &__pyx_type_4lxml_5etree__XSLTResultTree;
  __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction = &__pyx_vtable_4lxml_5etree__XSLTProcessingInstruction;
  __pyx_vtable_4lxml_5etree__XSLTProcessingInstruction.__pyx_base = *__pyx_vtabptr_4lxml_5etree_PIBase;
  __pyx_type_4lxml_5etree__XSLTProcessingInstruction.tp_base = __pyx_ptype_4lxml_5etree_PIBase;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__XSLTProcessingInstruction) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__XSLTProcessingInstruction.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree__XSLTProcessingInstruction.tp_dict, __pyx_vtabptr_4lxml_5etree__XSLTProcessingInstruction) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_XSLTProcessingInstruction", (PyObject *)&__pyx_type_4lxml_5etree__XSLTProcessingInstruction) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree__XSLTProcessingInstruction = &__pyx_type_4lxml_5etree__XSLTProcessingInstruction;
  __pyx_vtabptr_4lxml_5etree_XSLTExtension = &__pyx_vtable_4lxml_5etree_XSLTExtension;
  __pyx_vtable_4lxml_5etree_XSLTExtension._collectXSLTResultContent = (PyObject *(*)(struct __pyx_obj_4lxml_5etree_XSLTExtension *, struct __pyx_obj_4lxml_5etree__XSLTContext *, xmlNode *, int, int))__pyx_f_4lxml_5etree_13XSLTExtension__collectXSLTResultContent;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_XSLTExtension) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_XSLTExtension.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_XSLTExtension.tp_dict, __pyx_vtabptr_4lxml_5etree_XSLTExtension) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "XSLTExtension", (PyObject *)&__pyx_type_4lxml_5etree_XSLTExtension) < 0) {__pyx_filename = __pyx_f[19]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_XSLTExtension = &__pyx_type_4lxml_5etree_XSLTExtension;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__DTDElementContentDecl) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__DTDElementContentDecl.tp_print = 0;
  __pyx_ptype_4lxml_5etree__DTDElementContentDecl = &__pyx_type_4lxml_5etree__DTDElementContentDecl;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__DTDAttributeDecl) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__DTDAttributeDecl.tp_print = 0;
  __pyx_ptype_4lxml_5etree__DTDAttributeDecl = &__pyx_type_4lxml_5etree__DTDAttributeDecl;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__DTDElementDecl) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__DTDElementDecl.tp_print = 0;
  __pyx_ptype_4lxml_5etree__DTDElementDecl = &__pyx_type_4lxml_5etree__DTDElementDecl;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__DTDEntityDecl) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__DTDEntityDecl.tp_print = 0;
  __pyx_ptype_4lxml_5etree__DTDEntityDecl = &__pyx_type_4lxml_5etree__DTDEntityDecl;
  __pyx_vtabptr_4lxml_5etree_DTD = &__pyx_vtable_4lxml_5etree_DTD;
  __pyx_vtable_4lxml_5etree_DTD.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_type_4lxml_5etree_DTD.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_DTD) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_DTD.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_DTD, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_3DTD_14__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_3DTD_14__call__.doc = __pyx_doc_4lxml_5etree_3DTD_14__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_3DTD_14__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_DTD.tp_dict, __pyx_vtabptr_4lxml_5etree_DTD) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "DTD", (PyObject *)&__pyx_type_4lxml_5etree_DTD) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_DTD = &__pyx_type_4lxml_5etree_DTD;
  __pyx_vtabptr_4lxml_5etree_RelaxNG = &__pyx_vtable_4lxml_5etree_RelaxNG;
  __pyx_vtable_4lxml_5etree_RelaxNG.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_type_4lxml_5etree_RelaxNG.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_RelaxNG) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_RelaxNG.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_RelaxNG, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__.doc = __pyx_doc_4lxml_5etree_7RelaxNG_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_7RelaxNG_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_RelaxNG.tp_dict, __pyx_vtabptr_4lxml_5etree_RelaxNG) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "RelaxNG", (PyObject *)&__pyx_type_4lxml_5etree_RelaxNG) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_RelaxNG = &__pyx_type_4lxml_5etree_RelaxNG;
  __pyx_vtabptr_4lxml_5etree_Schematron = &__pyx_vtable_4lxml_5etree_Schematron;
  __pyx_vtable_4lxml_5etree_Schematron.__pyx_base = *__pyx_vtabptr_4lxml_5etree__Validator;
  __pyx_type_4lxml_5etree_Schematron.tp_base = __pyx_ptype_4lxml_5etree__Validator;
  if (PyType_Ready(&__pyx_type_4lxml_5etree_Schematron) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree_Schematron.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4lxml_5etree_Schematron, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_4lxml_5etree_10Schematron_6__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4lxml_5etree_10Schematron_6__call__.doc = __pyx_doc_4lxml_5etree_10Schematron_6__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4lxml_5etree_10Schematron_6__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_4lxml_5etree_Schematron.tp_dict, __pyx_vtabptr_4lxml_5etree_Schematron) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Schematron", (PyObject *)&__pyx_type_4lxml_5etree_Schematron) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_4lxml_5etree_Schematron = &__pyx_type_4lxml_5etree_Schematron;
  if (PyType_Ready(&__pyx_type_4lxml_5etree__MemDebug) < 0) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree__MemDebug.tp_print = 0;
  __pyx_ptype_4lxml_5etree__MemDebug = &__pyx_type_4lxml_5etree__MemDebug;
  if (PyType_Ready(&__pyx_type_4lxml_5etree___pyx_scope_struct__itervalues) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree___pyx_scope_struct__itervalues.tp_print = 0;
  __pyx_ptype_4lxml_5etree___pyx_scope_struct__itervalues = &__pyx_type_4lxml_5etree___pyx_scope_struct__itervalues;
  if (PyType_Ready(&__pyx_type_4lxml_5etree___pyx_scope_struct_1_iterattributes) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree___pyx_scope_struct_1_iterattributes.tp_print = 0;
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_1_iterattributes = &__pyx_type_4lxml_5etree___pyx_scope_struct_1_iterattributes;
  if (PyType_Ready(&__pyx_type_4lxml_5etree___pyx_scope_struct_2_iterelements) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree___pyx_scope_struct_2_iterelements.tp_print = 0;
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_2_iterelements = &__pyx_type_4lxml_5etree___pyx_scope_struct_2_iterelements;
  if (PyType_Ready(&__pyx_type_4lxml_5etree___pyx_scope_struct_3_iterentities) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_4lxml_5etree___pyx_scope_struct_3_iterentities.tp_print = 0;
  __pyx_ptype_4lxml_5etree___pyx_scope_struct_3_iterentities = &__pyx_type_4lxml_5etree___pyx_scope_struct_3_iterentities;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":7
 * from __future__ import absolute_import
 * 
 * __docformat__ = u"restructuredtext en"             # <<<<<<<<<<<<<<
 * 
 * __all__ = [
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_docformat, __pyx_kp_u_restructuredtext_en) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":9
 * __docformat__ = u"restructuredtext en"
 * 
 * __all__ = [             # <<<<<<<<<<<<<<
 *     'AttributeBasedElementClassLookup', 'C14NError', 'CDATA',
 *     'Comment', 'CommentBase', 'CustomElementClassLookup', 'DEBUG',
 */
  __pyx_t_1 = PyList_New(111); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_AttributeBasedElementClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_AttributeBasedElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_AttributeBasedElementClassLookup);
  __Pyx_INCREF(__pyx_n_s_C14NError);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_C14NError);
  __Pyx_GIVEREF(__pyx_n_s_C14NError);
  __Pyx_INCREF(__pyx_n_s_CDATA);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_CDATA);
  __Pyx_GIVEREF(__pyx_n_s_CDATA);
  __Pyx_INCREF(__pyx_n_s_Comment);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_Comment);
  __Pyx_GIVEREF(__pyx_n_s_Comment);
  __Pyx_INCREF(__pyx_n_s_CommentBase);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_CommentBase);
  __Pyx_GIVEREF(__pyx_n_s_CommentBase);
  __Pyx_INCREF(__pyx_n_s_CustomElementClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_CustomElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_CustomElementClassLookup);
  __Pyx_INCREF(__pyx_n_s_DEBUG);
  PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_DEBUG);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG);
  __Pyx_INCREF(__pyx_n_s_DTD);
  PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_DTD);
  __Pyx_GIVEREF(__pyx_n_s_DTD);
  __Pyx_INCREF(__pyx_n_s_DTDError);
  PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_DTDError);
  __Pyx_GIVEREF(__pyx_n_s_DTDError);
  __Pyx_INCREF(__pyx_n_s_DTDParseError);
  PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_s_DTDParseError);
  __Pyx_GIVEREF(__pyx_n_s_DTDParseError);
  __Pyx_INCREF(__pyx_n_s_DTDValidateError);
  PyList_SET_ITEM(__pyx_t_1, 10, __pyx_n_s_DTDValidateError);
  __Pyx_GIVEREF(__pyx_n_s_DTDValidateError);
  __Pyx_INCREF(__pyx_n_s_DocumentInvalid);
  PyList_SET_ITEM(__pyx_t_1, 11, __pyx_n_s_DocumentInvalid);
  __Pyx_GIVEREF(__pyx_n_s_DocumentInvalid);
  __Pyx_INCREF(__pyx_n_s_ETCompatXMLParser);
  PyList_SET_ITEM(__pyx_t_1, 12, __pyx_n_s_ETCompatXMLParser);
  __Pyx_GIVEREF(__pyx_n_s_ETCompatXMLParser);
  __Pyx_INCREF(__pyx_n_s_ETXPath);
  PyList_SET_ITEM(__pyx_t_1, 13, __pyx_n_s_ETXPath);
  __Pyx_GIVEREF(__pyx_n_s_ETXPath);
  __Pyx_INCREF(__pyx_n_s_Element);
  PyList_SET_ITEM(__pyx_t_1, 14, __pyx_n_s_Element);
  __Pyx_GIVEREF(__pyx_n_s_Element);
  __Pyx_INCREF(__pyx_n_s_ElementBase);
  PyList_SET_ITEM(__pyx_t_1, 15, __pyx_n_s_ElementBase);
  __Pyx_GIVEREF(__pyx_n_s_ElementBase);
  __Pyx_INCREF(__pyx_n_s_ElementClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 16, __pyx_n_s_ElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_ElementClassLookup);
  __Pyx_INCREF(__pyx_n_s_ElementDefaultClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 17, __pyx_n_s_ElementDefaultClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_ElementDefaultClassLookup);
  __Pyx_INCREF(__pyx_n_s_ElementNamespaceClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 18, __pyx_n_s_ElementNamespaceClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_ElementNamespaceClassLookup);
  __Pyx_INCREF(__pyx_n_s_ElementTree);
  PyList_SET_ITEM(__pyx_t_1, 19, __pyx_n_s_ElementTree);
  __Pyx_GIVEREF(__pyx_n_s_ElementTree);
  __Pyx_INCREF(__pyx_n_s_Entity);
  PyList_SET_ITEM(__pyx_t_1, 20, __pyx_n_s_Entity);
  __Pyx_GIVEREF(__pyx_n_s_Entity);
  __Pyx_INCREF(__pyx_n_s_EntityBase);
  PyList_SET_ITEM(__pyx_t_1, 21, __pyx_n_s_EntityBase);
  __Pyx_GIVEREF(__pyx_n_s_EntityBase);
  __Pyx_INCREF(__pyx_n_s_Error);
  PyList_SET_ITEM(__pyx_t_1, 22, __pyx_n_s_Error);
  __Pyx_GIVEREF(__pyx_n_s_Error);
  __Pyx_INCREF(__pyx_n_s_ErrorDomains);
  PyList_SET_ITEM(__pyx_t_1, 23, __pyx_n_s_ErrorDomains);
  __Pyx_GIVEREF(__pyx_n_s_ErrorDomains);
  __Pyx_INCREF(__pyx_n_s_ErrorLevels);
  PyList_SET_ITEM(__pyx_t_1, 24, __pyx_n_s_ErrorLevels);
  __Pyx_GIVEREF(__pyx_n_s_ErrorLevels);
  __Pyx_INCREF(__pyx_n_s_ErrorTypes);
  PyList_SET_ITEM(__pyx_t_1, 25, __pyx_n_s_ErrorTypes);
  __Pyx_GIVEREF(__pyx_n_s_ErrorTypes);
  __Pyx_INCREF(__pyx_n_s_Extension);
  PyList_SET_ITEM(__pyx_t_1, 26, __pyx_n_s_Extension);
  __Pyx_GIVEREF(__pyx_n_s_Extension);
  __Pyx_INCREF(__pyx_n_s_FallbackElementClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 27, __pyx_n_s_FallbackElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_FallbackElementClassLookup);
  __Pyx_INCREF(__pyx_n_s_FunctionNamespace);
  PyList_SET_ITEM(__pyx_t_1, 28, __pyx_n_s_FunctionNamespace);
  __Pyx_GIVEREF(__pyx_n_s_FunctionNamespace);
  __Pyx_INCREF(__pyx_n_s_HTML);
  PyList_SET_ITEM(__pyx_t_1, 29, __pyx_n_s_HTML);
  __Pyx_GIVEREF(__pyx_n_s_HTML);
  __Pyx_INCREF(__pyx_n_s_HTMLParser);
  PyList_SET_ITEM(__pyx_t_1, 30, __pyx_n_s_HTMLParser);
  __Pyx_GIVEREF(__pyx_n_s_HTMLParser);
  __Pyx_INCREF(__pyx_n_s_LIBXML_COMPILED_VERSION);
  PyList_SET_ITEM(__pyx_t_1, 31, __pyx_n_s_LIBXML_COMPILED_VERSION);
  __Pyx_GIVEREF(__pyx_n_s_LIBXML_COMPILED_VERSION);
  __Pyx_INCREF(__pyx_n_s_LIBXML_VERSION);
  PyList_SET_ITEM(__pyx_t_1, 32, __pyx_n_s_LIBXML_VERSION);
  __Pyx_GIVEREF(__pyx_n_s_LIBXML_VERSION);
  __Pyx_INCREF(__pyx_n_s_LIBXSLT_COMPILED_VERSION);
  PyList_SET_ITEM(__pyx_t_1, 33, __pyx_n_s_LIBXSLT_COMPILED_VERSION);
  __Pyx_GIVEREF(__pyx_n_s_LIBXSLT_COMPILED_VERSION);
  __Pyx_INCREF(__pyx_n_s_LIBXSLT_VERSION);
  PyList_SET_ITEM(__pyx_t_1, 34, __pyx_n_s_LIBXSLT_VERSION);
  __Pyx_GIVEREF(__pyx_n_s_LIBXSLT_VERSION);
  __Pyx_INCREF(__pyx_n_s_LXML_VERSION);
  PyList_SET_ITEM(__pyx_t_1, 35, __pyx_n_s_LXML_VERSION);
  __Pyx_GIVEREF(__pyx_n_s_LXML_VERSION);
  __Pyx_INCREF(__pyx_n_s_LxmlError);
  PyList_SET_ITEM(__pyx_t_1, 36, __pyx_n_s_LxmlError);
  __Pyx_GIVEREF(__pyx_n_s_LxmlError);
  __Pyx_INCREF(__pyx_n_s_LxmlRegistryError);
  PyList_SET_ITEM(__pyx_t_1, 37, __pyx_n_s_LxmlRegistryError);
  __Pyx_GIVEREF(__pyx_n_s_LxmlRegistryError);
  __Pyx_INCREF(__pyx_n_s_LxmlSyntaxError);
  PyList_SET_ITEM(__pyx_t_1, 38, __pyx_n_s_LxmlSyntaxError);
  __Pyx_GIVEREF(__pyx_n_s_LxmlSyntaxError);
  __Pyx_INCREF(__pyx_n_s_NamespaceRegistryError);
  PyList_SET_ITEM(__pyx_t_1, 39, __pyx_n_s_NamespaceRegistryError);
  __Pyx_GIVEREF(__pyx_n_s_NamespaceRegistryError);
  __Pyx_INCREF(__pyx_n_s_PI);
  PyList_SET_ITEM(__pyx_t_1, 40, __pyx_n_s_PI);
  __Pyx_GIVEREF(__pyx_n_s_PI);
  __Pyx_INCREF(__pyx_n_s_PIBase);
  PyList_SET_ITEM(__pyx_t_1, 41, __pyx_n_s_PIBase);
  __Pyx_GIVEREF(__pyx_n_s_PIBase);
  __Pyx_INCREF(__pyx_n_s_ParseError);
  PyList_SET_ITEM(__pyx_t_1, 42, __pyx_n_s_ParseError);
  __Pyx_GIVEREF(__pyx_n_s_ParseError);
  __Pyx_INCREF(__pyx_n_s_ParserBasedElementClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 43, __pyx_n_s_ParserBasedElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_ParserBasedElementClassLookup);
  __Pyx_INCREF(__pyx_n_s_ParserError);
  PyList_SET_ITEM(__pyx_t_1, 44, __pyx_n_s_ParserError);
  __Pyx_GIVEREF(__pyx_n_s_ParserError);
  __Pyx_INCREF(__pyx_n_s_ProcessingInstruction);
  PyList_SET_ITEM(__pyx_t_1, 45, __pyx_n_s_ProcessingInstruction);
  __Pyx_GIVEREF(__pyx_n_s_ProcessingInstruction);
  __Pyx_INCREF(__pyx_n_s_PyErrorLog);
  PyList_SET_ITEM(__pyx_t_1, 46, __pyx_n_s_PyErrorLog);
  __Pyx_GIVEREF(__pyx_n_s_PyErrorLog);
  __Pyx_INCREF(__pyx_n_s_PythonElementClassLookup);
  PyList_SET_ITEM(__pyx_t_1, 47, __pyx_n_s_PythonElementClassLookup);
  __Pyx_GIVEREF(__pyx_n_s_PythonElementClassLookup);
  __Pyx_INCREF(__pyx_n_s_QName);
  PyList_SET_ITEM(__pyx_t_1, 48, __pyx_n_s_QName);
  __Pyx_GIVEREF(__pyx_n_s_QName);
  __Pyx_INCREF(__pyx_n_s_RelaxNG);
  PyList_SET_ITEM(__pyx_t_1, 49, __pyx_n_s_RelaxNG);
  __Pyx_GIVEREF(__pyx_n_s_RelaxNG);
  __Pyx_INCREF(__pyx_n_s_RelaxNGError);
  PyList_SET_ITEM(__pyx_t_1, 50, __pyx_n_s_RelaxNGError);
  __Pyx_GIVEREF(__pyx_n_s_RelaxNGError);
  __Pyx_INCREF(__pyx_n_s_RelaxNGErrorTypes);
  PyList_SET_ITEM(__pyx_t_1, 51, __pyx_n_s_RelaxNGErrorTypes);
  __Pyx_GIVEREF(__pyx_n_s_RelaxNGErrorTypes);
  __Pyx_INCREF(__pyx_n_s_RelaxNGParseError);
  PyList_SET_ITEM(__pyx_t_1, 52, __pyx_n_s_RelaxNGParseError);
  __Pyx_GIVEREF(__pyx_n_s_RelaxNGParseError);
  __Pyx_INCREF(__pyx_n_s_RelaxNGValidateError);
  PyList_SET_ITEM(__pyx_t_1, 53, __pyx_n_s_RelaxNGValidateError);
  __Pyx_GIVEREF(__pyx_n_s_RelaxNGValidateError);
  __Pyx_INCREF(__pyx_n_s_Resolver);
  PyList_SET_ITEM(__pyx_t_1, 54, __pyx_n_s_Resolver);
  __Pyx_GIVEREF(__pyx_n_s_Resolver);
  __Pyx_INCREF(__pyx_n_s_Schematron);
  PyList_SET_ITEM(__pyx_t_1, 55, __pyx_n_s_Schematron);
  __Pyx_GIVEREF(__pyx_n_s_Schematron);
  __Pyx_INCREF(__pyx_n_s_SchematronError);
  PyList_SET_ITEM(__pyx_t_1, 56, __pyx_n_s_SchematronError);
  __Pyx_GIVEREF(__pyx_n_s_SchematronError);
  __Pyx_INCREF(__pyx_n_s_SchematronParseError);
  PyList_SET_ITEM(__pyx_t_1, 57, __pyx_n_s_SchematronParseError);
  __Pyx_GIVEREF(__pyx_n_s_SchematronParseError);
  __Pyx_INCREF(__pyx_n_s_SchematronValidateError);
  PyList_SET_ITEM(__pyx_t_1, 58, __pyx_n_s_SchematronValidateError);
  __Pyx_GIVEREF(__pyx_n_s_SchematronValidateError);
  __Pyx_INCREF(__pyx_n_s_SerialisationError);
  PyList_SET_ITEM(__pyx_t_1, 59, __pyx_n_s_SerialisationError);
  __Pyx_GIVEREF(__pyx_n_s_SerialisationError);
  __Pyx_INCREF(__pyx_n_s_SubElement);
  PyList_SET_ITEM(__pyx_t_1, 60, __pyx_n_s_SubElement);
  __Pyx_GIVEREF(__pyx_n_s_SubElement);
  __Pyx_INCREF(__pyx_n_s_TreeBuilder);
  PyList_SET_ITEM(__pyx_t_1, 61, __pyx_n_s_TreeBuilder);
  __Pyx_GIVEREF(__pyx_n_s_TreeBuilder);
  __Pyx_INCREF(__pyx_n_s_XInclude);
  PyList_SET_ITEM(__pyx_t_1, 62, __pyx_n_s_XInclude);
  __Pyx_GIVEREF(__pyx_n_s_XInclude);
  __Pyx_INCREF(__pyx_n_s_XIncludeError);
  PyList_SET_ITEM(__pyx_t_1, 63, __pyx_n_s_XIncludeError);
  __Pyx_GIVEREF(__pyx_n_s_XIncludeError);
  __Pyx_INCREF(__pyx_n_s_XML);
  PyList_SET_ITEM(__pyx_t_1, 64, __pyx_n_s_XML);
  __Pyx_GIVEREF(__pyx_n_s_XML);
  __Pyx_INCREF(__pyx_n_s_XMLDTDID);
  PyList_SET_ITEM(__pyx_t_1, 65, __pyx_n_s_XMLDTDID);
  __Pyx_GIVEREF(__pyx_n_s_XMLDTDID);
  __Pyx_INCREF(__pyx_n_s_XMLID);
  PyList_SET_ITEM(__pyx_t_1, 66, __pyx_n_s_XMLID);
  __Pyx_GIVEREF(__pyx_n_s_XMLID);
  __Pyx_INCREF(__pyx_n_s_XMLParser);
  PyList_SET_ITEM(__pyx_t_1, 67, __pyx_n_s_XMLParser);
  __Pyx_GIVEREF(__pyx_n_s_XMLParser);
  __Pyx_INCREF(__pyx_n_s_XMLSchema);
  PyList_SET_ITEM(__pyx_t_1, 68, __pyx_n_s_XMLSchema);
  __Pyx_GIVEREF(__pyx_n_s_XMLSchema);
  __Pyx_INCREF(__pyx_n_s_XMLSchemaError);
  PyList_SET_ITEM(__pyx_t_1, 69, __pyx_n_s_XMLSchemaError);
  __Pyx_GIVEREF(__pyx_n_s_XMLSchemaError);
  __Pyx_INCREF(__pyx_n_s_XMLSchemaParseError);
  PyList_SET_ITEM(__pyx_t_1, 70, __pyx_n_s_XMLSchemaParseError);
  __Pyx_GIVEREF(__pyx_n_s_XMLSchemaParseError);
  __Pyx_INCREF(__pyx_n_s_XMLSchemaValidateError);
  PyList_SET_ITEM(__pyx_t_1, 71, __pyx_n_s_XMLSchemaValidateError);
  __Pyx_GIVEREF(__pyx_n_s_XMLSchemaValidateError);
  __Pyx_INCREF(__pyx_n_s_XMLSyntaxError);
  PyList_SET_ITEM(__pyx_t_1, 72, __pyx_n_s_XMLSyntaxError);
  __Pyx_GIVEREF(__pyx_n_s_XMLSyntaxError);
  __Pyx_INCREF(__pyx_n_s_XMLTreeBuilder);
  PyList_SET_ITEM(__pyx_t_1, 73, __pyx_n_s_XMLTreeBuilder);
  __Pyx_GIVEREF(__pyx_n_s_XMLTreeBuilder);
  __Pyx_INCREF(__pyx_n_s_XPath);
  PyList_SET_ITEM(__pyx_t_1, 74, __pyx_n_s_XPath);
  __Pyx_GIVEREF(__pyx_n_s_XPath);
  __Pyx_INCREF(__pyx_n_s_XPathDocumentEvaluator);
  PyList_SET_ITEM(__pyx_t_1, 75, __pyx_n_s_XPathDocumentEvaluator);
  __Pyx_GIVEREF(__pyx_n_s_XPathDocumentEvaluator);
  __Pyx_INCREF(__pyx_n_s_XPathError);
  PyList_SET_ITEM(__pyx_t_1, 76, __pyx_n_s_XPathError);
  __Pyx_GIVEREF(__pyx_n_s_XPathError);
  __Pyx_INCREF(__pyx_n_s_XPathEvalError);
  PyList_SET_ITEM(__pyx_t_1, 77, __pyx_n_s_XPathEvalError);
  __Pyx_GIVEREF(__pyx_n_s_XPathEvalError);
  __Pyx_INCREF(__pyx_n_s_XPathEvaluator);
  PyList_SET_ITEM(__pyx_t_1, 78, __pyx_n_s_XPathEvaluator);
  __Pyx_GIVEREF(__pyx_n_s_XPathEvaluator);
  __Pyx_INCREF(__pyx_n_s_XPathFunctionError);
  PyList_SET_ITEM(__pyx_t_1, 79, __pyx_n_s_XPathFunctionError);
  __Pyx_GIVEREF(__pyx_n_s_XPathFunctionError);
  __Pyx_INCREF(__pyx_n_s_XPathResultError);
  PyList_SET_ITEM(__pyx_t_1, 80, __pyx_n_s_XPathResultError);
  __Pyx_GIVEREF(__pyx_n_s_XPathResultError);
  __Pyx_INCREF(__pyx_n_s_XPathSyntaxError);
  PyList_SET_ITEM(__pyx_t_1, 81, __pyx_n_s_XPathSyntaxError);
  __Pyx_GIVEREF(__pyx_n_s_XPathSyntaxError);
  __Pyx_INCREF(__pyx_n_s_XSLT);
  PyList_SET_ITEM(__pyx_t_1, 82, __pyx_n_s_XSLT);
  __Pyx_GIVEREF(__pyx_n_s_XSLT);
  __Pyx_INCREF(__pyx_n_s_XSLTAccessControl);
  PyList_SET_ITEM(__pyx_t_1, 83, __pyx_n_s_XSLTAccessControl);
  __Pyx_GIVEREF(__pyx_n_s_XSLTAccessControl);
  __Pyx_INCREF(__pyx_n_s_XSLTApplyError);
  PyList_SET_ITEM(__pyx_t_1, 84, __pyx_n_s_XSLTApplyError);
  __Pyx_GIVEREF(__pyx_n_s_XSLTApplyError);
  __Pyx_INCREF(__pyx_n_s_XSLTError);
  PyList_SET_ITEM(__pyx_t_1, 85, __pyx_n_s_XSLTError);
  __Pyx_GIVEREF(__pyx_n_s_XSLTError);
  __Pyx_INCREF(__pyx_n_s_XSLTExtension);
  PyList_SET_ITEM(__pyx_t_1, 86, __pyx_n_s_XSLTExtension);
  __Pyx_GIVEREF(__pyx_n_s_XSLTExtension);
  __Pyx_INCREF(__pyx_n_s_XSLTExtensionError);
  PyList_SET_ITEM(__pyx_t_1, 87, __pyx_n_s_XSLTExtensionError);
  __Pyx_GIVEREF(__pyx_n_s_XSLTExtensionError);
  __Pyx_INCREF(__pyx_n_s_XSLTParseError);
  PyList_SET_ITEM(__pyx_t_1, 88, __pyx_n_s_XSLTParseError);
  __Pyx_GIVEREF(__pyx_n_s_XSLTParseError);
  __Pyx_INCREF(__pyx_n_s_XSLTSaveError);
  PyList_SET_ITEM(__pyx_t_1, 89, __pyx_n_s_XSLTSaveError);
  __Pyx_GIVEREF(__pyx_n_s_XSLTSaveError);
  __Pyx_INCREF(__pyx_n_s_cleanup_namespaces);
  PyList_SET_ITEM(__pyx_t_1, 90, __pyx_n_s_cleanup_namespaces);
  __Pyx_GIVEREF(__pyx_n_s_cleanup_namespaces);
  __Pyx_INCREF(__pyx_n_s_clear_error_log_2);
  PyList_SET_ITEM(__pyx_t_1, 91, __pyx_n_s_clear_error_log_2);
  __Pyx_GIVEREF(__pyx_n_s_clear_error_log_2);
  __Pyx_INCREF(__pyx_n_s_dump);
  PyList_SET_ITEM(__pyx_t_1, 92, __pyx_n_s_dump);
  __Pyx_GIVEREF(__pyx_n_s_dump);
  __Pyx_INCREF(__pyx_n_s_fromstring);
  PyList_SET_ITEM(__pyx_t_1, 93, __pyx_n_s_fromstring);
  __Pyx_GIVEREF(__pyx_n_s_fromstring);
  __Pyx_INCREF(__pyx_n_s_fromstringlist);
  PyList_SET_ITEM(__pyx_t_1, 94, __pyx_n_s_fromstringlist);
  __Pyx_GIVEREF(__pyx_n_s_fromstringlist);
  __Pyx_INCREF(__pyx_n_s_get_default_parser);
  PyList_SET_ITEM(__pyx_t_1, 95, __pyx_n_s_get_default_parser);
  __Pyx_GIVEREF(__pyx_n_s_get_default_parser);
  __Pyx_INCREF(__pyx_n_s_iselement);
  PyList_SET_ITEM(__pyx_t_1, 96, __pyx_n_s_iselement);
  __Pyx_GIVEREF(__pyx_n_s_iselement);
  __Pyx_INCREF(__pyx_n_s_iterparse);
  PyList_SET_ITEM(__pyx_t_1, 97, __pyx_n_s_iterparse);
  __Pyx_GIVEREF(__pyx_n_s_iterparse);
  __Pyx_INCREF(__pyx_n_s_iterwalk);
  PyList_SET_ITEM(__pyx_t_1, 98, __pyx_n_s_iterwalk);
  __Pyx_GIVEREF(__pyx_n_s_iterwalk);
  __Pyx_INCREF(__pyx_n_s_parse);
  PyList_SET_ITEM(__pyx_t_1, 99, __pyx_n_s_parse);
  __Pyx_GIVEREF(__pyx_n_s_parse);
  __Pyx_INCREF(__pyx_n_s_parseid);
  PyList_SET_ITEM(__pyx_t_1, 100, __pyx_n_s_parseid);
  __Pyx_GIVEREF(__pyx_n_s_parseid);
  __Pyx_INCREF(__pyx_n_s_register_namespace);
  PyList_SET_ITEM(__pyx_t_1, 101, __pyx_n_s_register_namespace);
  __Pyx_GIVEREF(__pyx_n_s_register_namespace);
  __Pyx_INCREF(__pyx_n_s_set_default_parser);
  PyList_SET_ITEM(__pyx_t_1, 102, __pyx_n_s_set_default_parser);
  __Pyx_GIVEREF(__pyx_n_s_set_default_parser);
  __Pyx_INCREF(__pyx_n_s_set_element_class_lookup);
  PyList_SET_ITEM(__pyx_t_1, 103, __pyx_n_s_set_element_class_lookup);
  __Pyx_GIVEREF(__pyx_n_s_set_element_class_lookup);
  __Pyx_INCREF(__pyx_n_s_strip_attributes);
  PyList_SET_ITEM(__pyx_t_1, 104, __pyx_n_s_strip_attributes);
  __Pyx_GIVEREF(__pyx_n_s_strip_attributes);
  __Pyx_INCREF(__pyx_n_s_strip_elements);
  PyList_SET_ITEM(__pyx_t_1, 105, __pyx_n_s_strip_elements);
  __Pyx_GIVEREF(__pyx_n_s_strip_elements);
  __Pyx_INCREF(__pyx_n_s_strip_tags);
  PyList_SET_ITEM(__pyx_t_1, 106, __pyx_n_s_strip_tags);
  __Pyx_GIVEREF(__pyx_n_s_strip_tags);
  __Pyx_INCREF(__pyx_n_s_tostring);
  PyList_SET_ITEM(__pyx_t_1, 107, __pyx_n_s_tostring);
  __Pyx_GIVEREF(__pyx_n_s_tostring);
  __Pyx_INCREF(__pyx_n_s_tostringlist);
  PyList_SET_ITEM(__pyx_t_1, 108, __pyx_n_s_tostringlist);
  __Pyx_GIVEREF(__pyx_n_s_tostringlist);
  __Pyx_INCREF(__pyx_n_s_tounicode);
  PyList_SET_ITEM(__pyx_t_1, 109, __pyx_n_s_tounicode);
  __Pyx_GIVEREF(__pyx_n_s_tounicode);
  __Pyx_INCREF(__pyx_n_s_use_global_python_log);
  PyList_SET_ITEM(__pyx_t_1, 110, __pyx_n_s_use_global_python_log);
  __Pyx_GIVEREF(__pyx_n_s_use_global_python_log);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":59
 * from libc.string cimport const_char
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import __builtin__
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":60
 * 
 * try:
 *     import __builtin__             # <<<<<<<<<<<<<<
 * except ImportError:
 *     # Python 3
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_builtin, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_builtin, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":61
 * try:
 *     import __builtin__
 * except ImportError:             # <<<<<<<<<<<<<<
 *     # Python 3
 *     import builtins as __builtin__
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":63
 * except ImportError:
 *     # Python 3
 *     import builtins as __builtin__             # <<<<<<<<<<<<<<
 * 
 * cdef object _unicode
 */
      __pyx_t_8 = __Pyx_Import(__pyx_n_s_builtins, 0, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_builtin, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L9_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":66
 * 
 * cdef object _unicode
 * try:             # <<<<<<<<<<<<<<
 *     _unicode = __builtin__.unicode
 * except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":67
 * cdef object _unicode
 * try:
 *     _unicode = __builtin__.unicode             # <<<<<<<<<<<<<<
 * except AttributeError:
 *     # Python 3
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_builtin); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_unicode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__unicode);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__unicode, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L19_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":68
 * try:
 *     _unicode = __builtin__.unicode
 * except AttributeError:             # <<<<<<<<<<<<<<
 *     # Python 3
 *     _unicode = __builtin__.str
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":70
 * except AttributeError:
 *     # Python 3
 *     _unicode = __builtin__.str             # <<<<<<<<<<<<<<
 * 
 * del __builtin__
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_builtin); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_str); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree__unicode);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__unicode, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L13_exception_handled;
    }
    goto __pyx_L14_except_error;
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    __pyx_L19_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":72
 *     _unicode = __builtin__.str
 * 
 * del __builtin__             # <<<<<<<<<<<<<<
 * 
 * cdef object os_path_abspath
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_builtin) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":75
 * 
 * cdef object os_path_abspath
 * from os.path import abspath as os_path_abspath             # <<<<<<<<<<<<<<
 * 
 * cdef object BytesIO, StringIO
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_abspath);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_abspath);
  __Pyx_GIVEREF(__pyx_n_s_abspath);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_os_path, __pyx_t_1, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_abspath); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_os_path_abspath);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_os_path_abspath, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":78
 * 
 * cdef object BytesIO, StringIO
 * try:             # <<<<<<<<<<<<<<
 *     from io import BytesIO, StringIO
 * except (ImportError, AttributeError):
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":79
 * cdef object BytesIO, StringIO
 * try:
 *     from io import BytesIO, StringIO             # <<<<<<<<<<<<<<
 * except (ImportError, AttributeError):
 *     from StringIO import StringIO, StringIO as BytesIO
 */
      __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_n_s_BytesIO);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_BytesIO);
      __Pyx_GIVEREF(__pyx_n_s_BytesIO);
      __Pyx_INCREF(__pyx_n_s_StringIO);
      PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_StringIO);
      __Pyx_GIVEREF(__pyx_n_s_StringIO);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, __pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_BytesIO);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_BytesIO, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_StringIO);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_StringIO, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L29_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":80
 * try:
 *     from io import BytesIO, StringIO
 * except (ImportError, AttributeError):             # <<<<<<<<<<<<<<
 *     from StringIO import StringIO, StringIO as BytesIO
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError) || PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":81
 *     from io import BytesIO, StringIO
 * except (ImportError, AttributeError):
 *     from StringIO import StringIO, StringIO as BytesIO             # <<<<<<<<<<<<<<
 * 
 * cdef object _elementpath
 */
      __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_n_s_StringIO);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_StringIO);
      __Pyx_GIVEREF(__pyx_n_s_StringIO);
      __Pyx_INCREF(__pyx_n_s_StringIO);
      PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_StringIO);
      __Pyx_GIVEREF(__pyx_n_s_StringIO);
      __pyx_t_8 = __Pyx_Import(__pyx_n_s_StringIO, __pyx_t_9, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_StringIO);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_StringIO, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_BytesIO);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_BytesIO, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L23_exception_handled;
    }
    goto __pyx_L24_except_error;
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L23_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L29_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":84
 * 
 * cdef object _elementpath
 * from lxml import _elementpath             # <<<<<<<<<<<<<<
 * 
 * cdef object sys
 */
  __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_n_s_elementpath);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_elementpath);
  __Pyx_GIVEREF(__pyx_n_s_elementpath);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_6, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_elementpath); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_t_6);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__elementpath);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__elementpath, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":87
 * 
 * cdef object sys
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cdef object re
 */
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_sys);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_sys, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":90
 * 
 * cdef object re
 * import re             # <<<<<<<<<<<<<<
 * 
 * cdef object islice
 */
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_re);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_re, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":93
 * 
 * cdef object islice
 * from itertools import islice             # <<<<<<<<<<<<<<
 * 
 * cdef object ITER_EMPTY = iter(())
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_islice);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_islice);
  __Pyx_GIVEREF(__pyx_n_s_islice);
  __pyx_t_6 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_7, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_islice); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_t_7);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_islice);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_islice, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":95
 * from itertools import islice
 * 
 * cdef object ITER_EMPTY = iter(())             # <<<<<<<<<<<<<<
 * 
 * try:
 */
  __pyx_t_6 = PyObject_GetIter(__pyx_empty_tuple); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_ITER_EMPTY);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_ITER_EMPTY, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":97
 * cdef object ITER_EMPTY = iter(())
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from collections.abc import MutableMapping  # Py3.3+
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":98
 * 
 * try:
 *     from collections.abc import MutableMapping  # Py3.3+             # <<<<<<<<<<<<<<
 * except ImportError:
 *     try:
 */
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_n_s_MutableMapping);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_MutableMapping);
      __Pyx_GIVEREF(__pyx_n_s_MutableMapping);
      __pyx_t_7 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_6, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_MutableMapping); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableMapping, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L39_try_end;
    __pyx_L32_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":99
 * try:
 *     from collections.abc import MutableMapping  # Py3.3+
 * except ImportError:             # <<<<<<<<<<<<<<
 *     try:
 *         from collections import MutableMapping  # Py2.6+
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_1);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":100
 *     from collections.abc import MutableMapping  # Py3.3+
 * except ImportError:
 *     try:             # <<<<<<<<<<<<<<
 *         from collections import MutableMapping  # Py2.6+
 *     except ImportError:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":101
 * except ImportError:
 *     try:
 *         from collections import MutableMapping  # Py2.6+             # <<<<<<<<<<<<<<
 *     except ImportError:
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 */
          __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_INCREF(__pyx_n_s_MutableMapping);
          PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_MutableMapping);
          __Pyx_GIVEREF(__pyx_n_s_MutableMapping);
          __pyx_t_9 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_8, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_MutableMapping); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
          __Pyx_GOTREF(__pyx_t_8);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableMapping, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L49_try_end;
        __pyx_L42_error:;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":102
 *     try:
 *         from collections import MutableMapping  # Py2.6+
 *     except ImportError:             # <<<<<<<<<<<<<<
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):
 */
        __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
        if (__pyx_t_5) {
          __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_t_13);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":103
 *         from collections import MutableMapping  # Py2.6+
 *     except ImportError:
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]             # <<<<<<<<<<<<<<
 *         class MutableMapping(MutableMapping):
 *             def keys(self):
 */
          __pyx_t_14 = PyList_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_INCREF(__pyx_n_s_UserDict);
          PyList_SET_ITEM(__pyx_t_14, 0, __pyx_n_s_UserDict);
          __Pyx_GIVEREF(__pyx_n_s_UserDict);
          __pyx_t_15 = __Pyx_Import(__pyx_n_s_UserDict, __pyx_t_14, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_ImportFrom(__pyx_t_15, __pyx_n_s_UserDict); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableMapping, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":104
 *     except ImportError:
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *             def keys(self):
 *                 return []
 */
          __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_MutableMapping); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_15);
          __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_16 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_14, __pyx_n_s_MutableMapping, __pyx_n_s_MutableMapping, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_16);

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":105
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):
 *             def keys(self):             # <<<<<<<<<<<<<<
 *                 return []
 * 
 */
          __pyx_t_17 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_14MutableMapping_1keys, 0, __pyx_n_s_MutableMapping_keys, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (PyObject_SetItem(__pyx_t_16, __pyx_n_s_keys, __pyx_t_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

          /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":104
 *     except ImportError:
 *         from UserDict import UserDict as MutableMapping  # Py2.[45]
 *         class MutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *             def keys(self):
 *                 return []
 */
          __pyx_t_17 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_MutableMapping, __pyx_t_14, __pyx_t_16, NULL, 0, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableMapping, __pyx_t_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L43_exception_handled;
        }
        goto __pyx_L44_except_error;
        __pyx_L44_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L34_except_error;
        __pyx_L43_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __pyx_L49_try_end:;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L33_exception_handled;
    }
    goto __pyx_L34_except_error;
    __pyx_L34_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L33_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    __pyx_L39_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":108
 *                 return []
 * 
 * class _ImmutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         raise KeyError, key
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_MutableMapping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_6, __pyx_n_s_ImmutableMapping, __pyx_n_s_ImmutableMapping, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":109
 * 
 * class _ImmutableMapping(MutableMapping):
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_1__getitem__, 0, __pyx_n_s_ImmutableMapping___getitem, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_getitem, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":112
 *         raise KeyError, key
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_3__setitem__, 0, __pyx_n_s_ImmutableMapping___setitem, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_setitem, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":115
 *         raise KeyError, key
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         raise KeyError, key
 * 
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_5__delitem__, 0, __pyx_n_s_ImmutableMapping___delitem, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_delitem, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":118
 *         raise KeyError, key
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_7__contains__, 0, __pyx_n_s_ImmutableMapping___contains, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_contains, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":121
 *         return False
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_9__len__, 0, __pyx_n_s_ImmutableMapping___len, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__117)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_len, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":124
 *         return 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_17_ImmutableMapping_11__iter__, 0, __pyx_n_s_ImmutableMapping___iter, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_iter_2, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":126
 *     def __iter__(self):
 *         return ITER_EMPTY
 *     iterkeys = itervalues = iteritems = __iter__             # <<<<<<<<<<<<<<
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()
 */
  __pyx_t_13 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_iter_2);
  if (unlikely(!__pyx_t_13)) {
    PyErr_Clear();
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_iter_2);
  }
  if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_iterkeys, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_itervalues, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_iteritems, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":108
 *                 return []
 * 
 * class _ImmutableMapping(MutableMapping):             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         raise KeyError, key
 */
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ImmutableMapping, __pyx_t_6, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ImmutableMapping, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":128
 *     iterkeys = itervalues = iteritems = __iter__
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()             # <<<<<<<<<<<<<<
 * del MutableMapping, _ImmutableMapping
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_ImmutableMapping); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":129
 * 
 * cdef object IMMUTABLE_EMPTY_MAPPING = _ImmutableMapping()
 * del MutableMapping, _ImmutableMapping             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_MutableMapping) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_ImmutableMapping) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":147
 * 
 * # make the compiled-in debug state publicly available
 * DEBUG = __DEBUG             # <<<<<<<<<<<<<<
 * 
 * # A struct to store a cached qualified tag name+href pair.
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":158
 * 
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)             # <<<<<<<<<<<<<<
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 */
  xmlThrDefIndentTreeOutput(1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":159
 * # global per-thread setup
 * tree.xmlThrDefIndentTreeOutput(1)
 * tree.xmlThrDefLineNumbersDefaultValue(1)             # <<<<<<<<<<<<<<
 * 
 * _initThreadLogging()
 */
  xmlThrDefLineNumbersDefaultValue(1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":161
 * tree.xmlThrDefLineNumbersDefaultValue(1)
 * 
 * _initThreadLogging()             # <<<<<<<<<<<<<<
 * 
 * # initialize parser (and threading)
 */
  __pyx_f_4lxml_5etree__initThreadLogging();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":164
 * 
 * # initialize parser (and threading)
 * xmlparser.xmlInitParser()             # <<<<<<<<<<<<<<
 * 
 * # filename encoding
 */
  xmlInitParser();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":167
 * 
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode(u"UTF-8")             # <<<<<<<<<<<<<<
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_18) {
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_sys, __pyx_n_s_getdefaultencoding); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_18) {
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_n_s_ascii);
      __pyx_t_1 = __pyx_n_s_ascii;
    } else {
      __pyx_t_1 = __pyx_t_7;
      __pyx_t_7 = 0;
    }
    __pyx_t_7 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_7 = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__120, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FILENAME_ENCODING, ((PyObject*)__pyx_t_7));
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":168
 * # filename encoding
 * cdef bytes _FILENAME_ENCODING = (sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii').encode(u"UTF-8")
 * cdef char* _C_FILENAME_ENCODING = _cstr(_FILENAME_ENCODING)             # <<<<<<<<<<<<<<
 * 
 * # set up some default namespace prefixes
 */
  __pyx_t_7 = __pyx_v_4lxml_5etree__FILENAME_ENCODING;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_v_4lxml_5etree__C_FILENAME_ENCODING = PyBytes_AS_STRING(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":171
 * 
 * # set up some default namespace prefixes
 * cdef dict _DEFAULT_NAMESPACE_PREFIXES = {             # <<<<<<<<<<<<<<
 *     b"http://www.w3.org/XML/1998/namespace": b'xml',
 *     b"http://www.w3.org/1999/xhtml": b"html",
 */
  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_www_w3_org_XML_1998_namespa, __pyx_n_b_xml) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_www_w3_org_1999_xhtml, __pyx_n_b_html) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_www_w3_org_1999_XSL_Transfo, __pyx_n_b_xsl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_www_w3_org_1999_02_22_rdf_s, __pyx_n_b_rdf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_schemas_xmlsoap_org_wsdl, __pyx_n_b_wsdl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_www_w3_org_2001_XMLSchema, __pyx_n_b_xs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_www_w3_org_2001_XMLSchema_i, __pyx_n_b_xsi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_purl_org_dc_elements_1_1, __pyx_n_b_dc) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, __pyx_kp_b_http_codespeak_net_lxml_objectif, __pyx_n_b_py) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES, ((PyObject*)__pyx_t_7));
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":186
 * }
 * 
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match             # <<<<<<<<<<<<<<
 * 
 * def register_namespace(prefix, uri):
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__121, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_match); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__check_internal_prefix);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__check_internal_prefix, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":188
 * cdef object _check_internal_prefix = re.compile(b"ns\d+$").match
 * 
 * def register_namespace(prefix, uri):             # <<<<<<<<<<<<<<
 *     u"""Registers a namespace prefix that newly created Elements in that
 *     namespace will use.  The registry is global, and any existing
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_1register_namespace, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_register_namespace, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":206
 * 
 * # Error superclass for ElementTree compatibility
 * class Error(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_7, __pyx_n_s_Error, __pyx_n_s_Error, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Error, __pyx_t_7, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":210
 * 
 * # module level superclass for all exceptions
 * class LxmlError(Error):             # <<<<<<<<<<<<<<
 *     u"""Main exception base class for lxml.  All other exceptions inherit from
 *     this one.
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_6, __pyx_n_s_LxmlError, __pyx_n_s_LxmlError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Main_exception_base_class_for_lx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":214
 *     this one.
 *     """
 *     def __init__(self, message, error_log=None):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_9LxmlError_1__init__, 0, __pyx_n_s_LxmlError___init, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_tuple__126);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_init, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":210
 * 
 * # module level superclass for all exceptions
 * class LxmlError(Error):             # <<<<<<<<<<<<<<
 *     u"""Main exception base class for lxml.  All other exceptions inherit from
 *     this one.
 */
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_LxmlError, __pyx_t_6, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LxmlError, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":225
 *             self.error_log = error_log.copy()
 * 
 * cdef object _Error = Error if python.PY_VERSION_HEX >= 0x02050000 else None             # <<<<<<<<<<<<<<
 * cdef object error_super_init = Error.__init__ if python.PY_VERSION_HEX < 0x02050000 else None
 * 
 */
  if (((PY_VERSION_HEX >= 0x02050000) != 0)) {
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_6 = Py_None;
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__Error);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__Error, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":226
 * 
 * cdef object _Error = Error if python.PY_VERSION_HEX >= 0x02050000 else None
 * cdef object error_super_init = Error.__init__ if python.PY_VERSION_HEX < 0x02050000 else None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (((PY_VERSION_HEX < 0x02050000) != 0)) {
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_6 = Py_None;
  }
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_error_super_init);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_error_super_init, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":230
 * 
 * # superclass for all syntax errors
 * class LxmlSyntaxError(LxmlError, SyntaxError):             # <<<<<<<<<<<<<<
 *     u"""Base class for all syntax errors.
 *     """
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_builtin_SyntaxError);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_SyntaxError);
  __Pyx_GIVEREF(__pyx_builtin_SyntaxError);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_1, __pyx_n_s_LxmlSyntaxError, __pyx_n_s_LxmlSyntaxError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_for_all_syntax_errors); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_LxmlSyntaxError, __pyx_t_1, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LxmlSyntaxError, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":235
 *     pass
 * 
 * class C14NError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Error during C14N serialisation.
 *     """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(1); 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);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_6, __pyx_n_s_C14NError, __pyx_n_s_C14NError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_during_C14N_serialisation); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_C14NError, __pyx_t_6, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C14NError, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":272
 * 
 * cdef int _LIBXML_VERSION_INT
 * try:             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":274
 * try:
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))             # <<<<<<<<<<<<<<
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (<unsigned char*>tree.xmlParserVersion).decode("ascii")
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_match); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_19 = ((unsigned char *)xmlParserVersion);
      __pyx_t_1 = __Pyx_decode_c_string(((char *)__pyx_t_19), 0, strlen(((char *)__pyx_t_19)), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_kp_u_0_9);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_0_9);
      __Pyx_GIVEREF(__pyx_kp_u_0_9);
      __Pyx_INCREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_group); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__127, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":273
 * cdef int _LIBXML_VERSION_INT
 * try:
 *     _LIBXML_VERSION_INT = int(             # <<<<<<<<<<<<<<
 *         re.match(u'[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:
 */
      __pyx_t_7 = PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L52_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = __pyx_t_5;
    }
    __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;
    goto __pyx_L59_try_end;
    __pyx_L52_error:;
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":275
 *     _LIBXML_VERSION_INT = int(
 *         re.match(u'[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:             # <<<<<<<<<<<<<<
 *     print u"Unknown libxml2 version: %s" % (<unsigned char*>tree.xmlParserVersion).decode("ascii")
 *     _LIBXML_VERSION_INT = 0
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L54_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":276
 *         re.match(u'[0-9]+', (<unsigned char*>tree.xmlParserVersion).decode("ascii")).group(0))
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (<unsigned char*>tree.xmlParserVersion).decode("ascii")             # <<<<<<<<<<<<<<
 *     _LIBXML_VERSION_INT = 0
 * 
 */
      __pyx_t_19 = ((unsigned char *)xmlParserVersion);
      __pyx_t_13 = __Pyx_decode_c_string(((char *)__pyx_t_19), 0, strlen(((char *)__pyx_t_19)), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L54_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_Unknown_libxml2_version_s, __pyx_t_13); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L54_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (__Pyx_PrintOne(0, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L54_except_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":277
 * except Exception:
 *     print u"Unknown libxml2 version: %s" % (<unsigned char*>tree.xmlParserVersion).decode("ascii")
 *     _LIBXML_VERSION_INT = 0             # <<<<<<<<<<<<<<
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 */
      __pyx_v_4lxml_5etree__LIBXML_VERSION_INT = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L53_exception_handled;
    }
    goto __pyx_L54_except_error;
    __pyx_L54_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L53_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L59_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":279
 *     _LIBXML_VERSION_INT = 0
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)             # <<<<<<<<<<<<<<
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree___unpackIntVersion(__pyx_v_4lxml_5etree__LIBXML_VERSION_INT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXML_VERSION, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":280
 * 
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)             # <<<<<<<<<<<<<<
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 */
  __pyx_t_6 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXML_VERSION); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXML_COMPILED_VERSION, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":281
 * LIBXML_VERSION = __unpackIntVersion(_LIBXML_VERSION_INT)
 * LIBXML_COMPILED_VERSION = __unpackIntVersion(tree.LIBXML_VERSION)
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)             # <<<<<<<<<<<<<<
 * 
 * __version__ = tree.LXML_VERSION_STRING.decode("ascii")
 */
  __pyx_t_6 = __Pyx_PyBytes_FromString(LXML_VERSION_STRING); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __pyx_f_4lxml_5etree___unpackDottedVersion(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LXML_VERSION, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":283
 * LXML_VERSION = __unpackDottedVersion(tree.LXML_VERSION_STRING)
 * 
 * __version__ = tree.LXML_VERSION_STRING.decode("ascii")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_decode_c_string(LXML_VERSION_STRING, 0, strlen(LXML_VERSION_STRING), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":5
 * from lxml.includes cimport uri
 * 
 * cdef object OrderedDict = None             # <<<<<<<<<<<<<<
 * try:
 *     from collections import OrderedDict
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_OrderedDict);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_OrderedDict, Py_None);
  __Pyx_GIVEREF(Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":6
 * 
 * cdef object OrderedDict = None
 * try:             # <<<<<<<<<<<<<<
 *     from collections import OrderedDict
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    /*try:*/ {

      /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":7
 * cdef object OrderedDict = None
 * try:
 *     from collections import OrderedDict             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pass
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_OrderedDict);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_OrderedDict);
      __Pyx_GIVEREF(__pyx_n_s_OrderedDict);
      __pyx_t_6 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_v_4lxml_5etree_OrderedDict);
      __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_OrderedDict, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L69_try_end;
    __pyx_L62_error:;
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":8
 * try:
 *     from collections import OrderedDict
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      PyErr_Restore(0,0,0);
      goto __pyx_L63_exception_handled;
    }
    goto __pyx_L64_except_error;
    __pyx_L64_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    goto __pyx_L1_error;
    __pyx_L63_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
    __pyx_L69_try_end:;
  }

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":603
 *     return attributes
 * 
 * cdef object __RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     ur'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":604
 * 
 * cdef object __RE_XML_ENCODING = re.compile(
 *     ur'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)             # <<<<<<<<<<<<<<
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_U); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":603
 *     return attributes
 * 
 * cdef object __RE_XML_ENCODING = re.compile(             # <<<<<<<<<<<<<<
 *     ur'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
 */
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_kp_u_xml_s_encoding_s_s_s);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_xml_s_encoding_s_s_s);
  __Pyx_GIVEREF(__pyx_kp_u_xml_s_encoding_s_s_s);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":606
 *     ur'^(<\?xml[^>]+)\s+encoding\s*=\s*["\'][^"\']*["\'](\s*\?>|)', re.U)
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub             # <<<<<<<<<<<<<<
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_n_s_sub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/apihelpers.pxi":607
 * 
 * cdef object __REPLACE_XML_ENCODING = __RE_XML_ENCODING.sub
 * cdef object __HAS_XML_ENCODING = __RE_XML_ENCODING.match             # <<<<<<<<<<<<<<
 * 
 * cdef object _stripEncodingDeclaration(object xml_string):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree___RE_XML_ENCODING, __pyx_n_s_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___HAS_XML_ENCODING, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":8
 * # module level API functions
 * 
 * def clear_error_log():             # <<<<<<<<<<<<<<
 *     u"""clear_error_log()
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_3clear_error_log, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_clear_error_log_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":545
 * 
 * cdef _BaseErrorLog __GLOBAL_ERROR_LOG
 * __GLOBAL_ERROR_LOG = _RotatingErrorLog(__MAX_LOG_SIZE)             # <<<<<<<<<<<<<<
 * 
 * cdef _BaseErrorLog _getGlobalErrorLog():
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__RotatingErrorLog)), __pyx_tuple__129, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG, ((struct __pyx_obj_4lxml_5etree__BaseErrorLog *)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":574
 *     return _getGlobalErrorLog().copy()
 * 
 * def use_global_python_log(PyErrorLog log not None):             # <<<<<<<<<<<<<<
 *     u"""use_global_python_log(log)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_5use_global_python_log, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_global_python_log, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":717
 * 
 * 
 * class ErrorLevels(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 error levels"
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_ErrorLevels, __pyx_n_s_ErrorLevels, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Libxml2_error_levels); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_ErrorLevels, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorLevels, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":720
 *     u"Libxml2 error levels"
 * 
 * class ErrorDomains(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 error domains"
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_ErrorDomains, __pyx_n_s_ErrorDomains, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Libxml2_error_domains); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_ErrorDomains, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorDomains, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":723
 *     u"Libxml2 error domains"
 * 
 * class ErrorTypes(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 error types"
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_ErrorTypes, __pyx_n_s_ErrorTypes, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Libxml2_error_types); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_ErrorTypes, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorTypes, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 723; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":726
 *     u"Libxml2 error types"
 * 
 * class RelaxNGErrorTypes(object):             # <<<<<<<<<<<<<<
 *     u"Libxml2 RelaxNG error types"
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_RelaxNGErrorTypes, __pyx_n_s_RelaxNGErrorTypes, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Libxml2_RelaxNG_error_types); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_RelaxNGErrorTypes, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RelaxNGErrorTypes, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 726; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":739
 * # cannot handle strings that are a few thousand bytes in length.
 * 
 * cdef object __ERROR_LEVELS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * WARNING=1
 */
  __Pyx_INCREF(__pyx_tuple__132);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_LEVELS, __pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":746
 * """,)
 * 
 * cdef object __ERROR_DOMAINS = (u"""\             # <<<<<<<<<<<<<<
 * NONE=0
 * PARSER=1
 */
  __Pyx_INCREF(__pyx_tuple__133);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___ERROR_DOMAINS, __pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":780
 * """,)
 * 
 * cdef object __PARSER_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * ERR_OK=0
 * ERR_INTERNAL_ERROR=1
 */
  __Pyx_INCREF(__pyx_tuple__134);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES, __pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":1537
 * """,)
 * 
 * cdef object __RELAXNG_ERROR_TYPES = (u"""\             # <<<<<<<<<<<<<<
 * RELAXNG_OK=0
 * RELAXNG_ERR_MEMORY=1
 */
  __Pyx_INCREF(__pyx_tuple__135);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES, __pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlerror.pxi":1581
 * # --- END: GENERATED CONSTANTS ---
 * 
 * __initErrorConstants()             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree___initErrorConstants(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":506
 *                    for i in range(30) ])
 * 
 * cdef tuple _PREFIX_CACHE = __initPrefixCache()             # <<<<<<<<<<<<<<
 * 
 * cdef _Document _documentFactory(xmlDoc* c_doc, _BaseParser parser):
 */
  __pyx_t_1 = __pyx_f_4lxml_5etree___initPrefixCache(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__PREFIX_CACHE);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__PREFIX_CACHE, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1665
 *                      for attr, value1, value2 in _FIND_PI_ATTRIBUTES(u' ' + self.text) }
 * 
 * cdef object _FIND_PI_ATTRIBUTES = re.compile(ur'\s+(\w+)\s*=\s*(?:\'([^\']*)\'|"([^"]*)")', re.U).findall             # <<<<<<<<<<<<<<
 * 
 * cdef class _Entity(__ContentOnlyElement):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_U); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_kp_u_s_w_s_s);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_s_w_s_s);
  __Pyx_GIVEREF(__pyx_kp_u_s_w_s_s);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_findall); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2831
 * # module-level API for ElementTree
 * 
 * def Element(_tag, attrib=None, nsmap=None, **_extra):             # <<<<<<<<<<<<<<
 *     u"""Element(_tag, attrib=None, nsmap=None, **_extra)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_7Element, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Element, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2844
 *                         attrib, nsmap, _extra)
 * 
 * def Comment(text=None):             # <<<<<<<<<<<<<<
 *     u"""Comment(text=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_9Comment, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Comment, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2863
 *     return _elementFactory(doc, c_node)
 * 
 * def ProcessingInstruction(target, text=None):             # <<<<<<<<<<<<<<
 *     u"""ProcessingInstruction(target, text=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_11ProcessingInstruction, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProcessingInstruction, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2883
 *     return _elementFactory(doc, c_node)
 * 
 * PI = ProcessingInstruction             # <<<<<<<<<<<<<<
 * 
 * cdef class CDATA:
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PI, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2903
 *         self._utf8_data = _utf8(data)
 * 
 * def Entity(name):             # <<<<<<<<<<<<<<
 *     u"""Entity(name)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_13Entity, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Entity, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2928
 *     return _elementFactory(doc, c_node)
 * 
 * def SubElement(_Element _parent not None, _tag,             # <<<<<<<<<<<<<<
 *                attrib=None, nsmap=None, **_extra):
 *     u"""SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_15SubElement, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SubElement, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2937
 *     return _makeSubElement(_parent, _tag, None, None, attrib, nsmap, _extra)
 * 
 * def ElementTree(_Element element=None, *, file=None, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""ElementTree(element=None, file=None, parser=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_17ElementTree, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTree, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2962
 *     return _elementTreeFactory(doc, element)
 * 
 * def HTML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""HTML(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_19HTML, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTML, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":2987
 *         return result_container.result
 * 
 * def XML(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XML(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_21XML, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XML, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3017
 *         return result_container.result
 * 
 * def fromstring(text, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""fromstring(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_23fromstring, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstring, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3037
 *         return result_container.result
 * 
 * def fromstringlist(strings, _BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""fromstringlist(strings, parser=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_25fromstringlist, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstringlist, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3057
 *     return parser.close()
 * 
 * def iselement(element):             # <<<<<<<<<<<<<<
 *     u"""iselement(element)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_27iselement, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_iselement, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3064
 *     return isinstance(element, _Element) and (<_Element>element)._c_node is not NULL
 * 
 * def dump(_Element elem not None, *, bint pretty_print=True, with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""dump(elem, pretty_print=True, with_tail=True)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_29dump, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dump, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3076
 *     sys.stdout.write(xml)
 * 
 * def tostring(element_or_tree, *, encoding=None, method=u"xml",             # <<<<<<<<<<<<<<
 *              xml_declaration=None, bint pretty_print=False, bint with_tail=True,
 *              standalone=None, doctype=None,
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_31tostring, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tostring, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3168
 *             python._fqtypename(element_or_tree).decode('utf8')
 * 
 * def tostringlist(element_or_tree, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     u"""tostringlist(element_or_tree, *args, **kwargs)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_33tostringlist, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tostringlist, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3179
 *     return [tostring(element_or_tree, *args, **kwargs)]
 * 
 * def tounicode(element_or_tree, *, method=u"xml", bint pretty_print=False,             # <<<<<<<<<<<<<<
 *               bint with_tail=True, doctype=None):
 *     u"""tounicode(element_or_tree, method="xml", pretty_print=False,
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_35tounicode, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tounicode, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3213
 *             type(element_or_tree)
 * 
 * def parse(source, _BaseParser parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parse(source, parser=None, base_url=None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_37parse, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":551
 *     LOOKUP_ELEMENT_CLASS = function
 * 
 * def set_element_class_lookup(ElementClassLookup lookup = None):             # <<<<<<<<<<<<<<
 *     u"""set_element_class_lookup(lookup = None)
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_39set_element_class_lookup, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_element_class_lookup, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":563
 * # default setup: parser delegation
 * cdef ParserBasedElementClassLookup DEFAULT_ELEMENT_CLASS_LOOKUP
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()             # <<<<<<<<<<<<<<
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)
 */
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ParserBasedElementClassLookup)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP, ((struct __pyx_obj_4lxml_5etree_ParserBasedElementClassLookup *)__pyx_t_6));
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/classlookup.pxi":565
 * DEFAULT_ELEMENT_CLASS_LOOKUP = ParserBasedElementClassLookup()
 * 
 * set_element_class_lookup(DEFAULT_ELEMENT_CLASS_LOOKUP)             # <<<<<<<<<<<<<<
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_set_element_class_lookup); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP));
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":3
 * # module-level API for namespace implementations
 * 
 * class LxmlRegistryError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of lxml registry errors.
 *     """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_LxmlRegistryError, __pyx_n_s_LxmlRegistryError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_of_lxml_registry_erro); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_LxmlRegistryError, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LxmlRegistryError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 3; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":8
 *     pass
 * 
 * class NamespaceRegistryError(LxmlRegistryError):             # <<<<<<<<<<<<<<
 *     u"""Error registering a namespace extension.
 *     """
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlRegistryError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_NamespaceRegistryError, __pyx_n_s_NamespaceRegistryError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_registering_a_namespace_ex); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_NamespaceRegistryError, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NamespaceRegistryError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":173
 * 
 * cdef dict __FUNCTION_NAMESPACE_REGISTRIES
 * __FUNCTION_NAMESPACE_REGISTRIES = {}             # <<<<<<<<<<<<<<
 * 
 * def FunctionNamespace(ns_uri):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/nsclasses.pxi":175
 * __FUNCTION_NAMESPACE_REGISTRIES = {}
 * 
 * def FunctionNamespace(ns_uri):             # <<<<<<<<<<<<<<
 *     u"""FunctionNamespace(ns_uri)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_41FunctionNamespace, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FunctionNamespace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":13
 * cdef class XMLSchema(_Validator)
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     u"""Syntax error while parsing an XML document.
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_ParseError, __pyx_n_s_ParseError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Syntax_error_while_parsing_an_XM); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":18
 *     For compatibility with ElementTree 1.3 and later.
 *     """
 *     def __init__(self, message, code, line, column):             # <<<<<<<<<<<<<<
 *         if python.PY_VERSION_HEX >= 0x02050000:
 *             # Python >= 2.5 uses new style class exceptions
 */
  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_10ParseError_1__init__, 0, __pyx_n_s_ParseError___init, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__173)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_init, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":13
 * cdef class XMLSchema(_Validator)
 * 
 * class ParseError(LxmlSyntaxError):             # <<<<<<<<<<<<<<
 *     u"""Syntax error while parsing an XML document.
 * 
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ParseError, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParseError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":27
 *         self.code = code
 * 
 * cdef object _LxmlSyntaxError = LxmlSyntaxError             # <<<<<<<<<<<<<<
 * cdef object _ParseError = ParseError
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__LxmlSyntaxError);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__LxmlSyntaxError, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":28
 * 
 * cdef object _LxmlSyntaxError = LxmlSyntaxError
 * cdef object _ParseError = ParseError             # <<<<<<<<<<<<<<
 * 
 * class XMLSyntaxError(ParseError):
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ParseError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__ParseError);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__ParseError, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":30
 * cdef object _ParseError = ParseError
 * 
 * class XMLSyntaxError(ParseError):             # <<<<<<<<<<<<<<
 *     u"""Syntax error while parsing an XML document.
 *     """
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ParseError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_XMLSyntaxError, __pyx_n_s_XMLSyntaxError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Syntax_error_while_parsing_an_XM_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_XMLSyntaxError, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLSyntaxError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":35
 *     pass
 * 
 * class ParserError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Internal lxml parser error.
 *     """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_ParserError, __pyx_n_s_ParserError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Internal_lxml_parser_error); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ParserError, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParserError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":186
 * 
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
 * __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()             # <<<<<<<<<<<<<<
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__ParserDictionaryContext)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__ParserDictionaryContext *)__pyx_t_7));
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":187
 * cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
 * __GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
 * __GLOBAL_PARSER_CONTEXT.initMainParserContext()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initMainParserContext(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":194
 * 
 * # name of Python unicode encoding as known to libxml2
 * cdef const_char* _UNICODE_ENCODING = NULL             # <<<<<<<<<<<<<<
 * 
 * cdef int _setupPythonUnicode() except -1:
 */
  __pyx_v_4lxml_5etree__UNICODE_ENCODING = NULL;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":245
 *         return tree.xmlGetCharEncodingName(enc)
 * 
 * _setupPythonUnicode()             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  __pyx_t_5 = __pyx_f_4lxml_5etree__setupPythonUnicode(); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":495
 * 
 * cdef xmlparser.xmlExternalEntityLoader __DEFAULT_ENTITY_LOADER
 * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader()             # <<<<<<<<<<<<<<
 * 
 * xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)
 */
  __pyx_v_4lxml_5etree___DEFAULT_ENTITY_LOADER = xmlGetExternalEntityLoader();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":497
 * __DEFAULT_ENTITY_LOADER = xmlparser.xmlGetExternalEntityLoader()
 * 
 * xmlparser.xmlSetExternalEntityLoader(<xmlparser.xmlExternalEntityLoader>_local_resolver)             # <<<<<<<<<<<<<<
 * 
 * ############################################################
 */
  xmlSetExternalEntityLoader(((xmlExternalEntityLoader)__pyx_f_4lxml_5etree__local_resolver));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1355
 *     xmlparser.XML_PARSE_NOENT   |
 *     xmlparser.XML_PARSE_NOCDATA |
 *     xmlparser.XML_PARSE_NONET   |             # <<<<<<<<<<<<<<
 *     xmlparser.XML_PARSE_COMPACT
 *     )
 */
  __pyx_v_4lxml_5etree__XML_DEFAULT_PARSE_OPTIONS = (((XML_PARSE_NOENT | XML_PARSE_NOCDATA) | XML_PARSE_NONET) | XML_PARSE_COMPACT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1511
 * 
 * # ET 1.2 compatible name
 * XMLTreeBuilder = ETCompatXMLParser             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLTreeBuilder, ((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_ETCompatXMLParser))) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1515
 * 
 * cdef XMLParser __DEFAULT_XML_PARSER
 * __DEFAULT_XML_PARSER = XMLParser()             # <<<<<<<<<<<<<<
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XMLParser)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER, ((struct __pyx_obj_4lxml_5etree_XMLParser *)__pyx_t_7));
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1517
 * __DEFAULT_XML_PARSER = XMLParser()
 * 
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)             # <<<<<<<<<<<<<<
 * 
 * def set_default_parser(_BaseParser parser=None):
 */
  __pyx_t_7 = ((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_f_4lxml_5etree_24_ParserDictionaryContext_setDefaultParser(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT, ((struct __pyx_obj_4lxml_5etree__BaseParser *)__pyx_t_7));
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1519
 * __GLOBAL_PARSER_CONTEXT.setDefaultParser(__DEFAULT_XML_PARSER)
 * 
 * def set_default_parser(_BaseParser parser=None):             # <<<<<<<<<<<<<<
 *     u"""set_default_parser(parser=None)
 * 
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_43set_default_parser, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_default_parser, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1535
 *     __GLOBAL_PARSER_CONTEXT.setDefaultParser(parser)
 * 
 * def get_default_parser():             # <<<<<<<<<<<<<<
 *     u"get_default_parser()"
 *     return __GLOBAL_PARSER_CONTEXT.getDefaultParser()
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_45get_default_parser, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_default_parser, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1546
 * _HTML_DEFAULT_PARSE_OPTIONS = (
 *     htmlparser.HTML_PARSE_RECOVER |
 *     htmlparser.HTML_PARSE_NONET   |             # <<<<<<<<<<<<<<
 *     htmlparser.HTML_PARSE_COMPACT
 *     )
 */
  __pyx_v_4lxml_5etree__HTML_DEFAULT_PARSE_OPTIONS = ((HTML_PARSE_RECOVER | HTML_PARSE_NONET) | HTML_PARSE_COMPACT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parser.pxi":1603
 * 
 * cdef HTMLParser __DEFAULT_HTML_PARSER
 * __DEFAULT_HTML_PARSER = HTMLParser()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_HTMLParser)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER, ((struct __pyx_obj_4lxml_5etree_HTMLParser *)__pyx_t_7));
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/saxparser.pxi":468
 * 
 * 
 * cdef tuple NS_END_EVENT = ('end-ns', None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(__pyx_tuple__177);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_NS_END_EVENT);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_NS_END_EVENT, __pyx_tuple__177);
  __Pyx_GIVEREF(__pyx_tuple__177);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":4
 * 
 * cdef object inspect_getargspec
 * from inspect import getargspec as inspect_getargspec             # <<<<<<<<<<<<<<
 * 
 * class _TargetParserResult(Exception):
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_getargspec);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_getargspec);
  __Pyx_GIVEREF(__pyx_n_s_getargspec);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_inspect, __pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_getargspec); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_t_7);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_inspect_getargspec);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_inspect_getargspec, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":6
 * from inspect import getargspec as inspect_getargspec
 * 
 * class _TargetParserResult(Exception):             # <<<<<<<<<<<<<<
 *     # Admittedly, this is somewhat ugly, but it's the easiest way
 *     # to push the Python level parser result through the parser
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_TargetParserResult, __pyx_n_s_TargetParserResult, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":10
 *     # to push the Python level parser result through the parser
 *     # machinery towards the API level functions
 *     def __init__(self, result):             # <<<<<<<<<<<<<<
 *         self.result = result
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_19_TargetParserResult_1__init__, 0, __pyx_n_s_TargetParserResult___init, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__179)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_init, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/parsertarget.pxi":6
 * from inspect import getargspec as inspect_getargspec
 * 
 * class _TargetParserResult(Exception):             # <<<<<<<<<<<<<<
 *     # Admittedly, this is somewhat ugly, but it's the easiest way
 *     # to push the Python level parser result through the parser
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_TargetParserResult, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TargetParserResult, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":4
 * 
 * cdef object GzipFile
 * from gzip import GzipFile             # <<<<<<<<<<<<<<
 * 
 * class SerialisationError(LxmlError):
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_GzipFile);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_GzipFile);
  __Pyx_GIVEREF(__pyx_n_s_GzipFile);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_gzip, __pyx_t_1, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_GzipFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_GzipFile);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_GzipFile, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/serializer.pxi":6
 * from gzip import GzipFile
 * 
 * class SerialisationError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""A libxml2 error that occurred during serialisation.
 *     """
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_SerialisationError, __pyx_n_s_SerialisationError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_A_libxml2_error_that_occurred_du); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_SerialisationError, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SerialisationError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":3
 * cdef object _find_id_attributes
 * 
 * def XMLID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLID(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_47XMLID, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLID, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":24
 *     return (root, dic)
 * 
 * def XMLDTDID(text, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""XMLDTDID(text, parser=None, base_url=None)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_49XMLDTDID, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLDTDID, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlid.pxi":44
 *         return (root, _IDDict(root))
 * 
 * def parseid(source, parser=None, *, base_url=None):             # <<<<<<<<<<<<<<
 *     u"""parseid(source, parser=None)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_51parseid, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_parseid, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[15]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xinclude.pxi":5
 * from lxml.includes cimport xinclude
 * 
 * class XIncludeError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Error during XInclude processing.
 *     """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_XIncludeError, __pyx_n_s_XIncludeError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_during_XInclude_processing); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_XIncludeError, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XIncludeError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[16]; __pyx_lineno = 5; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":3
 * # functions for tree cleanup and removing elements from subtrees
 * 
 * def cleanup_namespaces(tree_or_element):             # <<<<<<<<<<<<<<
 *     u"""cleanup_namespaces(tree_or_element)
 * 
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_53cleanup_namespaces, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_namespaces, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":13
 *     _removeUnusedNamespaceDeclarations(element._c_node)
 * 
 * def strip_attributes(tree_or_element, *attribute_names):             # <<<<<<<<<<<<<<
 *     u"""strip_attributes(tree_or_element, *attribute_names)
 * 
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_55strip_attributes, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_attributes, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":54
 *     tree.END_FOR_EACH_ELEMENT_FROM(c_node)
 * 
 * def strip_elements(tree_or_element, *tag_names, bint with_tail=True):             # <<<<<<<<<<<<<<
 *     u"""strip_elements(tree_or_element, *tag_names, with_tail=True)
 * 
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_57strip_elements, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_elements, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/cleanup.pxi":132
 * 
 * 
 * def strip_tags(tree_or_element, *tag_names):             # <<<<<<<<<<<<<<
 *     u"""strip_tags(tree_or_element, *tag_names)
 * 
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_59strip_tags, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_tags, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[17]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":3
 * # support for extension functions in XPath and XSLT
 * 
 * class XPathError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all XPath errors.
 *     """
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_XPathError, __pyx_n_s_XPathError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_of_all_XPath_errors); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_XPathError, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 3; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":8
 *     pass
 * 
 * class XPathEvalError(XPathError):             # <<<<<<<<<<<<<<
 *     u"""Error during XPath evaluation.
 *     """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_XPathEvalError, __pyx_n_s_XPathEvalError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_during_XPath_evaluation); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_XPathEvalError, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathEvalError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":13
 *     pass
 * 
 * class XPathFunctionError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     u"""Internal error looking up an XPath extension function.
 *     """
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathEvalError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_XPathFunctionError, __pyx_n_s_XPathFunctionError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Internal_error_looking_up_an_XPa); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_XPathFunctionError, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathFunctionError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 13; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":18
 *     pass
 * 
 * class XPathResultError(XPathEvalError):             # <<<<<<<<<<<<<<
 *     u"""Error handling an XPath result.
 *     """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathEvalError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_XPathResultError, __pyx_n_s_XPathResultError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_handling_an_XPath_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_XPathResultError, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathResultError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 18; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":371
 * 
 * cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
 *     b"Ok",             # <<<<<<<<<<<<<<
 *     b"Number encoding",
 *     b"Unfinished literal",
 */
  __Pyx_INCREF(__pyx_tuple__194);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES, __pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":426
 * 
 * 
 * def Extension(module, function_mapping=None, *, ns=None):             # <<<<<<<<<<<<<<
 *     u"""Extension(module, function_mapping=None, ns=None)
 * 
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_61Extension, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Extension, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":732
 *         return self._parent
 * 
 * class _ElementStringResult(bytes):             # <<<<<<<<<<<<<<
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 */
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyBytes_Type))));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)((PyObject*)(&PyBytes_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyBytes_Type))));
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_ElementStringResult, __pyx_n_s_ElementStringResult, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":735
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 *     def getparent(self):             # <<<<<<<<<<<<<<
 *         return self._parent
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4lxml_5etree_20_ElementStringResult_1getparent, 0, __pyx_n_s_ElementStringResult_getparent, NULL, __pyx_n_s_lxml_etree, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__198)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_getparent, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/extensions.pxi":732
 *         return self._parent
 * 
 * class _ElementStringResult(bytes):             # <<<<<<<<<<<<<<
 *     # we need to use a Python class here, bytes cannot be C-subclassed
 *     # in Pyrex/Cython
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ElementStringResult, __pyx_t_7, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementStringResult, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 732; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":3
 * # XPath evaluation
 * 
 * class XPathSyntaxError(LxmlSyntaxError, XPathError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlSyntaxError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_XPathError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_7 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_6, __pyx_n_s_XPathSyntaxError, __pyx_n_s_XPathSyntaxError, (PyObject *) NULL, __pyx_n_s_lxml_etree, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_XPathSyntaxError, __pyx_t_6, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathSyntaxError, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":11
 * cdef object _XPATH_SYNTAX_ERRORS
 * _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 */
  __pyx_t_6 = PyInt_FromLong(XML_XPATH_NUMBER_ERROR); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":12
 * _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 */
  __pyx_t_1 = PyInt_FromLong(XML_XPATH_UNFINISHED_LITERAL_ERROR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":13
 *     xmlerror.XML_XPATH_NUMBER_ERROR,
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 */
  __pyx_t_7 = PyInt_FromLong(XML_XPATH_VARIABLE_REF_ERROR); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":14
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR
 */
  __pyx_t_8 = PyInt_FromLong(XML_XPATH_INVALID_PREDICATE_ERROR); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":15
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR
 * )
 */
  __pyx_t_13 = PyInt_FromLong(XML_XPATH_UNCLOSED_ERROR); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":16
 *     xmlerror.XML_XPATH_INVALID_PREDICATE_ERROR,
 *     xmlerror.XML_XPATH_UNCLOSED_ERROR,
 *     xmlerror.XML_XPATH_INVALID_CHAR_ERROR             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_9 = PyInt_FromLong(XML_XPATH_INVALID_CHAR_ERROR); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":11
 * cdef object _XPATH_SYNTAX_ERRORS
 * _XPATH_SYNTAX_ERRORS = (
 *     xmlerror.XML_XPATH_NUMBER_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNFINISHED_LITERAL_ERROR,
 *     xmlerror.XML_XPATH_VARIABLE_REF_ERROR,
 */
  __pyx_t_14 = PyTuple_New(6); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_13 = 0;
  __pyx_t_9 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":21
 * cdef object _XPATH_EVAL_ERRORS
 * _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 */
  __pyx_t_14 = PyInt_FromLong(XML_XPATH_UNDEF_VARIABLE_ERROR); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":22
 * _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 */
  __pyx_t_9 = PyInt_FromLong(XML_XPATH_UNDEF_PREFIX_ERROR); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":23
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 */
  __pyx_t_13 = PyInt_FromLong(XML_XPATH_UNKNOWN_FUNC_ERROR); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":24
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 */
  __pyx_t_8 = PyInt_FromLong(XML_XPATH_INVALID_OPERAND); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":25
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 */
  __pyx_t_7 = PyInt_FromLong(XML_XPATH_INVALID_TYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":26
 *     xmlerror.XML_XPATH_INVALID_OPERAND,
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
 */
  __pyx_t_1 = PyInt_FromLong(XML_XPATH_INVALID_ARITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":27
 *     xmlerror.XML_XPATH_INVALID_TYPE,
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION
 * )
 */
  __pyx_t_6 = PyInt_FromLong(XML_XPATH_INVALID_CTXT_SIZE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":28
 *     xmlerror.XML_XPATH_INVALID_ARITY,
 *     xmlerror.XML_XPATH_INVALID_CTXT_SIZE,
 *     xmlerror.XML_XPATH_INVALID_CTXT_POSITION             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_15 = PyInt_FromLong(XML_XPATH_INVALID_CTXT_POSITION); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":21
 * cdef object _XPATH_EVAL_ERRORS
 * _XPATH_EVAL_ERRORS = (
 *     xmlerror.XML_XPATH_UNDEF_VARIABLE_ERROR,             # <<<<<<<<<<<<<<
 *     xmlerror.XML_XPATH_UNDEF_PREFIX_ERROR,
 *     xmlerror.XML_XPATH_UNKNOWN_FUNC_ERROR,
 */
  __pyx_t_16 = PyTuple_New(8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_16, 5, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_16, 6, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_16, 7, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_14 = 0;
  __pyx_t_9 = 0;
  __pyx_t_13 = 0;
  __pyx_t_8 = 0;
  __pyx_t_7 = 0;
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_t_15 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":118
 * 
 * cdef bint _XPATH_VERSION_WARNING_REQUIRED
 * if _LIBXML_VERSION_INT == 20627:             # <<<<<<<<<<<<<<
 *     _XPATH_VERSION_WARNING_REQUIRED = 1
 * else:
 */
  __pyx_t_18 = ((__pyx_v_4lxml_5etree__LIBXML_VERSION_INT == 20627) != 0);
  if (__pyx_t_18) {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":119
 * cdef bint _XPATH_VERSION_WARNING_REQUIRED
 * if _LIBXML_VERSION_INT == 20627:
 *     _XPATH_VERSION_WARNING_REQUIRED = 1             # <<<<<<<<<<<<<<
 * else:
 *     _XPATH_VERSION_WARNING_REQUIRED = 0
 */
    __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED = 1;
    goto __pyx_L70;
  }
  /*else*/ {

    /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":121
 *     _XPATH_VERSION_WARNING_REQUIRED = 1
 * else:
 *     _XPATH_VERSION_WARNING_REQUIRED = 0             # <<<<<<<<<<<<<<
 * 
 * cdef class _XPathEvaluatorBase:
 */
    __pyx_v_4lxml_5etree__XPATH_VERSION_WARNING_REQUIRED = 0;
  }
  __pyx_L70:;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":380
 * 
 * 
 * def XPathEvaluator(etree_or_element, *, namespaces=None, extensions=None,             # <<<<<<<<<<<<<<
 *                    regexp=True, smart_strings=True):
 *     u"""XPathEvaluator(etree_or_element, namespaces=None, extensions=None, regexp=True, smart_strings=True)
 */
  __pyx_t_16 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_63XPathEvaluator, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPathEvaluator, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":478
 * cdef object _replace_strings
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub             # <<<<<<<<<<<<<<
 * _find_namespaces = re.compile(b'({[^}]+})').findall
 * 
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_tuple__202, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_sub); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__replace_strings);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__replace_strings, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xpath.pxi":479
 * cdef object _find_namespaces
 * _replace_strings = re.compile(b'("[^"]*")|(\'[^\']*\')').sub
 * _find_namespaces = re.compile(b'({[^}]+})').findall             # <<<<<<<<<<<<<<
 * 
 * cdef class ETXPath(XPath):
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_tuple__204, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_findall); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[18]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__find_namespaces);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__find_namespaces, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":5
 * from lxml.includes cimport xslt
 * 
 * class XSLTError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all XSLT errors.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_XSLTError, __pyx_n_s_XSLTError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_of_all_XSLT_errors); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_XSLTError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSLTError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":10
 *     pass
 * 
 * class XSLTParseError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error parsing a stylesheet document.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_XSLTParseError, __pyx_n_s_XSLTParseError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_parsing_a_stylesheet_docum); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_XSLTParseError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSLTParseError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":15
 *     pass
 * 
 * class XSLTApplyError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error running an XSL transformation.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_XSLTApplyError, __pyx_n_s_XSLTApplyError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_running_an_XSL_transformat); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_XSLTApplyError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSLTApplyError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":20
 *     pass
 * 
 * class XSLTSaveError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error serialising an XSLT result.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_XSLTSaveError, __pyx_n_s_XSLTSaveError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_serialising_an_XSLT_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_XSLTSaveError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSLTSaveError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":25
 *     pass
 * 
 * class XSLTExtensionError(XSLTError):             # <<<<<<<<<<<<<<
 *     u"""Error registering an XSLT extension.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_XSLTError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_XSLTExtensionError, __pyx_n_s_XSLTExtensionError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_registering_an_XSLT_extens); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_XSLTExtensionError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSLTExtensionError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":31
 * 
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)             # <<<<<<<<<<<<<<
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)
 * 
 */
  __pyx_t_15 = __pyx_f_4lxml_5etree___unpackIntVersion(LIBXSLT_VERSION); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXSLT_COMPILED_VERSION, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":32
 * # version information
 * LIBXSLT_COMPILED_VERSION = __unpackIntVersion(xslt.LIBXSLT_VERSION)
 * LIBXSLT_VERSION = __unpackIntVersion(xslt.xsltLibxsltVersion)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_15 = __pyx_f_4lxml_5etree___unpackIntVersion(xsltLibxsltVersion); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LIBXSLT_VERSION, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":162
 *     return c_doc
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader             # <<<<<<<<<<<<<<
 * xslt.xsltSetLoaderFunc(<xslt.xsltDocLoaderFunc>_xslt_doc_loader)
 * 
 */
  __pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER = xsltDocDefaultLoader;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":163
 * 
 * cdef xslt.xsltDocLoaderFunc XSLT_DOC_DEFAULT_LOADER = xslt.xsltDocDefaultLoader
 * xslt.xsltSetLoaderFunc(<xslt.xsltDocLoaderFunc>_xslt_doc_loader)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  xsltSetLoaderFunc(((xsltDocLoaderFunc)__pyx_f_4lxml_5etree__xslt_doc_loader));

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":203
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
 *     DENY_ALL = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)
 */
  __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":204
 * 
 *     DENY_ALL = XSLTAccessControl(
 *         read_file=False, write_file=False, create_dir=False,             # <<<<<<<<<<<<<<
 *         read_network=False, write_network=False)
 * 
 */
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_read_file, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_write_file, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_create_dir, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":205
 *     DENY_ALL = XSLTAccessControl(
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)             # <<<<<<<<<<<<<<
 * 
 *     DENY_WRITE = XSLTAccessControl(
 */
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_read_network, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_write_network, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":203
 *         self._setAccess(xslt.XSLT_SECPREF_WRITE_NETWORK, write_network)
 * 
 *     DENY_ALL = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=False, write_file=False, create_dir=False,
 *         read_network=False, write_network=False)
 */
  __pyx_t_16 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLTAccessControl)), __pyx_empty_tuple, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dict, __pyx_n_s_DENY_ALL, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":207
 *         read_network=False, write_network=False)
 * 
 *     DENY_WRITE = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)
 */
  __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":208
 * 
 *     DENY_WRITE = XSLTAccessControl(
 *         read_file=True, write_file=False, create_dir=False,             # <<<<<<<<<<<<<<
 *         read_network=True, write_network=False)
 * 
 */
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_read_file, Py_True) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_write_file, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_create_dir, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":209
 *     DENY_WRITE = XSLTAccessControl(
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_read_network, Py_True) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_write_network, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":207
 *         read_network=False, write_network=False)
 * 
 *     DENY_WRITE = XSLTAccessControl(             # <<<<<<<<<<<<<<
 *         read_file=True, write_file=False, create_dir=False,
 *         read_network=True, write_network=False)
 */
  __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XSLTAccessControl)), __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLTAccessControl->tp_dict, __pyx_n_s_DENY_WRITE, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLTAccessControl);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":267
 *         <xslt.xmlXPathFunction>_xpath_function_call)
 * 
 * cdef dict EMPTY_DICT = {}             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree_EMPTY_DICT);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree_EMPTY_DICT, ((PyObject*)__pyx_t_15));
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":435
 * 
 *     @staticmethod
 *     def strparam(strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */
  __pyx_t_15 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_4XSLT_7strparam, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":434
 *             return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         u"""strparam(strval)
 */
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_16, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLT->tp_dict, __pyx_n_s_strparam, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":435
 * 
 *     @staticmethod
 *     def strparam(strval):             # <<<<<<<<<<<<<<
 *         u"""strparam(strval)
 * 
 */
  __pyx_t_15 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_strparam); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":434
 *             return self._error_log.copy()
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def strparam(strval):
 *         u"""strparam(strval)
 */
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_16, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLT->tp_dict, __pyx_n_s_strparam, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":449
 * 
 *     @staticmethod
 *     def set_global_max_depth(int max_depth):             # <<<<<<<<<<<<<<
 *         u"""set_global_max_depth(max_depth)
 * 
 */
  __pyx_t_15 = PyCFunction_NewEx(&__pyx_mdef_4lxml_5etree_4XSLT_9set_global_max_depth, NULL, __pyx_n_s_lxml_etree); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":448
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         u"""set_global_max_depth(max_depth)
 */
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_16, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLT->tp_dict, __pyx_n_s_set_global_max_depth, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":449
 * 
 *     @staticmethod
 *     def set_global_max_depth(int max_depth):             # <<<<<<<<<<<<<<
 *         u"""set_global_max_depth(max_depth)
 * 
 */
  __pyx_t_15 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_4lxml_5etree_XSLT, __pyx_n_s_set_global_max_depth); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":448
 *         return _XSLTQuotedStringParam(strval)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def set_global_max_depth(int max_depth):
 *         u"""set_global_max_depth(max_depth)
 */
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_16, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_5etree_XSLT->tp_dict, __pyx_n_s_set_global_max_depth, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  PyType_Modified(__pyx_ptype_4lxml_5etree_XSLT);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":827
 * # functions like "output" and "write" are a potential security risk, but we
 * # rely on the user to configure XSLTAccessControl as needed
 * xslt.xsltRegisterAllExtras()             # <<<<<<<<<<<<<<
 * 
 * # enable EXSLT support for XSLT
 */
  xsltRegisterAllExtras();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":830
 * 
 * # enable EXSLT support for XSLT
 * xslt.exsltRegisterAll()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  exsltRegisterAll();

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":836
 * # XSLT PI support
 * 
 * cdef object _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')             # <<<<<<<<<<<<<<
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 */
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree_re, __pyx_n_s_compile); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_tuple__209, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__RE_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":837
 * 
 * cdef object _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall             # <<<<<<<<<<<<<<
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 * cdef XPath __findStylesheetByID = None
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_n_s_findall); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__FIND_PI_HREF, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":838
 * cdef object _RE_PI_HREF = re.compile(ur'\s+href\s*=\s*(?:\'([^\']*)\'|"([^"]*)")')
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub             # <<<<<<<<<<<<<<
 * cdef XPath __findStylesheetByID = None
 * 
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_5etree__RE_PI_HREF, __pyx_n_s_sub); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_XGOTREF(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__REPLACE_PI_HREF, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xslt.pxi":839
 * cdef object _FIND_PI_HREF = _RE_PI_HREF.findall
 * cdef object _REPLACE_PI_HREF = _RE_PI_HREF.sub
 * cdef XPath __findStylesheetByID = None             # <<<<<<<<<<<<<<
 * 
 * cdef _findStylesheetByID(_Document doc, id):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree___findStylesheetByID));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree___findStylesheetByID, ((struct __pyx_obj_4lxml_5etree_XPath *)Py_None));
  __Pyx_GIVEREF(Py_None);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":3274
 * # Validation
 * 
 * class DocumentInvalid(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Validation error.
 * 
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_DocumentInvalid, __pyx_n_s_DocumentInvalid, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Validation_error_Raised_by_all_d); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_DocumentInvalid, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DocumentInvalid, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":4
 * from lxml.includes cimport dtdvalid
 * 
 * class DTDError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class for DTD errors.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_DTDError, __pyx_n_s_DTDError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_for_DTD_errors); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_DTDError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTDError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":9
 *     pass
 * 
 * class DTDParseError(DTDError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing a DTD.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_DTDParseError, __pyx_n_s_DTDParseError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_parsing_a_DTD); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_DTDParseError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTDParseError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/dtd.pxi":14
 *     pass
 * 
 * class DTDValidateError(DTDError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with a DTD.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTDError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_DTDValidateError, __pyx_n_s_DTDValidateError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_validating_an_XML_do); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_DTDValidateError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTDValidateError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[20]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":4
 * from lxml.includes cimport relaxng
 * 
 * class RelaxNGError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class for RelaxNG errors.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_RelaxNGError, __pyx_n_s_RelaxNGError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_for_RelaxNG_errors); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_RelaxNGError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RelaxNGError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":9
 *     pass
 * 
 * class RelaxNGParseError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing an XML document as RelaxNG.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_RelaxNGParseError, __pyx_n_s_RelaxNGParseError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_parsing_an_XML_docum); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_RelaxNGParseError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RelaxNGParseError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/relaxng.pxi":14
 *     pass
 * 
 * class RelaxNGValidateError(RelaxNGError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with a RelaxNG schema.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_RelaxNGError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_RelaxNGValidateError, __pyx_n_s_RelaxNGValidateError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_validating_an_XML_do_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_RelaxNGValidateError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RelaxNGValidateError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[21]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":4
 * from lxml.includes cimport xmlschema
 * 
 * class XMLSchemaError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all XML Schema errors
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_XMLSchemaError, __pyx_n_s_XMLSchemaError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_of_all_XML_Schema_err); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_XMLSchemaError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLSchemaError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":9
 *     pass
 * 
 * class XMLSchemaParseError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing an XML document as XML Schema.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSchemaError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_XMLSchemaParseError, __pyx_n_s_XMLSchemaParseError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_parsing_an_XML_docum_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_XMLSchemaParseError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLSchemaParseError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":14
 *     pass
 * 
 * class XMLSchemaValidateError(XMLSchemaError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with an XML Schema.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_XMLSchemaError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_XMLSchemaValidateError, __pyx_n_s_XMLSchemaValidateError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_validating_an_XML_do_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_XMLSchemaValidateError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_XMLSchemaValidateError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":22
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":24
 * cdef XPath _check_for_default_attributes = XPath(
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})             # <<<<<<<<<<<<<<
 * 
 * cdef class XMLSchema(_Validator):
 */
  __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_u_xs, __pyx_kp_u_http_www_w3_org_2001_XMLSchema) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_namespaces, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/xmlschema.pxi":22
 * # XMLSchema
 * 
 * cdef XPath _check_for_default_attributes = XPath(             # <<<<<<<<<<<<<<
 *     u"boolean(//xs:attribute[@default or @fixed][1])",
 *     namespaces={u'xs': u'http://www.w3.org/2001/XMLSchema'})
 */
  __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree_XPath)), __pyx_tuple__210, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[22]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_XGOTREF(((PyObject *)__pyx_v_4lxml_5etree__check_for_default_attributes));
  __Pyx_DECREF_SET(__pyx_v_4lxml_5etree__check_for_default_attributes, ((struct __pyx_obj_4lxml_5etree_XPath *)__pyx_t_15));
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":4
 * from lxml.includes cimport schematron
 * 
 * class SchematronError(LxmlError):             # <<<<<<<<<<<<<<
 *     u"""Base class of all Schematron errors.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_LxmlError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_SchematronError, __pyx_n_s_SchematronError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Base_class_of_all_Schematron_err); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_SchematronError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SchematronError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":9
 *     pass
 * 
 * class SchematronParseError(SchematronError):             # <<<<<<<<<<<<<<
 *     u"""Error while parsing an XML document as Schematron schema.
 *     """
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_SchematronError); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_16, __pyx_t_15, __pyx_n_s_SchematronParseError, __pyx_n_s_SchematronParseError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_parsing_an_XML_docum_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_16, __pyx_n_s_SchematronParseError, __pyx_t_15, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SchematronParseError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/schematron.pxi":14
 *     pass
 * 
 * class SchematronValidateError(SchematronError):             # <<<<<<<<<<<<<<
 *     u"""Error while validating an XML document with a Schematron schema.
 *     """
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_SchematronError); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_16, __pyx_n_s_SchematronValidateError, __pyx_n_s_SchematronValidateError, (PyObject *) NULL, __pyx_n_s_lxml_etree, __pyx_kp_s_Error_while_validating_an_XML_do_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_SchematronValidateError, __pyx_t_16, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SchematronValidateError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[23]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/debug.pxi":93
 *             stdio.fclose(f)
 * 
 * memory_debugger = _MemDebug()             # <<<<<<<<<<<<<<
 */
  __pyx_t_16 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4lxml_5etree__MemDebug)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_memory_debugger, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[25]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "/home/stefan/source/Python/lxml/lxml-release/src/lxml/lxml.etree.pyx":1
 * u"""The ``lxml.etree`` module implements the extended ElementTree API             # <<<<<<<<<<<<<<
 * for XML.
 * """
 */
  __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  if (PyDict_SetItem(__pyx_t_16, __pyx_kp_u_XML_line_2987, __pyx_kp_u_XML_text_parser_None_base_url_No) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (__Pyx_RegisterCleanup()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  if (__pyx_m) {
    __Pyx_AddTraceback("init lxml.etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init lxml.etree");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static void __Pyx_CleanupGlobals(void) {
  Py_CLEAR(__pyx_tuple_);
  Py_CLEAR(__pyx_tuple__2);
  Py_CLEAR(__pyx_tuple__5);
  Py_CLEAR(__pyx_tuple__6);
  Py_CLEAR(__pyx_slice__7);
  Py_CLEAR(__pyx_tuple__8);
  Py_CLEAR(__pyx_slice__9);
  Py_CLEAR(__pyx_tuple__10);
  Py_CLEAR(__pyx_slice__11);
  Py_CLEAR(__pyx_tuple__12);
  Py_CLEAR(__pyx_slice__13);
  Py_CLEAR(__pyx_tuple__16);
  Py_CLEAR(__pyx_tuple__17);
  Py_CLEAR(__pyx_tuple__18);
  Py_CLEAR(__pyx_tuple__19);
  Py_CLEAR(__pyx_tuple__20);
  Py_CLEAR(__pyx_tuple__22);
  Py_CLEAR(__pyx_tuple__23);
  Py_CLEAR(__pyx_tuple__26);
  Py_CLEAR(__pyx_tuple__27);
  Py_CLEAR(__pyx_tuple__28);
  Py_CLEAR(__pyx_slice__29);
  Py_CLEAR(__pyx_slice__31);
  Py_CLEAR(__pyx_slice__32);
  Py_CLEAR(__pyx_slice__33);
  Py_CLEAR(__pyx_tuple__36);
  Py_CLEAR(__pyx_tuple__37);
  Py_CLEAR(__pyx_tuple__38);
  Py_CLEAR(__pyx_tuple__39);
  Py_CLEAR(__pyx_tuple__40);
  Py_CLEAR(__pyx_tuple__41);
  Py_CLEAR(__pyx_tuple__42);
  Py_CLEAR(__pyx_slice__43);
  Py_CLEAR(__pyx_tuple__44);
  Py_CLEAR(__pyx_slice__45);
  Py_CLEAR(__pyx_tuple__47);
  Py_CLEAR(__pyx_tuple__48);
  Py_CLEAR(__pyx_tuple__49);
  Py_CLEAR(__pyx_tuple__50);
  Py_CLEAR(__pyx_tuple__57);
  Py_CLEAR(__pyx_tuple__58);
  Py_CLEAR(__pyx_tuple__59);
  Py_CLEAR(__pyx_tuple__61);
  Py_CLEAR(__pyx_tuple__65);
  Py_CLEAR(__pyx_slice__66);
  Py_CLEAR(__pyx_slice__67);
  Py_CLEAR(__pyx_tuple__68);
  Py_CLEAR(__pyx_slice__69);
  Py_CLEAR(__pyx_tuple__71);
  Py_CLEAR(__pyx_tuple__72);
  Py_CLEAR(__pyx_tuple__73);
  Py_CLEAR(__pyx_tuple__74);
  Py_CLEAR(__pyx_tuple__75);
  Py_CLEAR(__pyx_tuple__76);
  Py_CLEAR(__pyx_tuple__77);
  Py_CLEAR(__pyx_tuple__78);
  Py_CLEAR(__pyx_tuple__79);
  Py_CLEAR(__pyx_tuple__80);
  Py_CLEAR(__pyx_tuple__81);
  Py_CLEAR(__pyx_tuple__82);
  Py_CLEAR(__pyx_tuple__83);
  Py_CLEAR(__pyx_slice__84);
  Py_CLEAR(__pyx_slice__85);
  Py_CLEAR(__pyx_tuple__86);
  Py_CLEAR(__pyx_tuple__87);
  Py_CLEAR(__pyx_tuple__88);
  Py_CLEAR(__pyx_tuple__89);
  Py_CLEAR(__pyx_slice__90);
  Py_CLEAR(__pyx_tuple__91);
  Py_CLEAR(__pyx_tuple__93);
  Py_CLEAR(__pyx_tuple__94);
  Py_CLEAR(__pyx_tuple__95);
  Py_CLEAR(__pyx_tuple__96);
  Py_CLEAR(__pyx_tuple__97);
  Py_CLEAR(__pyx_tuple__98);
  Py_CLEAR(__pyx_tuple__99);
  Py_CLEAR(__pyx_tuple__100);
  Py_CLEAR(__pyx_tuple__101);
  Py_CLEAR(__pyx_tuple__102);
  Py_CLEAR(__pyx_tuple__103);
  Py_CLEAR(__pyx_tuple__104);
  Py_CLEAR(__pyx_tuple__105);
  Py_CLEAR(__pyx_tuple__106);
  Py_CLEAR(__pyx_codeobj__107);
  Py_CLEAR(__pyx_tuple__108);
  Py_CLEAR(__pyx_codeobj__109);
  Py_CLEAR(__pyx_tuple__110);
  Py_CLEAR(__pyx_codeobj__111);
  Py_CLEAR(__pyx_tuple__112);
  Py_CLEAR(__pyx_codeobj__113);
  Py_CLEAR(__pyx_tuple__114);
  Py_CLEAR(__pyx_codeobj__115);
  Py_CLEAR(__pyx_tuple__116);
  Py_CLEAR(__pyx_codeobj__117);
  Py_CLEAR(__pyx_tuple__118);
  Py_CLEAR(__pyx_codeobj__119);
  Py_CLEAR(__pyx_tuple__120);
  Py_CLEAR(__pyx_tuple__121);
  Py_CLEAR(__pyx_tuple__122);
  Py_CLEAR(__pyx_codeobj__123);
  Py_CLEAR(__pyx_tuple__124);
  Py_CLEAR(__pyx_codeobj__125);
  Py_CLEAR(__pyx_tuple__126);
  Py_CLEAR(__pyx_tuple__127);
  Py_CLEAR(__pyx_codeobj__128);
  Py_CLEAR(__pyx_tuple__129);
  Py_CLEAR(__pyx_tuple__130);
  Py_CLEAR(__pyx_codeobj__131);
  Py_CLEAR(__pyx_tuple__132);
  Py_CLEAR(__pyx_tuple__133);
  Py_CLEAR(__pyx_tuple__134);
  Py_CLEAR(__pyx_tuple__135);
  Py_CLEAR(__pyx_tuple__136);
  Py_CLEAR(__pyx_codeobj__137);
  Py_CLEAR(__pyx_tuple__138);
  Py_CLEAR(__pyx_codeobj__139);
  Py_CLEAR(__pyx_tuple__140);
  Py_CLEAR(__pyx_codeobj__141);
  Py_CLEAR(__pyx_tuple__142);
  Py_CLEAR(__pyx_codeobj__143);
  Py_CLEAR(__pyx_tuple__144);
  Py_CLEAR(__pyx_codeobj__145);
  Py_CLEAR(__pyx_tuple__146);
  Py_CLEAR(__pyx_codeobj__147);
  Py_CLEAR(__pyx_tuple__148);
  Py_CLEAR(__pyx_codeobj__149);
  Py_CLEAR(__pyx_tuple__150);
  Py_CLEAR(__pyx_codeobj__151);
  Py_CLEAR(__pyx_tuple__152);
  Py_CLEAR(__pyx_codeobj__153);
  Py_CLEAR(__pyx_tuple__154);
  Py_CLEAR(__pyx_codeobj__155);
  Py_CLEAR(__pyx_tuple__156);
  Py_CLEAR(__pyx_codeobj__157);
  Py_CLEAR(__pyx_tuple__158);
  Py_CLEAR(__pyx_codeobj__159);
  Py_CLEAR(__pyx_tuple__160);
  Py_CLEAR(__pyx_codeobj__161);
  Py_CLEAR(__pyx_tuple__162);
  Py_CLEAR(__pyx_codeobj__163);
  Py_CLEAR(__pyx_tuple__164);
  Py_CLEAR(__pyx_codeobj__165);
  Py_CLEAR(__pyx_tuple__166);
  Py_CLEAR(__pyx_codeobj__167);
  Py_CLEAR(__pyx_tuple__168);
  Py_CLEAR(__pyx_codeobj__169);
  Py_CLEAR(__pyx_tuple__170);
  Py_CLEAR(__pyx_codeobj__171);
  Py_CLEAR(__pyx_tuple__172);
  Py_CLEAR(__pyx_codeobj__173);
  Py_CLEAR(__pyx_tuple__174);
  Py_CLEAR(__pyx_codeobj__175);
  Py_CLEAR(__pyx_codeobj__176);
  Py_CLEAR(__pyx_tuple__177);
  Py_CLEAR(__pyx_tuple__178);
  Py_CLEAR(__pyx_codeobj__179);
  Py_CLEAR(__pyx_tuple__180);
  Py_CLEAR(__pyx_codeobj__181);
  Py_CLEAR(__pyx_tuple__182);
  Py_CLEAR(__pyx_codeobj__183);
  Py_CLEAR(__pyx_tuple__184);
  Py_CLEAR(__pyx_codeobj__185);
  Py_CLEAR(__pyx_tuple__186);
  Py_CLEAR(__pyx_codeobj__187);
  Py_CLEAR(__pyx_tuple__188);
  Py_CLEAR(__pyx_codeobj__189);
  Py_CLEAR(__pyx_tuple__190);
  Py_CLEAR(__pyx_codeobj__191);
  Py_CLEAR(__pyx_tuple__192);
  Py_CLEAR(__pyx_codeobj__193);
  Py_CLEAR(__pyx_tuple__194);
  Py_CLEAR(__pyx_tuple__195);
  Py_CLEAR(__pyx_codeobj__196);
  Py_CLEAR(__pyx_tuple__197);
  Py_CLEAR(__pyx_codeobj__198);
  Py_CLEAR(__pyx_tuple__199);
  Py_CLEAR(__pyx_codeobj__200);
  Py_CLEAR(__pyx_tuple__202);
  Py_CLEAR(__pyx_tuple__204);
  Py_CLEAR(__pyx_tuple__205);
  Py_CLEAR(__pyx_codeobj__206);
  Py_CLEAR(__pyx_tuple__207);
  Py_CLEAR(__pyx_codeobj__208);
  Py_CLEAR(__pyx_tuple__209);
  Py_CLEAR(__pyx_tuple__210);
  #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
Py_CLEAR(__pyx_print);
Py_CLEAR(__pyx_print_kwargs);
#endif

if (__pyx_code_cache.entries) {
      __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
      int i, count = __pyx_code_cache.count;
      __pyx_code_cache.count = 0;
      __pyx_code_cache.max_count = 0;
      __pyx_code_cache.entries = NULL;
      for (i=0; i<count; i++) {
          Py_DECREF(entries[i].code_object);
      }
      PyMem_Free(entries);
  }

}
static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
  /*--- Global cleanup code ---*/
  Py_CLEAR(__pyx_v_4lxml_5etree__check_for_default_attributes);
  Py_CLEAR(__pyx_v_4lxml_5etree___findStylesheetByID);
  Py_CLEAR(__pyx_v_4lxml_5etree__REPLACE_PI_HREF);
  Py_CLEAR(__pyx_v_4lxml_5etree__FIND_PI_HREF);
  Py_CLEAR(__pyx_v_4lxml_5etree__RE_PI_HREF);
  Py_CLEAR(__pyx_v_4lxml_5etree_EMPTY_DICT);
  Py_CLEAR(__pyx_v_4lxml_5etree__find_namespaces);
  Py_CLEAR(__pyx_v_4lxml_5etree__replace_strings);
  Py_CLEAR(__pyx_v_4lxml_5etree__XPATH_EVAL_ERRORS);
  Py_CLEAR(__pyx_v_4lxml_5etree__XPATH_SYNTAX_ERRORS);
  Py_CLEAR(__pyx_v_4lxml_5etree_LIBXML2_XPATH_ERROR_MESSAGES);
  Py_CLEAR(__pyx_v_4lxml_5etree__find_id_attributes);
  Py_CLEAR(__pyx_v_4lxml_5etree_GzipFile);
  Py_CLEAR(__pyx_v_4lxml_5etree_inspect_getargspec);
  Py_CLEAR(__pyx_v_4lxml_5etree_NS_END_EVENT);
  Py_CLEAR(__pyx_v_4lxml_5etree___DEFAULT_HTML_PARSER);
  Py_CLEAR(__pyx_v_4lxml_5etree___DEFAULT_XML_PARSER);
  Py_CLEAR(__pyx_v_4lxml_5etree___GLOBAL_PARSER_CONTEXT);
  Py_CLEAR(__pyx_v_4lxml_5etree__ParseError);
  Py_CLEAR(__pyx_v_4lxml_5etree__LxmlSyntaxError);
  Py_CLEAR(__pyx_v_4lxml_5etree___FUNCTION_NAMESPACE_REGISTRIES);
  Py_CLEAR(__pyx_v_4lxml_5etree_DEFAULT_ELEMENT_CLASS_LOOKUP);
  Py_CLEAR(__pyx_v_4lxml_5etree_ELEMENT_CLASS_LOOKUP_STATE);
  Py_CLEAR(__pyx_v_4lxml_5etree__FIND_PI_ATTRIBUTES);
  Py_CLEAR(__pyx_v_4lxml_5etree__PREFIX_CACHE);
  Py_CLEAR(__pyx_v_4lxml_5etree___RELAXNG_ERROR_TYPES);
  Py_CLEAR(__pyx_v_4lxml_5etree___PARSER_ERROR_TYPES);
  Py_CLEAR(__pyx_v_4lxml_5etree___ERROR_DOMAINS);
  Py_CLEAR(__pyx_v_4lxml_5etree___ERROR_LEVELS);
  Py_CLEAR(__pyx_v_4lxml_5etree___GLOBAL_ERROR_LOG);
  Py_CLEAR(__pyx_v_4lxml_5etree___HAS_XML_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree___REPLACE_XML_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree___RE_XML_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree_OrderedDict);
  Py_CLEAR(__pyx_v_4lxml_5etree_error_super_init);
  Py_CLEAR(__pyx_v_4lxml_5etree__Error);
  Py_CLEAR(__pyx_v_4lxml_5etree__check_internal_prefix);
  Py_CLEAR(__pyx_v_4lxml_5etree__DEFAULT_NAMESPACE_PREFIXES);
  Py_CLEAR(__pyx_v_4lxml_5etree__FILENAME_ENCODING);
  Py_CLEAR(__pyx_v_4lxml_5etree_IMMUTABLE_EMPTY_MAPPING);
  Py_CLEAR(__pyx_v_4lxml_5etree_ITER_EMPTY);
  Py_CLEAR(__pyx_v_4lxml_5etree_islice);
  Py_CLEAR(__pyx_v_4lxml_5etree_re);
  Py_CLEAR(__pyx_v_4lxml_5etree_sys);
  Py_CLEAR(__pyx_v_4lxml_5etree__elementpath);
  Py_CLEAR(__pyx_v_4lxml_5etree_StringIO);
  Py_CLEAR(__pyx_v_4lxml_5etree_BytesIO);
  Py_CLEAR(__pyx_v_4lxml_5etree_os_path_abspath);
  Py_CLEAR(__pyx_v_4lxml_5etree__unicode);
  __Pyx_CleanupGlobals();
  /*--- Type import cleanup code ---*/
  /*--- Builtin cleanup code ---*/
  Py_CLEAR(__pyx_builtin_ImportError);
  Py_CLEAR(__pyx_builtin_AttributeError);
  Py_CLEAR(__pyx_builtin_Exception);
  Py_CLEAR(__pyx_builtin_SyntaxError);
  Py_CLEAR(__pyx_builtin_object);
  Py_CLEAR(__pyx_builtin_staticmethod);
  Py_CLEAR(__pyx_builtin_KeyError);
  Py_CLEAR(__pyx_builtin_ValueError);
  Py_CLEAR(__pyx_builtin_super);
  Py_CLEAR(__pyx_builtin_MemoryError);
  Py_CLEAR(__pyx_builtin_range);
  Py_CLEAR(__pyx_builtin_id);
  Py_CLEAR(__pyx_builtin_TypeError);
  Py_CLEAR(__pyx_builtin_sorted);
  Py_CLEAR(__pyx_builtin_xrange);
  Py_CLEAR(__pyx_builtin_UnicodeEncodeError);
  Py_CLEAR(__pyx_builtin_UnicodeDecodeError);
  Py_CLEAR(__pyx_builtin_enumerate);
  Py_CLEAR(__pyx_builtin_IndexError);
  Py_CLEAR(__pyx_builtin_FutureWarning);
  Py_CLEAR(__pyx_builtin_NotImplemented);
  Py_CLEAR(__pyx_builtin_StopIteration);
  Py_CLEAR(__pyx_builtin_ReferenceError);
  Py_CLEAR(__pyx_builtin_IOError);
  Py_CLEAR(__pyx_builtin_LookupError);
  Py_CLEAR(__pyx_builtin_open);
  Py_CLEAR(__pyx_builtin_NotImplementedError);
  Py_CLEAR(__pyx_builtin_BaseException);
  Py_CLEAR(__pyx_builtin_AssertionError);
  /*--- Intern cleanup code ---*/
  Py_CLEAR(__pyx_empty_tuple);
  while (__pyx_freecount_4lxml_5etree__Document > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__Document[--__pyx_freecount_4lxml_5etree__Document];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__LogEntry > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__LogEntry[--__pyx_freecount_4lxml_5etree__LogEntry];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__Attrib > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__Attrib[--__pyx_freecount_4lxml_5etree__Attrib];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__FileWriterElement > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__FileWriterElement[--__pyx_freecount_4lxml_5etree__FileWriterElement];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__XSLTQuotedStringParam[--__pyx_freecount_4lxml_5etree__XSLTQuotedStringParam];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__DTDElementContentDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDElementContentDecl[--__pyx_freecount_4lxml_5etree__DTDElementContentDecl];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__DTDAttributeDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDAttributeDecl[--__pyx_freecount_4lxml_5etree__DTDAttributeDecl];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__DTDElementDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDElementDecl[--__pyx_freecount_4lxml_5etree__DTDElementDecl];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree__DTDEntityDecl > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree__DTDEntityDecl[--__pyx_freecount_4lxml_5etree__DTDEntityDecl];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct__itervalues[--__pyx_freecount_4lxml_5etree___pyx_scope_struct__itervalues];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_1_iterattributes[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_1_iterattributes];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_2_iterelements[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_2_iterelements];
    (*Py_TYPE(o)->tp_free)(o);
  }
  while (__pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities > 0) {
    PyObject* o = (PyObject*)__pyx_freelist_4lxml_5etree___pyx_scope_struct_3_iterentities[--__pyx_freecount_4lxml_5etree___pyx_scope_struct_3_iterentities];
    (*Py_TYPE(o)->tp_free)(o);
  }
  #if CYTHON_COMPILING_IN_PYPY
  Py_CLEAR(__pyx_b);
  #endif
  Py_CLEAR(__pyx_d);
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #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, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        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:
    Py_XDECREF(owned_instance);
    return;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
#if PY_VERSION_HEX >= 0x02060000
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
#endif
    result = (*call)(func, arg, kw);
#if PY_VERSION_HEX >= 0x02060000
    Py_LeaveRecursiveCall();
#endif
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_items, d);
    else
        return PyDict_Items(d);
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (PyErr_ExceptionMatches(PyExc_OverflowError))
                    PyErr_Clear();
                else
                    goto bad;
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CPYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_ass_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (PyErr_ExceptionMatches(PyExc_OverflowError))
                    PyErr_Clear();
                else
                    goto bad;
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object does not support slice %.10s",
        Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
bad:
    return -1;
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #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 CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
#else
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
#endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}

static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        length = strlen(cstring);
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(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 CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

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,
                                               int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return -1;
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        stop = length;
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02050000
    if (Py_TYPE(L) == &PySet_Type) {
        return PySet_Pop(L);
    }
#endif
    return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000
    if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        Py_SIZE(L) -= 1;
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
#endif
    return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        #if CYTHON_PEP393_ENABLED
        if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, length * kind);
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(!iternext)) {
#else
    if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
#endif
        PyErr_Format(PyExc_TypeError,
            "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
        return NULL;
    }
    next = iternext(iterator);
    if (likely(next))
        return next;
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_VERSION_HEX >= 0x03010000 || (PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000)
    if (unlikely(iternext == &_PyObject_NextNotImplemented))
        return NULL;
#endif
#endif
    if (defval) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
            if (unlikely(exc_type != PyExc_StopIteration) &&
                    !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))
                return NULL;
            PyErr_Clear();
        }
        Py_INCREF(defval);
        return defval;
    }
    if (!PyErr_Occurred())
        PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                             int is_tuple, int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
        iternextfunc iternext;
        iter = PyObject_GetIter(tuple);
        if (unlikely(!iter)) goto bad;
        if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
        iternext = Py_TYPE(iter)->tp_iternext;
        value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
        value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
        if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
        Py_DECREF(iter);
    } else {
        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
            __Pyx_UnpackTupleError(tuple, 2);
            goto bad;
        }
#if CYTHON_COMPILING_IN_PYPY
        value1 = PySequence_ITEM(tuple, 0);
        if (unlikely(!value1)) goto bad;
        value2 = PySequence_ITEM(tuple, 1);
        if (unlikely(!value2)) goto bad;
#else
        value1 = PyTuple_GET_ITEM(tuple, 0);
        value2 = PyTuple_GET_ITEM(tuple, 1);
        Py_INCREF(value1);
        Py_INCREF(value2);
#endif
        if (decref_tuple) { Py_DECREF(tuple); }
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
#if !CYTHON_COMPILING_IN_PYPY
    if (is_dict) {
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#endif
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_values, d);
    else
        return PyDict_Values(d);
}

static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    } else {
        if (default_value == Py_None)
            default_value = NULL;
        value = PyObject_CallMethodObjArgs(
            d, __pyx_n_s_get, key, default_value, NULL);
    }
#endif
    return value;
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_traverse != current_tp_traverse)
        type = type->tp_base;
    while (type && type->tp_traverse == current_tp_traverse)
        type = type->tp_base;
    if (type && type->tp_traverse)
        return type->tp_traverse(obj, v, a);
    return 0;
}

static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_clear != current_tp_clear)
        type = type->tp_base;
    while (type && type->tp_clear == current_tp_clear)
        type = type->tp_base;
    if (type && type->tp_clear)
        type->tp_clear(obj);
}

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_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        value = Py_None; /* Mark as deleted */
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*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
#if PY_VERSION_HEX >= 0x030400a1
    0,                                  /*tp_finalize*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module_2, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc_3, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result)
        result = __Pyx_GetModuleGlobalName(name);
    return result;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#if PY_MAJOR_VERSION < 3
static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
    __pyx_module_cleanup(module);
    Py_INCREF(Py_None); return Py_None;
}
static int __Pyx_RegisterCleanup(void) {
    static PyMethodDef cleanup_def = {
        __Pyx_NAMESTR("__cleanup"), (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
    PyObject *cleanup_func = 0;
    PyObject *atexit = 0;
    PyObject *reg = 0;
    PyObject *args = 0;
    PyObject *res = 0;
    int ret = -1;
    cleanup_func = PyCFunction_New(&cleanup_def, 0);
    if (!cleanup_func)
        goto bad;
    atexit = __Pyx_ImportModule("atexit");
    if (!atexit)
        goto bad;
    reg = __Pyx_GetAttrString(atexit, "_exithandlers");
    if (reg && PyList_Check(reg)) {
        PyObject *a, *kw;
        a = PyTuple_New(0);
        kw = PyDict_New();
        if (!a || !kw) {
            Py_XDECREF(a);
            Py_XDECREF(kw);
            goto bad;
        }
        args = PyTuple_Pack(3, cleanup_func, a, kw);
        Py_DECREF(a);
        Py_DECREF(kw);
        if (!args)
            goto bad;
        ret = PyList_Insert(reg, 0, args);
    } else {
        if (!reg)
            PyErr_Clear();
        Py_XDECREF(reg);
        reg = __Pyx_GetAttrString(atexit, "register");
        if (!reg)
            goto bad;
        args = PyTuple_Pack(1, cleanup_func);
        if (!args)
            goto bad;
        res = PyObject_CallObject(reg, args);
        if (!res)
            goto bad;
        ret = 0;
    }
bad:
    Py_XDECREF(cleanup_func);
    Py_XDECREF(atexit);
    Py_XDECREF(reg);
    Py_XDECREF(args);
    Py_XDECREF(res);
    return ret;
}
#else
static int __Pyx_RegisterCleanup(void) {
    if (0) __Pyx_ImportModule(NULL);
    return 0;
}
#endif

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func)             \
    {                                                                     \
        func_type value = func(x);                                        \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                PyErr_SetString(PyExc_OverflowError,                      \
                    (is_unsigned && unlikely(value < zero)) ?             \
                    "can't convert negative value to " #target_type :     \
                    "value too large to convert to " #target_type);       \
                return (target_type) -1;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to int");
                return (int) -1;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(int)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (int) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to int");
                return (int) -1;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(int)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(int) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        PyObject* v;
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                goto error;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            goto error;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0) {
                switch (s[len-1]) {
                    case ' ': break;
                    case '\f': case '\r': case '\n': case '\t': case '\v':
                        PyFile_SoftSpace(f, 0);
                        break;
                    default:  break;
                }
            }
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            goto error;
        PyFile_SoftSpace(f, 0);
    }
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
}
#else /* Python 3 has a print function */
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            goto error;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        goto error;
    if (PyFile_WriteString("\n", f) < 0)
        goto error;
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
    /* the line below is just to avoid C compiler
     * warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}
#else /* Python 3 has a print function */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_Pack(1, o);
    if (unlikely(!arg_tuple))
        return -1;
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}
#endif

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to size_t");
                return (size_t) -1;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(size_t)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (size_t) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to size_t");
                return (size_t) -1;
            }
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(size_t)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(size_t) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(size_t) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong)
            } else if (sizeof(size_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character) {
    const Py_ssize_t length = PyBytes_GET_SIZE(bytes);
    char* char_start = PyBytes_AS_STRING(bytes);
    char* pos;
    for (pos=char_start; pos < char_start+length; pos++) {
        if (character == pos[0]) return 1;
    }
    return 0;
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE unsigned short __Pyx_PyInt_As_unsigned_short(PyObject *x) {
    const unsigned short neg_one = (unsigned short) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned short) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned short, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned short");
                return (unsigned short) -1;
            }
            return (unsigned short) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned short)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned short) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned short");
                return (unsigned short) -1;
            }
            if (sizeof(unsigned short) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(unsigned short) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned short)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned short) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned short) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(unsigned short) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, long, PyLong_AsLong)
            } else if (sizeof(unsigned short) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned short, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned short val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned short) -1;
        }
    } else {
        unsigned short val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned short) -1;
        val = __Pyx_PyInt_As_unsigned_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
    const char neg_one = (char) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(char) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(char),
                                     little, !is_unsigned);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
        } else {
            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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long) -1;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static PyObject *__Pyx_Generator_Next(PyObject *self);
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Generator_Close(PyObject *self);
static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (unlikely(et != PyExc_StopIteration) &&
            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
            if (!ev) {
                Py_INCREF(Py_None);
                ev = Py_None;
            }
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = ev;
            return 0;
        }
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = PyObject_GetAttr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PyObject_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
        /* Generators always return to their most recent caller, not
         * necessarily their creator. */
        if (self->exc_traceback) {
            PyThreadState *tstate = PyThreadState_GET();
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
        /* Don't keep the reference to f_back any longer than necessary.  It
         * may keep a chain of frames alive or it could create a reference
         * cycle. */
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Generator_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Generator_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Send(yf, value);
        } else {
            if (value == Py_None)
                ret = PyIter_Next(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, value);
}
static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Generator_Close(yf);
        if (!retval)
            return -1;
    } else {
        PyObject *meth;
        gen->is_running = 1;
        meth = PyObject_GetAttr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Close(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Generator_CloseIter(gen, yf);
        __Pyx_Generator_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
#if PY_VERSION_HEX < 0x02050000
        PyErr_SetNone(PyExc_StopIteration);
#else
        PyErr_SetNone(PyExc_GeneratorExit);
#endif
    retval = __Pyx_Generator_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
#if PY_VERSION_HEX >= 0x02050000
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
#endif
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();      /* ignore these errors */
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
#if PY_VERSION_HEX >= 0x02050000
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Generator_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Generator_Undelegate(gen);
            if (err < 0)
                return __Pyx_Generator_SendEx(gen, NULL);
            goto throw_here;
        }
#endif
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Throw(yf, args);
        } else {
            PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Generator_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Generator_FinishDelegation(gen);
        }
        return ret;
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Generator_SendEx(gen, NULL);
}
static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Generator_clear(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
            return;                     /* resurrected.  :( */
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Generator_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Generator_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Generator_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    /* Undo the temporary resurrection; can't use DECREF here, it would
     * cause a recursive call.
     */
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0)
        return; /* this is the normal path out */
    /* close() resurrected it!  Make it look like the original Py_DECREF
     * never happened.
     */
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
     * we need to undo that. */
    _Py_DEC_REFTOTAL;
#endif
    /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
     * chain, so no more to do there.
     * If COUNT_ALLOCS, the original decref bumped tp_frees, and
     * _Py_NewReference bumped tp_allocs:  both of those need to be
     * undone.
     */
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running",
#if PY_VERSION_HEX >= 0x02060000
     T_BOOL,
#else
     T_BYTE,
#endif
     offsetof(__pyx_GeneratorObject, is_running),
     READONLY,
     NULL},
    {0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
    {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
    {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
    {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("generator"),         /*tp_name*/
    sizeof(__pyx_GeneratorObject),      /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    0,                                   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    0,                                  /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_Generator_traverse,   /*tp_traverse*/
    0,                                  /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
    __pyx_Generator_methods,            /*tp_methods*/
    __pyx_Generator_memberlist,         /*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*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
#if PY_VERSION_HEX >= 0x030400a1
    0,                                  /*tp_del*/
#else
    __Pyx_Generator_del,                /*tp_del*/
#endif
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Generator_del,                /*tp_finalize*/
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure) {
    __pyx_GeneratorObject *gen =
        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (__pyx_GeneratorType == NULL) {
        return -1;
    }
    return 0;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        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,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) 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 = py_line;
    PyTraceBack_Here(py_frame);
bad:
    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;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_DATA_SIZE(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_VERSION_HEX >= 0x02060000
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
  #if PY_VERSION_HEX < 0x02060000
    return PyInt_AsSsize_t(b);
  #else
    return PyLong_AsSsize_t(b);
  #endif
  }
  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
}


#endif /* Py_PYTHON_H */
